Add a functional test for the new router.
parent
7139f0253c
commit
684f00dcc1
|
@ -0,0 +1,33 @@
|
|||
<?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.');
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
<?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;
|
||||
|
|
Loading…
Reference in New Issue