Commit 684f00dc authored by Crell's avatar Crell Committed by effulgentsia
Browse files

Add a functional test for the new router.

parent 7139f025
<?php
namespace Drupal\system\Tests\Routing;
use Drupal\Core\Database\Database;
use Drupal\simpletest\WebTestBase;
/**
* Functional class for the full integrated routing system.
*/
class RouterTest extends WebTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('block', 'router_test');
public static function getInfo() {
return array(
'name' => 'Integrated Router tests',
'description' => 'Function Tests for the fully integrated routing system.',
'group' => 'Routing',
);
}
public function testCanRoute() {
$this->drupalGet('router_test/test1');
$this->assertRaw('test1', 'The correct string was returned because the route was successful.');
}
}
<?php
namespace Drupal\router_test;
use Symfony\Component\HttpFoundation\Response;
/**
* Description of TestControllers
*/
class TestControllers {
public function test1() {
return new Response('test1');
}
}
......@@ -3,10 +3,12 @@
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
function router_test_router_info() {
function router_test_route_info() {
$collection = new RouteCollection();
$route = new Route('router_test/test1');
$route = new Route('router_test/test1', array(
'_controller' => '\Drupal\router_test\TestControllers::test1'
));
$collection->add('router_test_1', $route);
return $collection;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment