diff --git a/core/modules/aggregator/tests/aggregator_test.module b/core/modules/aggregator/tests/aggregator_test.module
index f1a61d7..b3d9bbc 100644
--- a/core/modules/aggregator/tests/aggregator_test.module
+++ b/core/modules/aggregator/tests/aggregator_test.module
@@ -1,74 +1 @@
 <?php
-
-use Drupal\Component\Utility\Crypt;
-
-/**
- * Implements hook_menu().
- */
-function aggregator_test_menu() {
-  $items['aggregator/test-feed'] = array(
-    'title' => 'Test feed static last modified date',
-    'description' => "A cached test feed with a static last modified date.",
-    'page callback' => 'aggregator_test_feed',
-    'access arguments' => array('access content'),
-    'type' => MENU_CALLBACK,
-  );
-  $items['aggregator/redirect'] = array(
-    'title' => 'Test feed with a redirect',
-    'description' => "A feed that redirects to another one",
-    'page callback' => 'aggregator_test_redirect',
-    'access arguments' => array('access content'),
-    'type' => MENU_CALLBACK,
-  );
-  return $items;
-}
-
-/**
- * Page callback. Generates a test feed and simulates last-modified and etags.
- *
- * @param $use_last_modified
- *   Set TRUE to send a last modified header.
- * @param $use_etag
- *   Set TRUE to send an etag.
- */
-function aggregator_test_feed($use_last_modified = FALSE, $use_etag = FALSE) {
-  $last_modified = strtotime('Sun, 19 Nov 1978 05:00:00 GMT');
-  $etag = Crypt::hashBase64($last_modified);
-
-  $if_modified_since = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) : FALSE;
-  $if_none_match = isset($_SERVER['HTTP_IF_NONE_MATCH']) ? stripslashes($_SERVER['HTTP_IF_NONE_MATCH']) : FALSE;
-
-  // Send appropriate response. We respond with a 304 not modified on either
-  // etag or on last modified.
-  if ($use_last_modified) {
-    drupal_add_http_header('Last-Modified', gmdate(DATE_RFC1123, $last_modified));
-  }
-  if ($use_etag) {
-    drupal_add_http_header('ETag', $etag);
-  }
-  // Return 304 not modified if either last modified or etag match.
-  if ($last_modified == $if_modified_since || $etag == $if_none_match) {
-    drupal_add_http_header('Status', '304 Not Modified');
-    return;
-  }
-
-  // The following headers force validation of cache:
-  drupal_add_http_header('Expires', 'Sun, 19 Nov 1978 05:00:00 GMT');
-  drupal_add_http_header('Cache-Control', 'must-revalidate');
-  drupal_add_http_header('Content-Type', 'application/rss+xml; charset=utf-8');
-
-  // Read actual feed from file.
-  $file_name = DRUPAL_ROOT . '/' . drupal_get_path('module', 'aggregator') . '/tests/aggregator_test_rss091.xml';
-  $handle = fopen($file_name, 'r');
-  $feed = fread($handle, filesize($file_name));
-  fclose($handle);
-
-  print $feed;
-}
-
-/**
- * Page callback that redirects to another feed.
- */
-function aggregator_test_redirect() {
-  drupal_goto('aggregator/test-feed', array(), 301);
-}
diff --git a/core/modules/aggregator/tests/aggregator_test.routing.yml b/core/modules/aggregator/tests/aggregator_test.routing.yml
new file mode 100644
index 0000000..7f9ab77
--- /dev/null
+++ b/core/modules/aggregator/tests/aggregator_test.routing.yml
@@ -0,0 +1,13 @@
+aggregator_test_feed:
+  pattern: '/aggregator/test-feed'
+  defaults:
+    _content: '\Drupal\aggregator_test\Controller\AggregatorTestController::aggregatorTestFeed'
+  requirements:
+    _permission: 'access content'
+
+aggregator_test_redirect:
+  pattern: '/aggregator/redirect'
+  defaults:
+    _content: '\Drupal\aggregator_test\Controller\AggregatorTestController::aggregatorTestRedirect'
+  requirements:
+    _permission: 'access content'
diff --git a/core/modules/aggregator/tests/lib/Drupal/aggregator_test/Controller/AggregatorTestController.php b/core/modules/aggregator/tests/lib/Drupal/aggregator_test/Controller/AggregatorTestController.php
new file mode 100644
index 0000000..7344d21
--- /dev/null
+++ b/core/modules/aggregator/tests/lib/Drupal/aggregator_test/Controller/AggregatorTestController.php
@@ -0,0 +1,70 @@
+<?php
+/**
+ * @file
+ * Contains \Drupal\aggregator_test\Controller\AggregatorTestController.
+ */
+
+namespace Drupal\aggregator_test\Controller;
+
+use Drupal\Component\Utility\Crypt;
+use Drupal\Core\Utility\RedirectResponse;
+
+/**
+ * Controller routines for aggregator_test routes.
+ */
+class AggregatorTestController {
+
+  /**
+   * Page callback. Generates a test feed and simulates last-modified and etags.
+   *
+   * @param $use_last_modified
+   *   Set TRUE to send a last modified header.
+   * @param $use_etag
+   *   Set TRUE to send an etag.
+   *
+   * @return string
+   *   An HTML string representing the contents of feeds page.
+   */
+  public function aggregatorTestFeed($use_last_modified = FALSE, $use_etag = FALSE) {
+    $last_modified = strtotime('Sun, 19 Nov 1978 05:00:00 GMT');
+    $etag = Crypt::hashBase64($last_modified);
+
+    $if_modified_since = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) : FALSE;
+    $if_none_match = isset($_SERVER['HTTP_IF_NONE_MATCH']) ? stripslashes($_SERVER['HTTP_IF_NONE_MATCH']) : FALSE;
+
+    // Send appropriate response. We respond with a 304 not modified on either
+    // etag or on last modified.
+    if ($use_last_modified) {
+      drupal_add_http_header('Last-Modified', gmdate(DATE_RFC1123, $last_modified));
+    }
+    if ($use_etag) {
+      drupal_add_http_header('ETag', $etag);
+    }
+    // Return 304 not modified if either last modified or etag match.
+    if ($last_modified == $if_modified_since || $etag == $if_none_match) {
+      drupal_add_http_header('Status', '304 Not Modified');
+      return;
+    }
+
+    // The following headers force validation of cache:
+    drupal_add_http_header('Expires', 'Sun, 19 Nov 1978 05:00:00 GMT');
+    drupal_add_http_header('Cache-Control', 'must-revalidate');
+    drupal_add_http_header('Content-Type', 'application/rss+xml; charset=utf-8');
+
+    // Read actual feed from file.
+    $file_name = DRUPAL_ROOT . '/' . drupal_get_path('module', 'aggregator') . '/tests/aggregator_test_rss091.xml';
+    $handle = fopen($file_name, 'r');
+    $feed = fread($handle, filesize($file_name));
+    fclose($handle);
+
+    print $feed;
+  }
+
+  /**
+   * Page callback that redirects to another feed.
+   */
+  function aggregatorTestRedirect() {
+    return new RedirectResponse('aggregator/test-feed', '301');
+  }
+
+}
