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');
$tableRows = array(
array('Route Name', $options['name']),
array('Route Name', isset($options['name']) ? $options['name'] : ''),
array('Path', $route->getPath()),
array('Path Regex', $route->compile()->getRegex()),
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));
$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()
@ -34,7 +35,7 @@ class RouterDebugCommandTest extends \PHPUnit_Framework_TestCase
$ret = $tester->execute(array('name' => 'foo'), array('decorated' => false));
$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));
$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()

View File

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