Merge branch '2.7'
* 2.7: [FrameworkBundle] fix routing descriptor for options exit when Twig environment is not set [Routing] fix misleading test for condition [Debug] fix test
This commit is contained in:
commit
88d88de80f
@ -83,6 +83,13 @@ EOF
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$twig = $this->getTwigEnvironment();
|
||||
|
||||
if (null === $twig) {
|
||||
$output->writeln('<error>The Twig environment needs to be set.</error>');
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
$filename = $input->getArgument('filename');
|
||||
|
||||
if (!$filename) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
Copyright (c) 2004-2015 Fabien Potencier
|
||||
Copyright (c) 2014-2015 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -60,7 +60,7 @@ class MarkdownDescriptor extends Descriptor
|
||||
."\n".'- Method: '.($route->getMethods() ? implode('|', $route->getMethods()) : 'ANY')
|
||||
."\n".'- Class: '.get_class($route)
|
||||
."\n".'- Defaults: '.$this->formatRouterConfig($route->getDefaults())
|
||||
."\n".'- Requirements: '.$this->formatRouterConfig($requirements) ?: 'NONE'
|
||||
."\n".'- Requirements: '.($requirements ? $this->formatRouterConfig($requirements) : 'NO CUSTOM')
|
||||
."\n".'- Options: '.$this->formatRouterConfig($route->getOptions());
|
||||
|
||||
$this->write(isset($options['name'])
|
||||
|
@ -83,7 +83,7 @@ class TextDescriptor extends Descriptor
|
||||
'<comment>Method</comment> '.($route->getMethods() ? implode('|', $route->getMethods()) : 'ANY'),
|
||||
'<comment>Class</comment> '.get_class($route),
|
||||
'<comment>Defaults</comment> '.$this->formatRouterConfig($route->getDefaults()),
|
||||
'<comment>Requirements</comment> '.$this->formatRouterConfig($requirements) ?: 'NO CUSTOM',
|
||||
'<comment>Requirements</comment> '.($requirements ? $this->formatRouterConfig($requirements) : 'NO CUSTOM'),
|
||||
'<comment>Options</comment> '.$this->formatRouterConfig($route->getOptions()),
|
||||
);
|
||||
|
||||
@ -378,6 +378,10 @@ class TextDescriptor extends Descriptor
|
||||
*/
|
||||
private function formatRouterConfig(array $array)
|
||||
{
|
||||
if (!count($array)) {
|
||||
return 'NONE';
|
||||
}
|
||||
|
||||
$string = '';
|
||||
ksort($array);
|
||||
foreach ($array as $name => $value) {
|
||||
|
@ -9,3 +9,7 @@
|
||||
- `name`: Joseph
|
||||
- Requirements:
|
||||
- `name`: [a-z]+
|
||||
- Options:
|
||||
- `compiler_class`: Symfony\Component\Routing\RouteCompiler
|
||||
- `opt1`: val1
|
||||
- `opt2`: val2
|
||||
|
@ -6,4 +6,8 @@
|
||||
- Method: PUT|POST
|
||||
- Class: Symfony\Component\Routing\Route
|
||||
- Defaults: NONE
|
||||
- Requirements: NONE
|
||||
- Requirements: NO CUSTOM
|
||||
- Options:
|
||||
- `compiler_class`: Symfony\Component\Routing\RouteCompiler
|
||||
- `opt1`: val1
|
||||
- `opt2`: val2
|
||||
|
@ -5,8 +5,8 @@
|
||||
<comment>Scheme</comment> http|https
|
||||
<comment>Method</comment> PUT|POST
|
||||
<comment>Class</comment> Symfony\Component\Routing\Route
|
||||
<comment>Defaults</comment>
|
||||
<comment>Requirements</comment>
|
||||
<comment>Defaults</comment> NONE
|
||||
<comment>Requirements</comment> NO CUSTOM
|
||||
<comment>Options</comment> compiler_class: Symfony\Component\Routing\RouteCompiler
|
||||
opt1: val1
|
||||
opt2: val2
|
||||
|
@ -12,6 +12,10 @@ route_1
|
||||
- `name`: Joseph
|
||||
- Requirements:
|
||||
- `name`: [a-z]+
|
||||
- Options:
|
||||
- `compiler_class`: Symfony\Component\Routing\RouteCompiler
|
||||
- `opt1`: val1
|
||||
- `opt2`: val2
|
||||
|
||||
|
||||
route_2
|
||||
@ -25,5 +29,8 @@ route_2
|
||||
- Method: PUT|POST
|
||||
- Class: Symfony\Component\Routing\Route
|
||||
- Defaults: NONE
|
||||
- Requirements: NONE
|
||||
|
||||
- Requirements: NO CUSTOM
|
||||
- Options:
|
||||
- `compiler_class`: Symfony\Component\Routing\RouteCompiler
|
||||
- `opt1`: val1
|
||||
- `opt2`: val2
|
||||
|
@ -49,8 +49,8 @@ class DumpDataCollectorTest extends \PHPUnit_Framework_TestCase
|
||||
);
|
||||
$this->assertEquals($xDump, $dump);
|
||||
|
||||
$this->assertStringStartsWith(
|
||||
'a:1:{i:0;a:5:{s:4:"data";O:39:"Symfony\Component\VarDumper\Cloner\Data":4:{s:45:"Symfony\Component\VarDumper\Cloner\Datadata";a:1:{i:0;a:1:{i:0;i:123;}}s:49:"Symfony\Component\VarDumper\Cloner\DatamaxDepth";i:20;s:57:"Symfony\Component\VarDumper\Cloner\DatamaxItemsPerDepth";i:-1;s:54:"Symfony\Component\VarDumper\Cloner\DatauseRefHandles";i:-1;}s:4:"name";s:25:"DumpDataCollectorTest.php";s:4:"file";s:',
|
||||
$this->assertStringMatchesFormat(
|
||||
'a:1:{i:0;a:5:{s:4:"data";O:39:"Symfony\Component\VarDumper\Cloner\Data":4:{s:45:"Symfony\Component\VarDumper\Cloner\Datadata";a:1:{i:0;a:1:{i:0;i:123;}}s:49:"Symfony\Component\VarDumper\Cloner\DatamaxDepth";i:%i;s:57:"Symfony\Component\VarDumper\Cloner\DatamaxItemsPerDepth";i:%i;s:54:"Symfony\Component\VarDumper\Cloner\DatauseRefHandles";i:%i;}s:4:"name";s:25:"DumpDataCollectorTest.php";s:4:"file";s:%a',
|
||||
str_replace("\0", '', $collector->serialize())
|
||||
);
|
||||
|
||||
|
@ -208,9 +208,9 @@ class RouteTest extends \PHPUnit_Framework_TestCase
|
||||
public function testCondition()
|
||||
{
|
||||
$route = new Route('/');
|
||||
$this->assertEquals(null, $route->getCondition());
|
||||
$this->assertSame('', $route->getCondition());
|
||||
$route->setCondition('context.getMethod() == "GET"');
|
||||
$this->assertEquals('context.getMethod() == "GET"', $route->getCondition());
|
||||
$this->assertSame('context.getMethod() == "GET"', $route->getCondition());
|
||||
}
|
||||
|
||||
public function testCompile()
|
||||
|
@ -1,4 +1,4 @@
|
||||
Copyright (c) 2004-2015 Fabien Potencier
|
||||
Copyright (c) 2014-2015 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -132,7 +132,7 @@ EOTXT
|
||||
|
||||
$this->assertSame(
|
||||
<<<EOTXT
|
||||
array:2 [
|
||||
array:3 [
|
||||
0 => array:1 [
|
||||
0 => &1 array:1 [
|
||||
0 => &1 array:1 [&1]
|
||||
@ -143,6 +143,7 @@ array:2 [
|
||||
"GLOBALS" => &2 array:1 [&2]
|
||||
]
|
||||
]
|
||||
2 => &2 array:1 [&2]
|
||||
]
|
||||
|
||||
EOTXT
|
||||
|
@ -9,6 +9,10 @@
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "p@tchwork.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "http://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
|
Reference in New Issue
Block a user