Expanded class hierarchy of ApacheUrlMatcherTest
class ApacheUrlMatcherTest extends \PHPUnit_Framework_TestCase {
protected $server;
protected function setUp() {
$this->server = $_SERVER;
}
protected function tearDown() {
$_SERVER = $this->server;
}
/**
* @dataProvider getMatchData
*/
public function testMatch($name, $pathinfo, $server, $expect) {
$collection = new RouteCollection();
$context = new RequestContext();
$matcher = new ApacheUrlMatcher($collection, $context);
$_SERVER = $server;
$result = $matcher
->match($pathinfo, $server);
$this
->assertSame(var_export($expect, true), var_export($result, true));
}
public function getMatchData() {
return array(
array(
'Simple route',
'/hello/world',
array(
'_ROUTING__route' => 'hello',
'_ROUTING__controller' => 'AcmeBundle:Default:index',
'_ROUTING_name' => 'world',
),
array(
'_route' => 'hello',
'_controller' => 'AcmeBundle:Default:index',
'name' => 'world',
),
),
array(
'Route with params and defaults',
'/hello/hugo',
array(
'_ROUTING__route' => 'hello',
'_ROUTING__controller' => 'AcmeBundle:Default:index',
'_ROUTING_name' => 'hugo',
'_ROUTING_DEFAULTS_name' => 'world',
),
array(
'name' => 'hugo',
'_route' => 'hello',
'_controller' => 'AcmeBundle:Default:index',
),
),
array(
'Route with defaults only',
'/hello',
array(
'_ROUTING__route' => 'hello',
'_ROUTING__controller' => 'AcmeBundle:Default:index',
'_ROUTING_DEFAULTS_name' => 'world',
),
array(
'name' => 'world',
'_route' => 'hello',
'_controller' => 'AcmeBundle:Default:index',
),
),
array(
'REDIRECT_ envs',
'/hello/world',
array(
'REDIRECT__ROUTING__route' => 'hello',
'REDIRECT__ROUTING__controller' => 'AcmeBundle:Default:index',
'REDIRECT__ROUTING_name' => 'world',
),
array(
'_route' => 'hello',
'_controller' => 'AcmeBundle:Default:index',
'name' => 'world',
),
),
);
}
}
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ApacheUrlMatcherTest:: |
protected | property | ||
ApacheUrlMatcherTest:: |
public | function | ||
ApacheUrlMatcherTest:: |
protected | function | ||
ApacheUrlMatcherTest:: |
protected | function | ||
ApacheUrlMatcherTest:: |
public | function | @dataProvider getMatchData |