Merge branch '2.7' into 2.8
* 2.7: Test that it do not remove the new flashes when displaying the existing ones [HttpFoundation] AutExpireFlashBag should not clear new flashes [Form] Don't rely on if http-foundation isn't in FileType substitute aliases in inline mappings added ability for substitute aliases when mapping in YAML is on single line [Console] Fix global console flag when used in chain
This commit is contained in:
commit
1941a78922
@ -284,6 +284,14 @@ class ArgvInput extends Input
|
|||||||
if ($token === $value || 0 === strpos($token, $value.'=')) {
|
if ($token === $value || 0 === strpos($token, $value.'=')) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (0 === strpos($token, '-') && 0 !== strpos($token, '--')) {
|
||||||
|
$searchableToken = str_replace('-', '', $token);
|
||||||
|
$searchableValue = str_replace('-', '', $value);
|
||||||
|
if ('' !== $searchableToken && '' !== $searchableValue && false !== strpos($searchableToken, $searchableValue)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,6 +296,9 @@ class ArgvInputTest extends TestCase
|
|||||||
$input = new ArgvInput(array('cli.php', '-f', 'foo'));
|
$input = new ArgvInput(array('cli.php', '-f', 'foo'));
|
||||||
$this->assertTrue($input->hasParameterOption('-f'), '->hasParameterOption() returns true if the given short option is in the raw input');
|
$this->assertTrue($input->hasParameterOption('-f'), '->hasParameterOption() returns true if the given short option is in the raw input');
|
||||||
|
|
||||||
|
$input = new ArgvInput(array('cli.php', '-fh'));
|
||||||
|
$this->assertTrue($input->hasParameterOption('-fh'), '->hasParameterOption() returns true if the given short option is in the raw input');
|
||||||
|
|
||||||
$input = new ArgvInput(array('cli.php', '--foo', 'foo'));
|
$input = new ArgvInput(array('cli.php', '--foo', 'foo'));
|
||||||
$this->assertTrue($input->hasParameterOption('--foo'), '->hasParameterOption() returns true if the given short option is in the raw input');
|
$this->assertTrue($input->hasParameterOption('--foo'), '->hasParameterOption() returns true if the given short option is in the raw input');
|
||||||
|
|
||||||
|
@ -92,9 +92,12 @@ class FileType extends AbstractType
|
|||||||
*/
|
*/
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
{
|
{
|
||||||
$dataClass = function (Options $options) {
|
$dataClass = null;
|
||||||
return $options['multiple'] ? null : 'Symfony\Component\HttpFoundation\File\File';
|
if (class_exists('Symfony\Component\HttpFoundation\File\File')) {
|
||||||
};
|
$dataClass = function (Options $options) {
|
||||||
|
return $options['multiple'] ? null : 'Symfony\Component\HttpFoundation\File\File';
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
$emptyData = function (Options $options) {
|
$emptyData = function (Options $options) {
|
||||||
return $options['multiple'] ? array() : null;
|
return $options['multiple'] ? array() : null;
|
||||||
|
@ -106,7 +106,7 @@ class AutoExpireFlashBag implements FlashBagInterface
|
|||||||
public function all()
|
public function all()
|
||||||
{
|
{
|
||||||
$return = $this->flashes['display'];
|
$return = $this->flashes['display'];
|
||||||
$this->flashes = array('new' => array(), 'display' => array());
|
$this->flashes['display'] = array();
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
@ -150,4 +150,12 @@ class AutoExpireFlashBagTest extends TestCase
|
|||||||
{
|
{
|
||||||
$this->assertEquals(array('notice' => array('A previous flash message')), $this->bag->clear());
|
$this->assertEquals(array('notice' => array('A previous flash message')), $this->bag->clear());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testDoNotRemoveTheNewFlashesWhenDisplayingTheExistingOnes()
|
||||||
|
{
|
||||||
|
$this->bag->add('success', 'Something');
|
||||||
|
$this->bag->all();
|
||||||
|
|
||||||
|
$this->assertEquals(array('new' => array('success' => array('Something')), 'display' => array()), $this->array);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -375,6 +375,7 @@ class Inline
|
|||||||
$output = array();
|
$output = array();
|
||||||
$len = strlen($mapping);
|
$len = strlen($mapping);
|
||||||
++$i;
|
++$i;
|
||||||
|
$allowOverwrite = false;
|
||||||
|
|
||||||
// {foo: bar, bar:foo, ...}
|
// {foo: bar, bar:foo, ...}
|
||||||
while ($i < $len) {
|
while ($i < $len) {
|
||||||
@ -394,6 +395,10 @@ class Inline
|
|||||||
// key
|
// key
|
||||||
$key = self::parseScalar($mapping, array(':', ' '), array('"', "'"), $i, false);
|
$key = self::parseScalar($mapping, array(':', ' '), array('"', "'"), $i, false);
|
||||||
|
|
||||||
|
if ('<<' === $key) {
|
||||||
|
$allowOverwrite = true;
|
||||||
|
}
|
||||||
|
|
||||||
// value
|
// value
|
||||||
$done = false;
|
$done = false;
|
||||||
|
|
||||||
@ -405,7 +410,12 @@ class Inline
|
|||||||
// Spec: Keys MUST be unique; first one wins.
|
// Spec: Keys MUST be unique; first one wins.
|
||||||
// Parser cannot abort this mapping earlier, since lines
|
// Parser cannot abort this mapping earlier, since lines
|
||||||
// are processed sequentially.
|
// are processed sequentially.
|
||||||
if (!isset($output[$key])) {
|
// But overwriting is allowed when a merge node is used in current block.
|
||||||
|
if ('<<' === $key) {
|
||||||
|
foreach ($value as $parsedValue) {
|
||||||
|
$output += $parsedValue;
|
||||||
|
}
|
||||||
|
} elseif ($allowOverwrite || !isset($output[$key])) {
|
||||||
$output[$key] = $value;
|
$output[$key] = $value;
|
||||||
}
|
}
|
||||||
$done = true;
|
$done = true;
|
||||||
@ -416,7 +426,10 @@ class Inline
|
|||||||
// Spec: Keys MUST be unique; first one wins.
|
// Spec: Keys MUST be unique; first one wins.
|
||||||
// Parser cannot abort this mapping earlier, since lines
|
// Parser cannot abort this mapping earlier, since lines
|
||||||
// are processed sequentially.
|
// are processed sequentially.
|
||||||
if (!isset($output[$key])) {
|
// But overwriting is allowed when a merge node is used in current block.
|
||||||
|
if ('<<' === $key) {
|
||||||
|
$output += $value;
|
||||||
|
} elseif ($allowOverwrite || !isset($output[$key])) {
|
||||||
$output[$key] = $value;
|
$output[$key] = $value;
|
||||||
}
|
}
|
||||||
$done = true;
|
$done = true;
|
||||||
@ -429,7 +442,10 @@ class Inline
|
|||||||
// Spec: Keys MUST be unique; first one wins.
|
// Spec: Keys MUST be unique; first one wins.
|
||||||
// Parser cannot abort this mapping earlier, since lines
|
// Parser cannot abort this mapping earlier, since lines
|
||||||
// are processed sequentially.
|
// are processed sequentially.
|
||||||
if (!isset($output[$key])) {
|
// But overwriting is allowed when a merge node is used in current block.
|
||||||
|
if ('<<' === $key) {
|
||||||
|
$output += $value;
|
||||||
|
} elseif ($allowOverwrite || !isset($output[$key])) {
|
||||||
$output[$key] = $value;
|
$output[$key] = $value;
|
||||||
}
|
}
|
||||||
$done = true;
|
$done = true;
|
||||||
|
@ -22,6 +22,7 @@ yaml: |
|
|||||||
foo: bar
|
foo: bar
|
||||||
foo: ignore
|
foo: ignore
|
||||||
bar: foo
|
bar: foo
|
||||||
|
bar_inline: {a: before, d: other, <<: *foo, b: new, x: Oren, c: { foo: bar, foo: ignore, bar: foo}}
|
||||||
duplicate:
|
duplicate:
|
||||||
foo: bar
|
foo: bar
|
||||||
foo: ignore
|
foo: ignore
|
||||||
@ -46,15 +47,20 @@ yaml: |
|
|||||||
p: 12345
|
p: 12345
|
||||||
z:
|
z:
|
||||||
<<: *nestedref
|
<<: *nestedref
|
||||||
|
head_inline: &head_inline { <<: [ *foo , *dong , *foo2 ] }
|
||||||
|
recursive_inline: { <<: *head_inline, c: { <<: *foo2 } }
|
||||||
php: |
|
php: |
|
||||||
array(
|
array(
|
||||||
'foo' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull'),
|
'foo' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull'),
|
||||||
'bar' => array('a' => 'before', 'd' => 'other', 'e' => null, 'b' => 'new', 'c' => array('foo' => 'bar', 'bar' => 'foo'), 'x' => 'Oren'),
|
'bar' => array('a' => 'before', 'd' => 'other', 'e' => null, 'b' => 'new', 'c' => array('foo' => 'bar', 'bar' => 'foo'), 'x' => 'Oren'),
|
||||||
|
'bar_inline' => array('a' => 'before', 'd' => 'other', 'b' => 'new', 'c' => array('foo' => 'bar', 'bar' => 'foo'), 'e' => 'notnull', 'x' => 'Oren'),
|
||||||
'duplicate' => array('foo' => 'bar'),
|
'duplicate' => array('foo' => 'bar'),
|
||||||
'foo2' => array('a' => 'Ballmer'),
|
'foo2' => array('a' => 'Ballmer'),
|
||||||
'ding' => array('fi', 'fei', 'fo', 'fam'),
|
'ding' => array('fi', 'fei', 'fo', 'fam'),
|
||||||
'check' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam', 'isit' => 'tested'),
|
'check' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam', 'isit' => 'tested'),
|
||||||
'head' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam'),
|
'head' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam'),
|
||||||
'taz' => array('a' => 'Steve', 'w' => array('p' => 1234)),
|
'taz' => array('a' => 'Steve', 'w' => array('p' => 1234)),
|
||||||
'nested' => array('a' => 'Steve', 'w' => array('p' => 12345), 'd' => 'Doug', 'z' => array('p' => 12345))
|
'nested' => array('a' => 'Steve', 'w' => array('p' => 12345), 'd' => 'Doug', 'z' => array('p' => 12345)),
|
||||||
|
'head_inline' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam'),
|
||||||
|
'recursive_inline' => array('a' => 'Steve', 'b' => 'Clark', 'c' => array('a' => 'Ballmer'), 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam'),
|
||||||
)
|
)
|
||||||
|
@ -1280,6 +1280,18 @@ YAML;
|
|||||||
|
|
||||||
$this->assertSame($expected, $this->parser->parse($yaml));
|
$this->assertSame($expected, $this->parser->parse($yaml));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
|
||||||
|
* @expectedExceptionMessage Reference "foo" does not exist
|
||||||
|
*/
|
||||||
|
public function testEvalRefException()
|
||||||
|
{
|
||||||
|
$yaml = <<<EOE
|
||||||
|
foo: { &foo { a: Steve, <<: *foo} }
|
||||||
|
EOE;
|
||||||
|
$this->parser->parse($yaml);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class B
|
class B
|
||||||
|
Reference in New Issue
Block a user