Register middleware
3 unresolved threads
3 unresolved threads
Closes #3513875
Merge request reports
Activity
167 167 'tags' => [['name' => 'event_subscriber']], 168 168 ]; 169 169 } 170 // Register test middleware. 171 $services['services']['testing.http_client.middleware'] = [ 172 'class' => 'Drupal\Core\Test\HttpClientMiddleware\TestHttpClientMiddleware', 173 'tags' => [['name' => 'http_client_middleware']], 174 ]; 175 $services['services']['testing.http_middleware.wait_terminate_middleware'] = [ 176 'class' => 'Drupal\Core\Test\StackMiddleware\TestWaitTerminateMiddleware', 177 'arguments' => ['@state', '@lock'], 178 'tags' => [['name' => 'http_middleware', 'priority' => -1024]], 179 ]; added 8 commits
-
2bb4d205...401a157f - 5 commits from branch
project:11.x
- 7a6ba02d - Register middleware
- 3c698128 - Baseline
- 3563ee89 - Use a container param instead of state
Toggle commit list-
2bb4d205...401a157f - 5 commits from branch
36 35 public function handle(Request $request, $type = self::MAIN_REQUEST, $catch = TRUE): Response { 37 36 $result = $this->httpKernel->handle($request, $type, $catch); 38 37 39 if ($this->state->get('drupal.test_wait_terminate')) { 40 // Set a header on the response to instruct the test runner that it must 41 // await the lock. Note that the lock acquired here is automatically 42 // released from within a shutdown function. 43 $this->lock->acquire('test_wait_terminate'); 44 $result->headers->set('X-Drupal-Wait-Terminate', '1'); 38 if (!$this->waitForTerminate) { 39 return $result; - Comment on lines +38 to +39
I originally removed the condition entirely but had to add it back, which is when I switched to an early return. I think that makes it much clearer. Since we're talking about moving 2 lines of code and 3 lines of comments, I don't think it's worth worrying about reviewability? It kind of forces the reviewer to read it and ensure the logic still makes sense.
56 55 * {@inheritdoc} 57 56 */ 58 57 public function register(ContainerBuilder $container) { 59 $this->registerTest($container); 60 added 24 commits
-
3563ee89...5da58a21 - 21 commits from branch
project:11.x
- f4446cb4 - Register middleware
- 36efbcc0 - Baseline
- 306a4e86 - Use a container param instead of state
Toggle commit list-
3563ee89...5da58a21 - 21 commits from branch
Please register or sign in to reply