minor #15997 [FrameworkBundle] Fix tests (nicolas-grekas)

This PR was merged into the 2.8 branch.

Discussion
----------

[FrameworkBundle] Fix tests

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

#14132 missed tests updates

Commits
-------

5549f4c [FrameworkBundle] Fix tests
This commit is contained in:
Fabien Potencier 2015-09-30 08:06:33 +02:00
commit b630972379
6 changed files with 45 additions and 32 deletions

View File

@ -82,7 +82,7 @@ class TextDescriptor extends Descriptor
$tableHeaders = array('Property', 'Value'); $tableHeaders = array('Property', 'Value');
$tableRows = array( $tableRows = array(
array('Route Name', $options['name']), array('Route Name', isset($options['name']) ? $options['name'] : ''),
array('Path', $route->getPath()), array('Path', $route->getPath()),
array('Path Regex', $route->compile()->getRegex()), array('Path Regex', $route->compile()->getRegex()),
array('Host', ('' !== $route->getHost() ? $route->getHost() : 'ANY')), array('Host', ('' !== $route->getHost() ? $route->getHost() : 'ANY')),

View File

@ -25,7 +25,8 @@ class RouterDebugCommandTest extends \PHPUnit_Framework_TestCase
$ret = $tester->execute(array('name' => null), array('decorated' => false)); $ret = $tester->execute(array('name' => null), array('decorated' => false));
$this->assertEquals(0, $ret, 'Returns 0 in case of success'); $this->assertEquals(0, $ret, 'Returns 0 in case of success');
$this->assertContains('[router] Current routes', $tester->getDisplay()); $this->assertContains('Path', $tester->getDisplay());
$this->assertContains('/foo', $tester->getDisplay());
} }
public function testDebugSingleRoute() public function testDebugSingleRoute()
@ -34,7 +35,7 @@ class RouterDebugCommandTest extends \PHPUnit_Framework_TestCase
$ret = $tester->execute(array('name' => 'foo'), array('decorated' => false)); $ret = $tester->execute(array('name' => 'foo'), array('decorated' => false));
$this->assertEquals(0, $ret, 'Returns 0 in case of success'); $this->assertEquals(0, $ret, 'Returns 0 in case of success');
$this->assertContains('[router] Route "foo"', $tester->getDisplay()); $this->assertContains('Route Name | foo', $tester->getDisplay());
} }
/** /**

View File

@ -27,7 +27,7 @@ class RouterMatchCommandTest extends \PHPUnit_Framework_TestCase
$ret = $tester->execute(array('path_info' => '/foo', 'foo'), array('decorated' => false)); $ret = $tester->execute(array('path_info' => '/foo', 'foo'), array('decorated' => false));
$this->assertEquals(0, $ret, 'Returns 0 in case of success'); $this->assertEquals(0, $ret, 'Returns 0 in case of success');
$this->assertContains('[router] Route "foo"', $tester->getDisplay()); $this->assertContains('Route Name | foo', $tester->getDisplay());
} }
public function testWithNotMatchPath() public function testWithNotMatchPath()

View File

@ -1,12 +1,17 @@
<comment>Path</comment> /hello/{name} +--------------+---------------------------------------------------------+
<comment>Path Regex</comment> #^/hello(?:/(?P<name>[a-z]+))?$#s | Property | Value |
<comment>Host</comment> localhost +--------------+---------------------------------------------------------+
<comment>Host Regex</comment> #^localhost$#si | Route Name | |
<comment>Scheme</comment> http|https | Path | /hello/{name} |
<comment>Method</comment> GET|HEAD | Path Regex | #^/hello(?:/(?P<name>[a-z]+))?$#s |
<comment>Class</comment> Symfony\Component\Routing\Route | Host | localhost |
<comment>Defaults</comment> name: Joseph | Host Regex | #^localhost$#si |
<comment>Requirements</comment> name: [a-z]+ | Scheme | http|https |
<comment>Options</comment> compiler_class: Symfony\Component\Routing\RouteCompiler | Method | GET|HEAD |
opt1: val1 | Requirements | name: [a-z]+ |
opt2: val2 | Class | Symfony\Component\Routing\Route |
| Defaults | name: Joseph |
| Options | compiler_class: Symfony\Component\Routing\RouteCompiler |
| | opt1: val1 |
| | opt2: val2 |
+--------------+---------------------------------------------------------+

View File

@ -1,12 +1,17 @@
<comment>Path</comment> /name/add +--------------+---------------------------------------------------------+
<comment>Path Regex</comment> #^/name/add$#s | Property | Value |
<comment>Host</comment> localhost +--------------+---------------------------------------------------------+
<comment>Host Regex</comment> #^localhost$#si | Route Name | |
<comment>Scheme</comment> http|https | Path | /name/add |
<comment>Method</comment> PUT|POST | Path Regex | #^/name/add$#s |
<comment>Class</comment> Symfony\Component\Routing\Route | Host | localhost |
<comment>Defaults</comment> NONE | Host Regex | #^localhost$#si |
<comment>Requirements</comment> NO CUSTOM | Scheme | http|https |
<comment>Options</comment> compiler_class: Symfony\Component\Routing\RouteCompiler | Method | PUT|POST |
opt1: val1 | Requirements | NO CUSTOM |
opt2: val2 | Class | Symfony\Component\Routing\Route |
| Defaults | NONE |
| Options | compiler_class: Symfony\Component\Routing\RouteCompiler |
| | opt1: val1 |
| | opt2: val2 |
+--------------+---------------------------------------------------------+

View File

@ -1,4 +1,6 @@
<info>[router]</info> Current routes +---------+----------+------------+-----------+---------------+
Name  Method  Scheme  Host  Path  | Name | Method | Scheme | Host | Path |
route_1 GET|HEAD http|https localhost /hello/{name} +---------+----------+------------+-----------+---------------+
route_2 PUT|POST http|https localhost /name/add | route_1 | GET|HEAD | http|https | localhost | /hello/{name} |
| route_2 | PUT|POST | http|https | localhost | /name/add |
+---------+----------+------------+-----------+---------------+