This commit is contained in:
Torsten 2018-08-07 10:42:11 +02:00
parent 98419bd18d
commit 8a69e45efa
4919 changed files with 28311 additions and 224136 deletions

34
pfosten/vendor/symfony/yaml/Tests/Command/LintCommandTest.php vendored Executable file → Normal file
View file

@ -12,10 +12,10 @@
namespace Symfony\Component\Yaml\Tests\Command;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Yaml\Command\LintCommand;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Tester\CommandTester;
use Symfony\Component\Yaml\Command\LintCommand;
/**
* Tests the YamlLintCommand.
@ -51,6 +51,33 @@ bar';
$this->assertContains('Unable to parse at line 3 (near "bar").', trim($tester->getDisplay()));
}
public function testConstantAsKey()
{
$yaml = <<<YAML
!php/const 'Symfony\Component\Yaml\Tests\Command\Foo::TEST': bar
YAML;
$ret = $this->createCommandTester()->execute(array('filename' => $this->createFile($yaml)), array('verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false));
$this->assertSame(0, $ret, 'lint:yaml exits with code 0 in case of success');
}
public function testCustomTags()
{
$yaml = <<<YAML
foo: !my_tag {foo: bar}
YAML;
$ret = $this->createCommandTester()->execute(array('filename' => $this->createFile($yaml), '--parse-tags' => true), array('verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false));
$this->assertSame(0, $ret, 'lint:yaml exits with code 0 in case of success');
}
public function testCustomTagsError()
{
$yaml = <<<YAML
foo: !my_tag {foo: bar}
YAML;
$ret = $this->createCommandTester()->execute(array('filename' => $this->createFile($yaml)), array('verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false));
$this->assertSame(1, $ret, 'lint:yaml exits with code 1 in case of error');
}
/**
* @expectedException \RuntimeException
*/
@ -105,3 +132,8 @@ bar';
rmdir(sys_get_temp_dir().'/framework-yml-lint-test');
}
}
class Foo
{
const TEST = 'foo';
}

27
pfosten/vendor/symfony/yaml/Tests/DumperTest.php vendored Executable file → Normal file
View file

