diff --git c/core/modules/aggregator/tests/modules/aggregator_test/aggregator_test.routing.yml w/core/modules/aggregator/tests/modules/aggregator_test/aggregator_test.routing.yml index 9c2e96d..dff02c6 100644 --- c/core/modules/aggregator/tests/modules/aggregator_test/aggregator_test.routing.yml +++ w/core/modules/aggregator/tests/modules/aggregator_test/aggregator_test.routing.yml @@ -1,13 +1,17 @@ aggregator_test_feed: - pattern: '/aggregator/test-feed' + pattern: '/aggregator/test-feed/{use_last_modified}/{use_etag}' defaults: - _controller: '\Drupal\aggregator_test\Controller\AggregatorTestRssController::feed' + _controller: '\Drupal\aggregator_test\Controller\AggregatorTestRssController::testFeed' + _title: 'Test feed static last modified date' + use_last_modified: FALSE + use_etag: FALSE requirements: _permission: 'access content' aggregator_redirect: - pattern: 'aggregator/redirect' + pattern: '/aggregator/redirect' defaults: - _controller: '\Drupal\aggregator_test\Controller\AggregatorTestRssController::redirect' + _controller: '\Drupal\aggregator_test\Controller\AggregatorTestRssController::testRedirect' + _title: 'Test feed with a redirect' requirements: _permission: 'access content' diff --git c/core/modules/aggregator/tests/modules/aggregator_test/lib/Drupal/aggregator_test/Controller/AggregatorTestRssController.php w/core/modules/aggregator/tests/modules/aggregator_test/lib/Drupal/aggregator_test/Controller/AggregatorTestRssController.php index f8ca60b..1f70392 100644 --- c/core/modules/aggregator/tests/modules/aggregator_test/lib/Drupal/aggregator_test/Controller/AggregatorTestRssController.php +++ w/core/modules/aggregator/tests/modules/aggregator_test/lib/Drupal/aggregator_test/Controller/AggregatorTestRssController.php @@ -6,18 +6,12 @@ namespace Drupal\aggregator_test\Controller; +use Drupal\Core\Controller\ControllerBase; +use Drupal\Component\Utility\Crypt; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Drupal\Component\Utility\Crypt; -use Drupal\Core\Controller\ControllerInterface; -use Symfony\Component\HttpFoundation\RedirectResponse; - -class AggregatorTestRssController implements ControllerInterface { - public static function create(ContainerInterface $container) { - return new static(); - } +class AggregatorTestRssController extends ControllerBase { /** * Generates a test feed and simulates last-modified and etags. @@ -27,7 +21,7 @@ public static function create(ContainerInterface $container) { * @param $use_etag * Set TRUE to send an etag. */ - public function feed($use_last_modified = FALSE, $use_etag = FALSE, Request $request) { + public function testFeed($use_last_modified, $use_etag, Request $request) { $response = new Response(); $last_modified = strtotime('Sun, 19 Nov 1978 05:00:00 GMT'); @@ -47,7 +41,7 @@ public function feed($use_last_modified = FALSE, $use_etag = FALSE, Request $req // Return 304 not modified if either last modified or etag match. if ($last_modified == $if_modified_since || $etag == $if_none_match) { $response->setStatusCode(304); - return; + return $response; } // The following headers force validation of cache: @@ -65,10 +59,8 @@ public function feed($use_last_modified = FALSE, $use_etag = FALSE, Request $req return $response; } - public function redirect() { - - return new RedirectResponse(url('aggregator/test-feed', array('absolute' => TRUE)), 301); - + public function testRedirect() { + return $this->redirect($this->urlGenerator()->generateFromRoute('aggregator_test_feed'), 301); } }