Merge branch '2.8' into 3.1

* 2.8:
  add dependency on Twig
  [Config] Do not skip YamlReferenceDumperTest entirely
  [Config] Fix YamlReferenceDumper extra space
This commit is contained in:
Fabien Potencier 2016-12-09 08:41:06 +01:00
commit 9369b4df83
5 changed files with 8 additions and 8 deletions

View File

@ -19,7 +19,8 @@
"php": ">=5.5.9", "php": ">=5.5.9",
"symfony/http-kernel": "~3.1", "symfony/http-kernel": "~3.1",
"symfony/routing": "~2.8|~3.0", "symfony/routing": "~2.8|~3.0",
"symfony/twig-bridge": "~2.8|~3.0" "symfony/twig-bridge": "~2.8|~3.0",
"twig/twig": "~1.28|~2.0"
}, },
"require-dev": { "require-dev": {
"symfony/config": "~2.8|~3.0", "symfony/config": "~2.8|~3.0",

View File

@ -125,7 +125,7 @@ class YamlReferenceDumper
$default = (string) $default != '' ? ' '.$default : ''; $default = (string) $default != '' ? ' '.$default : '';
$comments = count($comments) ? '# '.implode(', ', $comments) : ''; $comments = count($comments) ? '# '.implode(', ', $comments) : '';
$text = rtrim(sprintf('%-20s %s %s', $node->getName().':', $default, $comments), ' '); $text = rtrim(sprintf('%-21s%s %s', $node->getName().':', $default, $comments), ' ');
if ($info = $node->getInfo()) { if ($info = $node->getInfo()) {
$this->writeLine(''); $this->writeLine('');

View File

@ -49,6 +49,7 @@ class XmlReferenceDumperTest extends \PHPUnit_Framework_TestCase
scalar-array-empty="" scalar-array-empty=""
scalar-array-defaults="elem1,elem2" scalar-array-defaults="elem1,elem2"
scalar-required="" scalar-required=""
node-with-a-looong-name=""
enum-with-default="this" enum-with-default="this"
enum="" enum=""
> >

View File

@ -22,8 +22,8 @@ class YamlReferenceDumperTest extends \PHPUnit_Framework_TestCase
$dumper = new YamlReferenceDumper(); $dumper = new YamlReferenceDumper();
$this->assertContains($this->getConfigurationAsString(), $dumper->dump($configuration));
$this->markTestIncomplete('The Yaml Dumper currently does not support prototyped arrays'); $this->markTestIncomplete('The Yaml Dumper currently does not support prototyped arrays');
$this->assertEquals($this->getConfigurationAsString(), $dumper->dump($configuration));
} }
private function getConfigurationAsString() private function getConfigurationAsString()
@ -32,7 +32,7 @@ class YamlReferenceDumperTest extends \PHPUnit_Framework_TestCase
acme_root: acme_root:
boolean: true boolean: true
scalar_empty: ~ scalar_empty: ~
scalar_null: ~ scalar_null: null
scalar_true: true scalar_true: true
scalar_false: false scalar_false: false
scalar_default: default scalar_default: default
@ -43,6 +43,7 @@ acme_root:
- elem1 - elem1
- elem2 - elem2
scalar_required: ~ # Required scalar_required: ~ # Required
node_with_a_looong_name: ~
enum_with_default: this # One of "this"; "that" enum_with_default: this # One of "this"; "that"
enum: ~ # One of "this"; "that" enum: ~ # One of "this"; "that"
@ -59,10 +60,6 @@ acme_root:
# Prototype: Parameter name # Prototype: Parameter name
name: ~ name: ~
connections:
# Prototype
- { user: ~, pass: ~ }
EOL; EOL;
} }
} }

View File

@ -34,6 +34,7 @@ class ExampleConfiguration implements ConfigurationInterface
->scalarNode('scalar_array_empty')->defaultValue(array())->end() ->scalarNode('scalar_array_empty')->defaultValue(array())->end()
->scalarNode('scalar_array_defaults')->defaultValue(array('elem1', 'elem2'))->end() ->scalarNode('scalar_array_defaults')->defaultValue(array('elem1', 'elem2'))->end()
->scalarNode('scalar_required')->isRequired()->end() ->scalarNode('scalar_required')->isRequired()->end()
->scalarNode('node_with_a_looong_name')->end()
->enumNode('enum_with_default')->values(array('this', 'that'))->defaultValue('this')->end() ->enumNode('enum_with_default')->values(array('this', 'that'))->defaultValue('this')->end()
->enumNode('enum')->values(array('this', 'that'))->end() ->enumNode('enum')->values(array('this', 'that'))->end()
->arrayNode('array') ->arrayNode('array')