@ -12,8 +12,8 @@
namespace Symfony\Component\Yaml\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Yaml\Parser;
use Symfony\Component\Yaml\Dumper;
use Symfony\Component\Yaml\Parser;
use Symfony\Component\Yaml\Yaml;
class DumperTest extends TestCase
@ -125,7 +125,7 @@ EOF;
// TODO
} else {
eval('$expected = '.trim($test['php']).';');
$this->assertSame($expected, $this->parser->parse($this->dumper->dump($expected, 10), Yaml::PARSE_KEYS_AS_STRINGS), $test['test']);
$this->assertSame($expected, $this->parser->parse($this->dumper->dump($expected, 10)), $test['test']);
}
}
}
@ -210,7 +210,7 @@ EOF;
{
$dump = $this->dumper->dump(array('foo' => new A(), 'bar' => 1), 0, 0, Yaml::DUMP_OBJECT);
$this->assertEquals('{ foo: !php/object:O:30:"Symfony\Component\Yaml\Tests\A":1:{s:1:"a";s:3:"foo";}, bar: 1 }', $dump, '->dump() is able to dump objects');
$this->assertEquals('{ foo: !php/object \'O:30:"Symfony\Component\Yaml\Tests\A":1:{s:1:"a";s:3:"foo";}\', bar: 1 }', $dump, '->dump() is able to dump objects');
}
/**
@ -220,7 +220,7 @@ EOF;
{
$dump = $this->dumper->dump(array('foo' => new A(), 'bar' => 1), 0, 0, false, true);
$this->assertEquals('{ foo: !php/object:O:30:"Symfony\Component\Yaml\Tests\A":1:{s:1:"a";s:3:"foo";}, bar: 1 }', $dump, '->dump() is able to dump objects');
$this->assertEquals('{ foo: !php/object \'O:30:"Symfony\Component\Yaml\Tests\A":1:{s:1:"a";s:3:"foo";}\', bar: 1 }', $dump, '->dump() is able to dump objects');
}
public function testObjectSupportDisabledButNoExceptions()
@ -443,7 +443,8 @@ YAML;
$data = array(
'data' => array(
'single_line' => 'foo bar baz',
'multi_line' => "foo\nline with trailing spaces:\n \nbar\r\ninteger like line:\n123456789\nempty line:\n\nbaz",
'multi_line' => "foo\nline with trailing spaces:\n \nbar\ninteger like line:\n123456789\nempty line:\n\nbaz",
'multi_line_with_carriage_return' => "foo\nbar\r\nbaz",
'nested_inlined_multi_line_string' => array(
'inlined_multi_line' => "foo\nbar\r\nempty line:\n\nbaz",
),
@ -453,6 +454,22 @@ YAML;
$this->assertSame(file_get_contents(__DIR__.'/Fixtures/multiple_lines_as_literal_block.yml'), $this->dumper->dump($data, 2, 0, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK));
}
public function testDumpMultiLineStringAsScalarBlockWhenFirstLineHasLeadingSpace()
{
$data = array(
'data' => array(
'multi_line' => " the first line has leading spaces\nThe second line does not.",
),
);
$this->assertSame(file_get_contents(__DIR__.'/Fixtures/multiple_lines_as_literal_block_leading_space_in_first_line.yml'), $this->dumper->dump($data, 2, 0, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK));
}
public function testCarriageReturnIsMaintainedWhenDumpingAsMultiLineLiteralBlock()
{
$this->assertSame("- \"a\\r\\nb\\nc\"\n", $this->dumper->dump(array("a\r\nb\nc"), 2, 0, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK));
}
/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage The indentation must be greater than zero

0
pfosten/vendor/symfony/yaml/Tests/Fixtures/YtsAnchorAlias.yml vendored Executable file → Normal file
View file

0
pfosten/vendor/symfony/yaml/Tests/Fixtures/YtsBasicTests.yml vendored Executable file → Normal file
View file

0
pfosten/vendor/symfony/yaml/Tests/Fixtures/YtsBlockMapping.yml vendored Executable file → Normal file
View file

0
pfosten/vendor/symfony/yaml/Tests/Fixtures/YtsDocumentSeparator.yml vendored Executable file → Normal file
View file

0
pfosten/vendor/symfony/yaml/Tests/Fixtures/YtsErrorTests.yml vendored Executable file → Normal file
View file

0
pfosten/vendor/symfony/yaml/Tests/Fixtures/YtsFlowCollections.yml vendored Executable file → Normal file
View file

0
pfosten/vendor/symfony/yaml/Tests/Fixtures/YtsFoldedScalars.yml vendored Executable file → Normal file
View file

0
pfosten/vendor/symfony/yaml/Tests/Fixtures/YtsNullsAndEmpties.yml vendored Executable file → Normal file
View file

View file

@ -592,7 +592,7 @@ test: Various explicit families
todo: true
spec: 2.23
yaml: |
not-date: !str 2002-04-28
not-date: !!str 2002-04-28
picture: !binary |
R0lGODlhDAAMAIQAAP//9/X
17unp5WZmZgAAAOfn515eXv
@ -928,10 +928,11 @@ documents: 2
---
test: Explicit typing
deprecated: Using the non-specific tag "!" is deprecated since Symfony 3.4 as its behavior will change in 4.0.
yaml: |
integer: 12
also int: ! "12"
string: !str 12
string: !!str 12
php: |
array( 'integer' => 12, 'also int' => 12, 'string' => '12' )
---
@ -963,7 +964,7 @@ documents: 2
test: Type family under yaml.org
yaml: |
# The URI is 'tag:yaml.org,2002:str'
- !str a Unicode string
- !!str a Unicode string
php: |
array( 'a Unicode string' )
---
@ -1350,7 +1351,7 @@ yaml: |
second: 12 ## This is an integer.
third: !str 12 ## This is a string.
third: !!str 12 ## This is a string.
span: this contains
six spaces
@ -1419,7 +1420,7 @@ yaml: |
# The following scalars
# are loaded to the
# string value '1' '2'.
- !str 12
- !!str 12
- '12'
- "12"
- "\

6
pfosten/vendor/symfony/yaml/Tests/Fixtures/YtsTypeTransfers.yml vendored Executable file → Normal file
View file

@ -52,10 +52,10 @@ php: |
test: Forcing Strings
brief: >
Any YAML type can be forced into a string using the
explicit !str method.
explicit !!str method.
yaml: |
date string: !str 2001-08-01
number string: !str 192
date string: !!str 2001-08-01
number string: !!str 192
php: |
array(
'date string' => '2001-08-01',

0
pfosten/vendor/symfony/yaml/Tests/Fixtures/arrow.gif vendored Executable file → Normal file
View file

Before

Width:  |  Height:  |  Size: 185 B

After

Width:  |  Height:  |  Size: 185 B

Before After
Before After

0
pfosten/vendor/symfony/yaml/Tests/Fixtures/booleanMappingKeys.yml vendored Executable file → Normal file
View file

0
pfosten/vendor/symfony/yaml/Tests/Fixtures/embededPhp.yml vendored Executable file → Normal file
View file

2
pfosten/vendor/symfony/yaml/Tests/Fixtures/escapedCharacters.yml vendored Executable file → Normal file
View file

@ -4,7 +4,7 @@ yaml: |
php: |
"\\0 \\ \\a \\b \\n"
---
test: null
test: 'null'
yaml: |
"\0"
php: |

0
pfosten/vendor/symfony/yaml/Tests/Fixtures/index.yml vendored Executable file → Normal file
View file

View file

0
pfosten/vendor/symfony/yaml/Tests/Fixtures/legacyNonStringKeys.yml vendored Executable file → Normal file
View file

0
pfosten/vendor/symfony/yaml/Tests/Fixtures/legacyNullMappingKey.yml vendored Executable file → Normal file
View file

View file

@ -10,4 +10,5 @@ data:
empty line:
baz
multi_line_with_carriage_return: "foo\nbar\r\nbaz"
nested_inlined_multi_line_string: { inlined_multi_line: "foo\nbar\r\nempty line:\n\nbaz" }

0
pfosten/vendor/symfony/yaml/Tests/Fixtures/nonStringKeys.yml vendored Executable file → Normal file
View file

0
pfosten/vendor/symfony/yaml/Tests/Fixtures/nullMappingKey.yml vendored Executable file → Normal file
View file

0
pfosten/vendor/symfony/yaml/Tests/Fixtures/numericMappingKeys.yml vendored Executable file → Normal file
View file

0
pfosten/vendor/symfony/yaml/Tests/Fixtures/sfComments.yml vendored Executable file → Normal file
View file

0
pfosten/vendor/symfony/yaml/Tests/Fixtures/sfCompact.yml vendored Executable file → Normal file
View file

8
pfosten/vendor/symfony/yaml/Tests/Fixtures/sfMergeKey.yml vendored Executable file → Normal file
View file

@ -21,6 +21,7 @@ yaml: |
c:
foo: bar
bar: foo
bar_inline: {a: before, d: other, <<: *foo, b: new, x: Oren, c: { foo: bar, bar: foo}}
foo2: &foo2
a: Ballmer
ding: &dong [ fi, fei, fo, fam]
@ -42,14 +43,19 @@ yaml: |
p: 12345
z:
<<: *nestedref
head_inline: &head_inline { <<: [ *foo , *dong , *foo2 ] }
recursive_inline: { <<: *head_inline, c: { <<: *foo2 } }
php: |
array(
'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_inline' => array('a' => 'before', 'd' => 'other', 'b' => 'new', 'c' => array('foo' => 'bar', 'bar' => 'foo'), 'e' => 'notnull', 'x' => 'Oren'),
'foo2' => array('a' => 'Ballmer'),
'ding' => array('fi', 'fei', 'fo', 'fam'),
'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'),
'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'),
)

0
pfosten/vendor/symfony/yaml/Tests/Fixtures/sfObjects.yml vendored Executable file → Normal file
View file

0
pfosten/vendor/symfony/yaml/Tests/Fixtures/sfQuotes.yml vendored Executable file → Normal file
View file

0
pfosten/vendor/symfony/yaml/Tests/Fixtures/sfTests.yml vendored Executable file → Normal file
View file

View file

108
pfosten/vendor/symfony/yaml/Tests/InlineTest.php vendored Executable file → Normal file
View file

@ -18,6 +18,11 @@ use Symfony\Component\Yaml\Yaml;
class InlineTest extends TestCase
{
protected function setUp()
{
Inline::initialize(0, 0);
}
/**
* @dataProvider getTestsForParse
*/
@ -49,10 +54,11 @@ class InlineTest extends TestCase
public function getTestsForParsePhpConstants()
{
return array(
array('!php/const:Symfony\Component\Yaml\Yaml::PARSE_CONSTANT', Yaml::PARSE_CONSTANT),
array('!php/const:PHP_INT_MAX', PHP_INT_MAX),
array('[!php/const:PHP_INT_MAX]', array(PHP_INT_MAX)),
array('{ foo: !php/const:PHP_INT_MAX }', array('foo' => PHP_INT_MAX)),
array('!php/const Symfony\Component\Yaml\Yaml::PARSE_CONSTANT', Yaml::PARSE_CONSTANT),
array('!php/const PHP_INT_MAX', PHP_INT_MAX),
array('[!php/const PHP_INT_MAX]', array(PHP_INT_MAX)),
array('{ foo: !php/const PHP_INT_MAX }', array('foo' => PHP_INT_MAX)),
array('!php/const NULL', null),
);
}
@ -62,16 +68,37 @@ class InlineTest extends TestCase
*/
public function testParsePhpConstantThrowsExceptionWhenUndefined()
{
Inline::parse('!php/const:WRONG_CONSTANT', Yaml::PARSE_CONSTANT);
Inline::parse('!php/const WRONG_CONSTANT', Yaml::PARSE_CONSTANT);
}
/**
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
* @expectedExceptionMessageRegExp #The string "!php/const:PHP_INT_MAX" could not be parsed as a constant.*#
* @expectedExceptionMessageRegExp #The string "!php/const PHP_INT_MAX" could not be parsed as a constant.*#
*/
public function testParsePhpConstantThrowsExceptionOnInvalidType()
{
Inline::parse('!php/const:PHP_INT_MAX', Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE);
Inline::parse('!php/const PHP_INT_MAX', Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE);
}
/**
* @group legacy
* @expectedDeprecation The !php/const: tag to indicate dumped PHP constants is deprecated since Symfony 3.4 and will be removed in 4.0. Use the !php/const (without the colon) tag instead on line 1.
* @dataProvider getTestsForParseLegacyPhpConstants
*/
public function testDeprecatedConstantTag($yaml, $expectedValue)
{
$this->assertSame($expectedValue, Inline::parse($yaml, Yaml::PARSE_CONSTANT));
}
public function getTestsForParseLegacyPhpConstants()
{
return array(
array('!php/const:Symfony\Component\Yaml\Yaml::PARSE_CONSTANT', Yaml::PARSE_CONSTANT),
array('!php/const:PHP_INT_MAX', PHP_INT_MAX),
array('[!php/const:PHP_INT_MAX]', array(PHP_INT_MAX)),
array('{ foo: !php/const:PHP_INT_MAX }', array('foo' => PHP_INT_MAX)),
array('!php/const:NULL', null),
);
}
/**
@ -168,7 +195,7 @@ class InlineTest extends TestCase
/**
* @group legacy
* @expectedDeprecation Using a colon after an unquoted mapping key that is not followed by an indication character (i.e. " ", ",", "[", "]", "{", "}") is deprecated since version 3.2 and will throw a ParseException in 4.0.
* @expectedDeprecation Using a colon after an unquoted mapping key that is not followed by an indication character (i.e. " ", ",", "[", "]", "{", "}") is deprecated since Symfony 3.2 and will throw a ParseException in 4.0 on line 1.
* throws \Symfony\Component\Yaml\Exception\ParseException in 4.0
*/
public function testParseMappingKeyWithColonNotFollowedBySpace()
@ -256,7 +283,7 @@ class InlineTest extends TestCase
/**
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
* @expectedExceptionMessage A reference must contain at least one character.
* @expectedExceptionMessage A reference must contain at least one character at line 1.
*/
public function testParseUnquotedAsterisk()
{
@ -265,7 +292,7 @@ class InlineTest extends TestCase
/**
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
* @expectedExceptionMessage A reference must contain at least one character.
* @expectedExceptionMessage A reference must contain at least one character at line 1.
*/
public function testParseUnquotedAsteriskFollowedByAComment()
{
@ -274,11 +301,16 @@ class InlineTest extends TestCase
/**
* @dataProvider getReservedIndicators
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
* @expectedExceptionMessage cannot start a plain scalar; you need to quote the scalar.
*/
public function testParseUnquotedScalarStartingWithReservedIndicator($indicator)
{
if (method_exists($this, 'expectExceptionMessage')) {
$this->expectException(ParseException::class);
$this->expectExceptionMessage(sprintf('cannot start a plain scalar; you need to quote the scalar at line 1 (near "%sfoo ").', $indicator));
} else {
$this->setExpectedException(ParseException::class, sprintf('cannot start a plain scalar; you need to quote the scalar at line 1 (near "%sfoo ").', $indicator));
}
Inline::parse(sprintf('{ foo: %sfoo }', $indicator));
}
@ -289,11 +321,16 @@ class InlineTest extends TestCase
/**
* @dataProvider getScalarIndicators
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
* @expectedExceptionMessage cannot start a plain scalar; you need to quote the scalar.
*/
public function testParseUnquotedScalarStartingWithScalarIndicator($indicator)
{
if (method_exists($this, 'expectExceptionMessage')) {
$this->expectException(ParseException::class);
$this->expectExceptionMessage(sprintf('cannot start a plain scalar; you need to quote the scalar at line 1 (near "%sfoo ").', $indicator));
} else {
$this->setExpectedException(ParseException::class, sprintf('cannot start a plain scalar; you need to quote the scalar at line 1 (near "%sfoo ").', $indicator));
}
Inline::parse(sprintf('{ foo: %sfoo }', $indicator));
}
@ -304,7 +341,7 @@ class InlineTest extends TestCase
/**
* @group legacy
* @expectedDeprecation Not quoting the scalar "%bar " starting with the "%" indicator character is deprecated since Symfony 3.1 and will throw a ParseException in 4.0.
* @expectedDeprecation Not quoting the scalar "%bar " starting with the "%" indicator character is deprecated since Symfony 3.1 and will throw a ParseException in 4.0 on line 1.
* throws \Symfony\Component\Yaml\Exception\ParseException in 4.0
*/
public function testParseUnquotedScalarStartingWithPercentCharacter()
@ -385,8 +422,8 @@ class InlineTest extends TestCase
array('[\'foo,bar\', \'foo bar\']', array('foo,bar', 'foo bar')),
// mappings
array('{foo: bar,bar: foo,false: false,null: null,integer: 12}', array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12), Yaml::PARSE_KEYS_AS_STRINGS),
array('{ foo : bar, bar : foo, false : false, null : null, integer : 12 }', array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12), Yaml::PARSE_KEYS_AS_STRINGS),
array('{foo: bar,bar: foo,"false": false, "null": null,integer: 12}', array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12)),
array('{ foo : bar, bar : foo, "false" : false, "null" : null, integer : 12 }', array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12)),
array('{foo: \'bar\', bar: \'foo: bar\'}', array('foo' => 'bar', 'bar' => 'foo: bar')),
array('{\'foo\': \'bar\', "bar": \'foo: bar\'}', array('foo' => 'bar', 'bar' => 'foo: bar')),
array('{\'foo\'\'\': \'bar\', "bar\"": \'foo: bar\'}', array('foo\'' => 'bar', 'bar"' => 'foo: bar')),
@ -456,8 +493,8 @@ class InlineTest extends TestCase
array('[\'foo,bar\', \'foo bar\']', array('foo,bar', 'foo bar')),
// mappings
array('{foo: bar,bar: foo,false: false,null: null,integer: 12}', (object) array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12), Yaml::PARSE_OBJECT_FOR_MAP | Yaml::PARSE_KEYS_AS_STRINGS),
array('{ foo : bar, bar : foo, false : false, null : null, integer : 12 }', (object) array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12), Yaml::PARSE_OBJECT_FOR_MAP | Yaml::PARSE_KEYS_AS_STRINGS),
array('{foo: bar,bar: foo,"false": false,"null": null,integer: 12}', (object) array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12), Yaml::PARSE_OBJECT_FOR_MAP),
array('{ foo : bar, bar : foo, "false" : false, "null" : null, integer : 12 }', (object) array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12), Yaml::PARSE_OBJECT_FOR_MAP),
array('{foo: \'bar\', bar: \'foo: bar\'}', (object) array('foo' => 'bar', 'bar' => 'foo: bar')),
array('{\'foo\': \'bar\', "bar": \'foo: bar\'}', (object) array('foo' => 'bar', 'bar' => 'foo: bar')),
array('{\'foo\'\'\': \'bar\', "bar\"": \'foo: bar\'}', (object) array('foo\'' => 'bar', 'bar"' => 'foo: bar')),
@ -538,7 +575,7 @@ class InlineTest extends TestCase
array('[\'foo,bar\', \'foo bar\']', array('foo,bar', 'foo bar')),
// mappings
array('{ foo: bar, bar: foo, \'false\': false, \'null\': null, integer: 12 }', array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12), Yaml::PARSE_KEYS_AS_STRINGS),
array('{ foo: bar, bar: foo, \'false\': false, \'null\': null, integer: 12 }', array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12)),
array('{ foo: bar, bar: \'foo: bar\' }', array('foo' => 'bar', 'bar' => 'foo: bar')),
// nested sequences and mappings
@ -554,7 +591,7 @@ class InlineTest extends TestCase
array('[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', array('foo', '@foo.baz', array('%foo%' => 'foo is %foo%', 'bar' => '%foo%'), true, '@service_container')),
array('{ foo: { bar: { 1: 2, baz: 3 } } }', array('foo' => array('bar' => array(1 => 2, 'baz' => 3))), Yaml::PARSE_KEYS_AS_STRINGS),
array('{ foo: { bar: { 1: 2, baz: 3 } } }', array('foo' => array('bar' => array(1 => 2, 'baz' => 3)))),
);
}
@ -681,7 +718,7 @@ class InlineTest extends TestCase
/**
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
* @expectedExceptionMessage Malformed inline YAML string: {this, is not, supported}.
* @expectedExceptionMessage Malformed inline YAML string: {this, is not, supported} at line 1.
*/
public function testNotSupportedMissingValue()
{
@ -700,7 +737,7 @@ class InlineTest extends TestCase
/**
* @group legacy
* @expectedDeprecation Omitting the key of a mapping is deprecated and will throw a ParseException in 4.0.
* @expectedDeprecation Omitting the key of a mapping is deprecated and will throw a ParseException in 4.0 on line 1.
*/
public function testOmittedMappingKeyIsParsedAsColon()
{
@ -730,7 +767,7 @@ class InlineTest extends TestCase
/**
* @group legacy
* @expectedDeprecation Implicit casting of incompatible mapping keys to strings is deprecated since version 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0. Pass the PARSE_KEYS_AS_STRING flag to explicitly enable the type casts.
* @expectedDeprecation Implicit casting of incompatible mapping keys to strings is deprecated since Symfony 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0. Quote your evaluable mapping keys instead on line 1.
* @dataProvider getNotPhpCompatibleMappingKeyData
*/
public function testImplicitStringCastingOfMappingKeysIsDeprecated($yaml, $expected)
@ -739,11 +776,14 @@ class InlineTest extends TestCase
}
/**
* @group legacy
* @expectedDeprecation Using the Yaml::PARSE_KEYS_AS_STRINGS flag is deprecated since Symfony 3.4 as it will be removed in 4.0. Quote your keys when they are evaluable instead.
* @expectedDeprecation Implicit casting of incompatible mapping keys to strings is deprecated since Symfony 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0. Quote your evaluable mapping keys instead on line 1.
* @dataProvider getNotPhpCompatibleMappingKeyData
*/
public function testExplicitStringCastingOfMappingKeys($yaml, $expected)
{
$this->assertSame($expected, Inline::parse($yaml, Yaml::PARSE_KEYS_AS_STRINGS));
$this->assertSame($expected, Yaml::parse($yaml, Yaml::PARSE_KEYS_AS_STRINGS));
}
public function getNotPhpCompatibleMappingKeyData()
@ -755,4 +795,22 @@ class InlineTest extends TestCase
'float' => array('{0.25: "foo"}', array('0.25' => 'foo')),
);
}
/**
* @group legacy
* @expectedDeprecation Support for the !str tag is deprecated since Symfony 3.4. Use the !!str tag instead on line 1.
*/
public function testDeprecatedStrTag()
{
$this->assertSame(array('foo' => 'bar'), Inline::parse('{ foo: !str bar }'));
}
/**
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
* @expectedExceptionMessage Unexpected end of line, expected one of ",}" at line 1 (near "{abc: 'def'").
*/
public function testUnfinishedInlineMap()
{
Inline::parse("{abc: 'def'");
}
}

0
pfosten/vendor/symfony/yaml/Tests/ParseExceptionTest.php vendored Executable file → Normal file
View file

487
pfosten/vendor/symfony/yaml/Tests/ParserTest.php vendored Executable file → Normal file
View file

@ -13,9 +13,9 @@ namespace Symfony\Component\Yaml\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Yaml\Exception\ParseException;
use Symfony\Component\Yaml\Yaml;
use Symfony\Component\Yaml\Parser;
use Symfony\Component\Yaml\Tag\TaggedValue;
use Symfony\Component\Yaml\Yaml;
class ParserTest extends TestCase
{
@ -30,6 +30,8 @@ class ParserTest extends TestCase
protected function tearDown()
{
$this->parser = null;
chmod(__DIR__.'/Fixtures/not_readable.yml', 0644);
}
/**
@ -45,10 +47,10 @@ class ParserTest extends TestCase
restore_error_handler();
if (class_exists('PHPUnit_Util_ErrorHandler')) {
return call_user_func_array('PHPUnit_Util_ErrorHandler::handleError', func_get_args());
return \call_user_func_array('PHPUnit_Util_ErrorHandler::handleError', \func_get_args());
}
return call_user_func_array('PHPUnit\Util\ErrorHandler::handleError', func_get_args());
return \call_user_func_array('PHPUnit\Util\ErrorHandler::handleError', \func_get_args());
}
$deprecations[] = $msg;
@ -61,7 +63,7 @@ class ParserTest extends TestCase
restore_error_handler();
$this->assertCount(1, $deprecations);
$this->assertContains('Using the comma as a group separator for floats is deprecated since version 3.2 and will be removed in 4.0.', $deprecations[0]);
$this->assertContains(true !== $deprecated ? $deprecated : 'Using the comma as a group separator for floats is deprecated since Symfony 3.2 and will be removed in 4.0 on line 1.', $deprecations[0]);
}
}
@ -71,6 +73,8 @@ class ParserTest extends TestCase
}
/**
* @group legacy
* @expectedDeprecationMessage Using the Yaml::PARSE_KEYS_AS_STRINGS flag is deprecated since Symfony 3.4 as it will be removed in 4.0. Quote your keys when they are evaluable
* @dataProvider getNonStringMappingKeysData
*/
public function testNonStringMappingKeys($expected, $yaml, $comment)
@ -469,7 +473,7 @@ EOF;
public function testObjectSupportEnabled()
{
$input = <<<'EOF'
foo: !php/object:O:30:"Symfony\Component\Yaml\Tests\B":1:{s:1:"b";s:3:"foo";}
foo: !php/object O:30:"Symfony\Component\Yaml\Tests\B":1:{s:1:"b";s:3:"foo";}
bar: 1
EOF;
$this->assertEquals(array('foo' => new B(), 'bar' => 1), $this->parser->parse($input, Yaml::PARSE_OBJECT), '->parse() is able to parse objects');
@ -489,14 +493,29 @@ EOF;
/**
* @group legacy
* @dataProvider deprecatedObjectValueProvider
*/
public function testObjectSupportEnabledWithDeprecatedTag()
public function testObjectSupportEnabledWithDeprecatedTag($yaml)
{
$input = <<<'EOF'
$this->assertEquals(array('foo' => new B(), 'bar' => 1), $this->parser->parse($yaml, Yaml::PARSE_OBJECT), '->parse() is able to parse objects');
}
public function deprecatedObjectValueProvider()
{
return array(
array(
<<<YAML
foo: !!php/object:O:30:"Symfony\Component\Yaml\Tests\B":1:{s:1:"b";s:3:"foo";}
bar: 1
EOF;
$this->assertEquals(array('foo' => new B(), 'bar' => 1), $this->parser->parse($input, Yaml::PARSE_OBJECT), '->parse() is able to parse objects');
YAML
),
array(
<<<YAML
foo: !php/object:O:30:"Symfony\Component\Yaml\Tests\B":1:{s:1:"b";s:3:"foo";}
bar: 1
YAML
),
);
}
/**
@ -510,14 +529,10 @@ EOF;
/**
* @dataProvider getObjectForMapTests
*/
public function testObjectForMap($yaml, $expected, $explicitlyParseKeysAsStrings = false)
public function testObjectForMap($yaml, $expected)
{
$flags = Yaml::PARSE_OBJECT_FOR_MAP;
if ($explicitlyParseKeysAsStrings) {
$flags |= Yaml::PARSE_KEYS_AS_STRINGS;
}
$this->assertEquals($expected, $this->parser->parse($yaml, $flags));
}
@ -577,18 +592,18 @@ YAML;
$expected->map = new \stdClass();
$expected->map->{1} = 'one';
$expected->map->{2} = 'two';
$tests['numeric-keys'] = array($yaml, $expected, true);
$tests['numeric-keys'] = array($yaml, $expected);
$yaml = <<<'YAML'
map:
0: one
1: two
'0': one
'1': two
YAML;
$expected = new \stdClass();
$expected->map = new \stdClass();
$expected->map->{0} = 'one';
$expected->map->{1} = 'two';
$tests['zero-indexed-numeric-keys'] = array($yaml, $expected, true);
$tests['zero-indexed-numeric-keys'] = array($yaml, $expected);
return $tests;
}
@ -776,6 +791,88 @@ EOT;
$this->assertSame($expected, $this->parser->parse($yaml));
}
public function testNonStringFollowedByCommentEmbeddedInMapping()
{
$yaml = <<<'EOT'
a:
b:
{}
# comment
d:
1.1
# another comment
EOT;
$expected = array(
'a' => array(
'b' => array(),
'd' => 1.1,
),
);
$this->assertSame($expected, $this->parser->parse($yaml));
}
public function getParseExceptionNotAffectedMultiLineStringLastResortParsing()
{
$tests = array();
$yaml = <<<'EOT'
a
b:
EOT;
$tests['parse error on first line'] = array($yaml);
$yaml = <<<'EOT'
a
b
c:
EOT;
$tests['parse error due to inconsistent indentation'] = array($yaml);
$yaml = <<<'EOT'
& * ! | > ' " % @ ` #, { asd a;sdasd }-@^qw3
EOT;
$tests['symfony/symfony/issues/22967#issuecomment-322067742'] = array($yaml);
return $tests;
}
/**
* @dataProvider getParseExceptionNotAffectedMultiLineStringLastResortParsing
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
*/
public function testParseExceptionNotAffectedByMultiLineStringLastResortParsing($yaml)
{
$this->parser->parse($yaml);
}
public function testMultiLineStringLastResortParsing()
{
$yaml = <<<'EOT'
test:
You can have things that don't look like strings here
true
yes you can
EOT;
$expected = array(
'test' => 'You can have things that don\'t look like strings here true yes you can',
);
$this->assertSame($expected, $this->parser->parse($yaml));
$yaml = <<<'EOT'
a:
b
c
EOT;
$expected = array(
'a' => 'b c',
);
$this->assertSame($expected, $this->parser->parse($yaml));
}
/**
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
*/
@ -853,7 +950,7 @@ EOD;
/**
* @group legacy
* @dataProvider getParseExceptionOnDuplicateData
* @expectedDeprecation Duplicate key "%s" detected on line %d whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated %s.
* @expectedDeprecation Duplicate key "%s" detected whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated %s and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0 on line %d.
* throws \Symfony\Component\Yaml\Exception\ParseException in 4.0
*/
public function testParseExceptionOnDuplicate($input, $duplicateKey, $lineNumber)
@ -1081,7 +1178,7 @@ EOF;
/**
* @group legacy
* @expectedDeprecation Implicit casting of numeric key to string on line 1 is deprecated since version 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0. Pass the PARSE_KEYS_AS_STRING flag to explicitly enable the type casts.
* @expectedDeprecation Implicit casting of numeric key to string is deprecated since Symfony 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0. Quote your evaluable mapping keys instead on line 2.
*/
public function testFloatKeys()
{
@ -1103,7 +1200,7 @@ EOF;
/**
* @group legacy
* @expectedDeprecation Implicit casting of incompatible key type to string on line 1 is deprecated since version 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0. Pass the PARSE_KEYS_AS_STRING flag to explicitly enable the type casts.
* @expectedDeprecation Implicit casting of non-string key to string is deprecated since Symfony 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0. Quote your evaluable mapping keys instead on line 1.
*/
public function testBooleanKeys()
{
@ -1120,37 +1217,29 @@ EOF;
$this->assertEquals($expected, $this->parser->parse($yaml));
}
public function testExplicitStringCastingOfFloatKeys()
public function testExplicitStringCasting()
{
$yaml = <<<'EOF'
foo:
1.2: "bar"
1.3: "baz"
EOF;
$expected = array(
'foo' => array(
'1.2' => 'bar',
'1.3' => 'baz',
),
);
$this->assertEquals($expected, $this->parser->parse($yaml, Yaml::PARSE_KEYS_AS_STRINGS));
}
public function testExplicitStringCastingOfBooleanKeys()
{
$yaml = <<<'EOF'
true: foo
false: bar
'1.2': "bar"
!!str 1.3: "baz"
'true': foo
!!str false: bar
!!str null: 'null'
'~': 'null'
EOF;
$expected = array(
'1.2' => 'bar',
'1.3' => 'baz',
'true' => 'foo',
'false' => 'bar',
'null' => 'null',
'~' => 'null',
);
$this->assertEquals($expected, $this->parser->parse($yaml, Yaml::PARSE_KEYS_AS_STRINGS));
$this->assertEquals($expected, $this->parser->parse($yaml));
}
/**
@ -1543,6 +1632,49 @@ EOT;
$this->assertSame(array('foo' => 'bar baz foobar foo', 'bar' => 'baz'), $this->parser->parse($yaml));
}
public function testMultiLineQuotedStringWithTrailingBackslash()
{
$yaml = <<<YAML
foobar:
"foo\
bar"
YAML;
$this->assertSame(array('foobar' => 'foobar'), $this->parser->parse($yaml));
}
public function testCommentCharactersInMultiLineQuotedStrings()
{
$yaml = <<<YAML
foo:
foobar: 'foo
#bar'
bar: baz
YAML;
$expected = array(
'foo' => array(
'foobar' => 'foo #bar',
'bar' => 'baz',
),
);
$this->assertSame($expected, $this->parser->parse($yaml));
}
public function testBlankLinesInQuotedMultiLineString()
{
$yaml = <<<YAML
foobar: 'foo
bar'
YAML;
$expected = array(
'foobar' => "foo\nbar",
);
$this->assertSame($expected, $this->parser->parse($yaml));
}
public function testParseMultiLineUnquotedString()
{
$yaml = <<<EOT
@ -1682,7 +1814,7 @@ YAML
/**
* @group legacy
* @expectedDeprecation Using the unquoted scalar value "!iterator foo" is deprecated since version 3.3 and will be considered as a tagged value in 4.0. You must quote it.
* @expectedDeprecation Using the unquoted scalar value "!iterator foo" is deprecated since Symfony 3.3 and will be considered as a tagged value in 4.0. You must quote it on line 1.
*/
public function testUnsupportedTagWithScalar()
{
@ -1691,7 +1823,7 @@ YAML
/**
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
* @expectedExceptionMessage The built-in tag "!!foo" is not implemented.
* @expectedExceptionMessage The built-in tag "!!foo" is not implemented at line 1 (near "!!foo").
*/
public function testExceptionWhenUsingUnsuportedBuiltInTags()
{
@ -1700,7 +1832,7 @@ YAML
/**
* @group legacy
* @expectedDeprecation Starting an unquoted string with a question mark followed by a space is deprecated since version 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.
* @expectedDeprecation Starting an unquoted string with a question mark followed by a space is deprecated since Symfony 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0 on line 1.
*/
public function testComplexMappingThrowsParseException()
{
@ -1715,7 +1847,7 @@ YAML;
/**
* @group legacy
* @expectedDeprecation Starting an unquoted string with a question mark followed by a space is deprecated since version 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.
* @expectedDeprecation Starting an unquoted string with a question mark followed by a space is deprecated since Symfony 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0 on line 2.
*/
public function testComplexMappingNestedInMappingThrowsParseException()
{
@ -1731,7 +1863,7 @@ YAML;
/**
* @group legacy
* @expectedDeprecation Starting an unquoted string with a question mark followed by a space is deprecated since version 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.
* @expectedDeprecation Starting an unquoted string with a question mark followed by a space is deprecated since Symfony 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0 on line 1.
*/
public function testComplexMappingNestedInSequenceThrowsParseException()
{
@ -1764,7 +1896,7 @@ INI;
$parser = new Parser();
$tests = array();
$files = $parser->parse(file_get_contents(__DIR__.'/Fixtures/'.$testsFile));
$files = $parser->parseFile(__DIR__.'/Fixtures/'.$testsFile);
foreach ($files as $file) {
$yamls = file_get_contents(__DIR__.'/Fixtures/'.$file.'.yml');
@ -1824,10 +1956,10 @@ YAML;
{
$yaml = <<<YAML
transitions:
!php/const:Symfony\Component\Yaml\Tests\B::FOO:
!php/const 'Symfony\Component\Yaml\Tests\B::FOO':
from:
- !php/const:Symfony\Component\Yaml\Tests\B::BAR
to: !php/const:Symfony\Component\Yaml\Tests\B::BAZ
- !php/const 'Symfony\Component\Yaml\Tests\B::BAR'
to: !php/const 'Symfony\Component\Yaml\Tests\B::BAZ'
YAML;
$expected = array(
'transitions' => array(
@ -1843,7 +1975,13 @@ YAML;
$this->assertSame($expected, $this->parser->parse($yaml, Yaml::PARSE_CONSTANT));
}
public function testPhpConstantTagMappingKeyWithKeysCastToStrings()
/**
* @group legacy
* @expectedDeprecation The !php/const: tag to indicate dumped PHP constants is deprecated since Symfony 3.4 and will be removed in 4.0. Use the !php/const (without the colon) tag instead on line 2.
* @expectedDeprecation The !php/const: tag to indicate dumped PHP constants is deprecated since Symfony 3.4 and will be removed in 4.0. Use the !php/const (without the colon) tag instead on line 4.
* @expectedDeprecation The !php/const: tag to indicate dumped PHP constants is deprecated since Symfony 3.4 and will be removed in 4.0. Use the !php/const (without the colon) tag instead on line 5.
*/
public function testDeprecatedPhpConstantTagMappingKey()
{
$yaml = <<<YAML
transitions:
@ -1863,8 +2001,251 @@ YAML;
),
);
$this->assertSame($expected, $this->parser->parse($yaml, Yaml::PARSE_CONSTANT));
}
/**
* @group legacy
* @expectedDeprecation Using the Yaml::PARSE_KEYS_AS_STRINGS flag is deprecated since Symfony 3.4 as it will be removed in 4.0. Quote your keys when they are evaluable instead.
*/
public function testPhpConstantTagMappingKeyWithKeysCastToStrings()
{
$yaml = <<<YAML
transitions:
!php/const 'Symfony\Component\Yaml\Tests\B::FOO':
from:
- !php/const 'Symfony\Component\Yaml\Tests\B::BAR'
to: !php/const 'Symfony\Component\Yaml\Tests\B::BAZ'
YAML;
$expected = array(
'transitions' => array(
'foo' => array(
'from' => array(
'bar',
),
'to' => 'baz',
),
),
);
$this->assertSame($expected, $this->parser->parse($yaml, Yaml::PARSE_CONSTANT | Yaml::PARSE_KEYS_AS_STRINGS));
}
public function testMergeKeysWhenMappingsAreParsedAsObjects()
{
$yaml = <<<YAML
foo: &FOO
bar: 1
bar: &BAR
baz: 2
<<: *FOO
baz:
baz_foo: 3
<<:
baz_bar: 4
foobar:
bar: ~
<<: [*FOO, *BAR]
YAML;
$expected = (object) array(
'foo' => (object) array(
'bar' => 1,
),
'bar' => (object) array(
'baz' => 2,
'bar' => 1,
),
'baz' => (object) array(
'baz_foo' => 3,
'baz_bar' => 4,
),
'foobar' => (object) array(
'bar' => null,
'baz' => 2,
),
);
$this->assertEquals($expected, $this->parser->parse($yaml, Yaml::PARSE_OBJECT_FOR_MAP));
}
public function testFilenamesAreParsedAsStringsWithoutFlag()
{
$file = __DIR__.'/Fixtures/index.yml';
$this->assertSame($file, $this->parser->parse($file));
}
public function testParseFile()
{
$this->assertInternalType('array', $this->parser->parseFile(__DIR__.'/Fixtures/index.yml'));
}
/**
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
* @expectedExceptionMessageRegExp #^File ".+/Fixtures/nonexistent.yml" does not exist\.$#
*/
public function testParsingNonExistentFilesThrowsException()
{
$this->parser->parseFile(__DIR__.'/Fixtures/nonexistent.yml');
}
/**
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
* @expectedExceptionMessageRegExp #^File ".+/Fixtures/not_readable.yml" cannot be read\.$#
*/
public function testParsingNotReadableFilesThrowsException()
{
if ('\\' === \DIRECTORY_SEPARATOR) {
$this->markTestSkipped('chmod is not supported on Windows');
}
$file = __DIR__.'/Fixtures/not_readable.yml';
chmod($file, 0200);
$this->parser->parseFile($file);
}
public function testParseReferencesOnMergeKeys()
{
$yaml = <<<YAML
mergekeyrefdef:
a: foo
<<: &quux
b: bar
c: baz
mergekeyderef:
d: quux
<<: *quux
YAML;
$expected = array(
'mergekeyrefdef' => array(
'a' => 'foo',
'b' => 'bar',
'c' => 'baz',
),
'mergekeyderef' => array(
'd' => 'quux',
'b' => 'bar',
'c' => 'baz',
),
);
$this->assertSame($expected, $this->parser->parse($yaml));
}
public function testParseReferencesOnMergeKeysWithMappingsParsedAsObjects()
{
$yaml = <<<YAML
mergekeyrefdef:
a: foo
<<: &quux
b: bar
c: baz
mergekeyderef:
d: quux
<<: *quux
YAML;
$expected = (object) array(
'mergekeyrefdef' => (object) array(
'a' => 'foo',
'b' => 'bar',
'c' => 'baz',
),
'mergekeyderef' => (object) array(
'd' => 'quux',
'b' => 'bar',
'c' => 'baz',
),
);
$this->assertEquals($expected, $this->parser->parse($yaml, Yaml::PARSE_OBJECT_FOR_MAP));
}
/**
* @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);
}
/**
* @dataProvider indentedMappingData
*/
public function testParseIndentedMappings($yaml, $expected)
{
$this->assertSame($expected, $this->parser->parse($yaml));
}
public function indentedMappingData()
{
$tests = array();
$yaml = <<<YAML
foo:
- bar: "foobar"
# A comment
baz: "foobaz"
YAML;
$expected = array(
'foo' => array(
array(
'bar' => 'foobar',
'baz' => 'foobaz',
),
),
);
$tests['comment line is first line in indented block'] = array($yaml, $expected);
$yaml = <<<YAML
foo:
- bar:
# comment
baz: [1, 2, 3]
YAML;
$expected = array(
'foo' => array(
array(
'bar' => array(
'baz' => array(1, 2, 3),
),
),
),
);
$tests['mapping value on new line starting with a comment line'] = array($yaml, $expected);
$yaml = <<<YAML
foo:
-
bar: foobar
YAML;
$expected = array(
'foo' => array(
array(
'bar' => 'foobar',
),
),
);
$tests['mapping in sequence starting on a new line'] = array($yaml, $expected);
$yaml = <<<YAML
foo:
bar: baz
YAML;
$expected = array(
'foo' => array(
'bar' => 'baz',
),
);
$tests['blank line at the beginning of an indented mapping value'] = array($yaml, $expected);
return $tests;
}
}
class B

0
pfosten/vendor/symfony/yaml/Tests/YamlTest.php vendored Executable file → Normal file
View file