Skip to content

Commit b630972

Browse files
committed
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
2 parents 00dffe7 + 5549f4c commit b630972

File tree

6 files changed

+45
-32
lines changed

6 files changed

+45
-32
lines changed

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ protected function describeRoute(Route $route, array $options = array())
8282

8383
$tableHeaders = array('Property', 'Value');
8484
$tableRows = array(
85-
array('Route Name', $options['name']),
85+
array('Route Name', isset($options['name']) ? $options['name'] : ''),
8686
array('Path', $route->getPath()),
8787
array('Path Regex', $route->compile()->getRegex()),
8888
array('Host', ('' !== $route->getHost() ? $route->getHost() : 'ANY')),

src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterDebugCommandTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ public function testDebugAllRoutes()
2525
$ret = $tester->execute(array('name' => null), array('decorated' => false));
2626

2727
$this->assertEquals(0, $ret, 'Returns 0 in case of success');
28-
$this->assertContains('[router] Current routes', $tester->getDisplay());
28+
$this->assertContains('Path', $tester->getDisplay());
29+
$this->assertContains('/foo', $tester->getDisplay());
2930
}
3031

3132
public function testDebugSingleRoute()
@@ -34,7 +35,7 @@ public function testDebugSingleRoute()
3435
$ret = $tester->execute(array('name' => 'foo'), array('decorated' => false));
3536

3637
$this->assertEquals(0, $ret, 'Returns 0 in case of success');
37-
$this->assertContains('[router] Route "foo"', $tester->getDisplay());
38+
$this->assertContains('Route Name | foo', $tester->getDisplay());
3839
}
3940

4041
/**

src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterMatchCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function testWithMatchPath()
2727
$ret = $tester->execute(array('path_info' => '/foo', 'foo'), array('decorated' => false));
2828

2929
$this->assertEquals(0, $ret, 'Returns 0 in case of success');
30-
$this->assertContains('[router] Route "foo"', $tester->getDisplay());
30+
$this->assertContains('Route Name | foo', $tester->getDisplay());
3131
}
3232

3333
public function testWithNotMatchPath()
Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
<comment>Path</comment> /hello/{name}
2-
<comment>Path Regex</comment> #^/hello(?:/(?P<name>[a-z]+))?$#s
3-
<comment>Host</comment> localhost
4-
<comment>Host Regex</comment> #^localhost$#si
5-
<comment>Scheme</comment> http|https
6-
<comment>Method</comment> GET|HEAD
7-
<comment>Class</comment> Symfony\Component\Routing\Route
8-
<comment>Defaults</comment> name: Joseph
9-
<comment>Requirements</comment> name: [a-z]+
10-
<comment>Options</comment> compiler_class: Symfony\Component\Routing\RouteCompiler
11-
opt1: val1
12-
opt2: val2
1+
+--------------+---------------------------------------------------------+
2+
| Property | Value |
3+
+--------------+---------------------------------------------------------+
4+
| Route Name | |
5+
| Path | /hello/{name} |
6+
| Path Regex | #^/hello(?:/(?P<name>[a-z]+))?$#s |
7+
| Host | localhost |
8+
| Host Regex | #^localhost$#si |
9+
| Scheme | http|https |
10+
| Method | GET|HEAD |
11+
| Requirements | name: [a-z]+ |
12+
| Class | Symfony\Component\Routing\Route |
13+
| Defaults | name: Joseph |
14+
| Options | compiler_class: Symfony\Component\Routing\RouteCompiler |
15+
| | opt1: val1 |
16+
| | opt2: val2 |
17+
+--------------+---------------------------------------------------------+
Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
<comment>Path</comment> /name/add
2-
<comment>Path Regex</comment> #^/name/add$#s
3-
<comment>Host</comment> localhost
4-
<comment>Host Regex</comment> #^localhost$#si
5-
<comment>Scheme</comment> http|https
6-
<comment>Method</comment> PUT|POST
7-
<comment>Class</comment> Symfony\Component\Routing\Route
8-
<comment>Defaults</comment> NONE
9-
<comment>Requirements</comment> NO CUSTOM
10-
<comment>Options</comment> compiler_class: Symfony\Component\Routing\RouteCompiler
11-
opt1: val1
12-
opt2: val2
1+
+--------------+---------------------------------------------------------+
2+
| Property | Value |
3+
+--------------+---------------------------------------------------------+
4+
| Route Name | |
5+
| Path | /name/add |
6+
| Path Regex | #^/name/add$#s |
7+
| Host | localhost |
8+
| Host Regex | #^localhost$#si |
9+
| Scheme | http|https |
10+
| Method | PUT|POST |
11+
| Requirements | NO CUSTOM |
12+
| Class | Symfony\Component\Routing\Route |
13+
| Defaults | NONE |
14+
| Options | compiler_class: Symfony\Component\Routing\RouteCompiler |
15+
| | opt1: val1 |
16+
| | opt2: val2 |
17+
+--------------+---------------------------------------------------------+
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<info>[router]</info> Current routes
2-
Name  Method  Scheme  Host  Path 
3-
route_1 GET|HEAD http|https localhost /hello/{name}
4-
route_2 PUT|POST http|https localhost /name/add
1+
+---------+----------+------------+-----------+---------------+
2+
| Name | Method | Scheme | Host | Path |
3+
+---------+----------+------------+-----------+---------------+
4+
| route_1 | GET|HEAD | http|https | localhost | /hello/{name} |
5+
| route_2 | PUT|POST | http|https | localhost | /name/add |
6+
+---------+----------+------------+-----------+---------------+

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy