Laravel 5.6 updates
Travis config update Removed HHVM script as Laravel no longer support HHVM after releasing 5.3
This commit is contained in:
66
vendor/symfony/yaml/Tests/DumperTest.php
vendored
66
vendor/symfony/yaml/Tests/DumperTest.php
vendored
@@ -77,35 +77,6 @@ EOF;
|
||||
$this->assertEquals($expected, $dumper->dump($this->array, 4, 0));
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testSetIndentation()
|
||||
{
|
||||
$this->dumper->setIndentation(7);
|
||||
|
||||
$expected = <<<'EOF'
|
||||
'': bar
|
||||
foo: '#bar'
|
||||
'foo''bar': { }
|
||||
bar:
|
||||
- 1
|
||||
- foo
|
||||
foobar:
|
||||
foo: bar
|
||||
bar:
|
||||
- 1
|
||||
- foo
|
||||
foobar:
|
||||
foo: bar
|
||||
bar:
|
||||
- 1
|
||||
- foo
|
||||
|
||||
EOF;
|
||||
$this->assertEquals($expected, $this->dumper->dump($this->array, 4, 0));
|
||||
}
|
||||
|
||||
public function testSpecifications()
|
||||
{
|
||||
$files = $this->parser->parse(file_get_contents($this->path.'/index.yml'));
|
||||
@@ -213,16 +184,6 @@ EOF;
|
||||
$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');
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testObjectSupportEnabledPassingTrue()
|
||||
{
|
||||
$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');
|
||||
}
|
||||
|
||||
public function testObjectSupportDisabledButNoExceptions()
|
||||
{
|
||||
$dump = $this->dumper->dump(array('foo' => new A(), 'bar' => 1));
|
||||
@@ -238,33 +199,6 @@ EOF;
|
||||
$this->dumper->dump(array('foo' => new A(), 'bar' => 1), 0, 0, Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @expectedException \Symfony\Component\Yaml\Exception\DumpException
|
||||
*/
|
||||
public function testObjectSupportDisabledWithExceptionsPassingTrue()
|
||||
{
|
||||
$this->dumper->dump(array('foo' => new A(), 'bar' => 1), 0, 0, true);
|
||||
}
|
||||
|
||||
public function testEmptyArray()
|
||||
{
|
||||
$dump = $this->dumper->dump(array());
|
||||
$this->assertEquals('{ }', $dump);
|
||||
|
||||
$dump = $this->dumper->dump(array(), 0, 0, Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE);
|
||||
$this->assertEquals('[]', $dump);
|
||||
|
||||
$dump = $this->dumper->dump(array(), 9, 0, Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE);
|
||||
$this->assertEquals('[]', $dump);
|
||||
|
||||
$dump = $this->dumper->dump(new \ArrayObject(), 0, 0, Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE | Yaml::DUMP_OBJECT_AS_MAP);
|
||||
$this->assertEquals('{ }', $dump);
|
||||
|
||||
$dump = $this->dumper->dump(new \stdClass(), 0, 0, Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE | Yaml::DUMP_OBJECT_AS_MAP);
|
||||
$this->assertEquals('{ }', $dump);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getEscapeSequences
|
||||
*/
|
||||
|
@@ -518,16 +518,6 @@ php: |
|
||||
'hexadecimal' => 0xC
|
||||
)
|
||||
---
|
||||
test: Decimal Integer
|
||||
deprecated: true
|
||||
spec: 2.19
|
||||
yaml: |
|
||||
decimal: +12,345
|
||||
php: |
|
||||
array(
|
||||
'decimal' => 12345.0,
|
||||
)
|
||||
---
|
||||
# FIX: spec shows parens around -inf and NaN
|
||||
test: Floating point
|
||||
spec: 2.20
|
||||
@@ -546,16 +536,6 @@ php: |
|
||||
'float as whole number' => (float) 1
|
||||
)
|
||||
---
|
||||
test: Fixed Floating point
|
||||
deprecated: true
|
||||
spec: 2.20
|
||||
yaml: |
|
||||
fixed: 1,230.15
|
||||
php: |
|
||||
array(
|
||||
'fixed' => 1230.15,
|
||||
)
|
||||
---
|
||||
test: Timestamps
|
||||
todo: true
|
||||
spec: 2.22
|
||||
@@ -928,13 +908,12 @@ 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"
|
||||
no int: ! 12
|
||||
string: !!str 12
|
||||
php: |
|
||||
array( 'integer' => 12, 'also int' => 12, 'string' => '12' )
|
||||
array( 'integer' => 12, 'no int' => '12', 'string' => '12' )
|
||||
---
|
||||
test: Private types
|
||||
todo: true
|
||||
@@ -1531,24 +1510,6 @@ php: |
|
||||
'hexadecimal' => 12
|
||||
)
|
||||
---
|
||||
test: Decimal
|
||||
deprecated: true
|
||||
yaml: |
|
||||
decimal: +12,345
|
||||
php: |
|
||||
array(
|
||||
'decimal' => 12345.0,
|
||||
)
|
||||
---
|
||||
test: Fixed Float
|
||||
deprecated: true
|
||||
yaml: |
|
||||
fixed: 1,230.15
|
||||
php: |
|
||||
array(
|
||||
'fixed' => 1230.15,
|
||||
)
|
||||
---
|
||||
test: Float
|
||||
yaml: |
|
||||
canonical: 1.23015e+3
|
||||
|
@@ -182,34 +182,6 @@ php: |
|
||||
'simple' => 12,
|
||||
)
|
||||
---
|
||||
test: Positive Big Integer
|
||||
deprecated: true
|
||||
dump_skip: true
|
||||
brief: >
|
||||
An integer is a series of numbers, optionally
|
||||
starting with a positive or negative sign. Integers
|
||||
may also contain commas for readability.
|
||||
yaml: |
|
||||
one-thousand: 1,000
|
||||
php: |
|
||||
array(
|
||||
'one-thousand' => 1000.0,
|
||||
)
|
||||
---
|
||||
test: Negative Big Integer
|
||||
deprecated: true
|
||||
dump_skip: true
|
||||
brief: >
|
||||
An integer is a series of numbers, optionally
|
||||
starting with a positive or negative sign. Integers
|
||||
may also contain commas for readability.
|
||||
yaml: |
|
||||
negative one-thousand: -1,000
|
||||
php: |
|
||||
array(
|
||||
'negative one-thousand' => -1000.0
|
||||
)
|
||||
---
|
||||
test: Floats
|
||||
dump_skip: true
|
||||
brief: >
|
||||
@@ -225,20 +197,6 @@ php: |
|
||||
'scientific notation' => 1000.09
|
||||
)
|
||||
---
|
||||
test: Larger Float
|
||||
dump_skip: true
|
||||
deprecated: true
|
||||
brief: >
|
||||
Floats are represented by numbers with decimals,
|
||||
allowing for scientific notation, as well as
|
||||
positive and negative infinity and "not a number."
|
||||
yaml: |
|
||||
larger float: 1,000.09
|
||||
php: |
|
||||
array(
|
||||
'larger float' => 1000.09,
|
||||
)
|
||||
---
|
||||
test: Time
|
||||
todo: true
|
||||
brief: >
|
||||
|
@@ -1,23 +0,0 @@
|
||||
--- %YAML:1.0
|
||||
test: Miscellaneous
|
||||
spec: 2.21
|
||||
yaml: |
|
||||
true: true
|
||||
false: false
|
||||
php: |
|
||||
array(
|
||||
1 => true,
|
||||
0 => false,
|
||||
)
|
||||
---
|
||||
test: Boolean
|
||||
yaml: |
|
||||
false: used as key
|
||||
logical: true
|
||||
answer: false
|
||||
php: |
|
||||
array(
|
||||
false => 'used as key',
|
||||
'logical' => true,
|
||||
'answer' => false
|
||||
)
|
@@ -1,2 +0,0 @@
|
||||
- legacyBooleanMappingKeys
|
||||
- legacyNullMappingKey
|
@@ -1,9 +0,0 @@
|
||||
--- %YAML:1.0
|
||||
test: Miscellaneous
|
||||
spec: 2.21
|
||||
yaml: |
|
||||
null: ~
|
||||
php: |
|
||||
array(
|
||||
'' => null,
|
||||
)
|
158
vendor/symfony/yaml/Tests/InlineTest.php
vendored
158
vendor/symfony/yaml/Tests/InlineTest.php
vendored
@@ -14,6 +14,7 @@ namespace Symfony\Component\Yaml\Tests;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Yaml\Exception\ParseException;
|
||||
use Symfony\Component\Yaml\Inline;
|
||||
use Symfony\Component\Yaml\Tag\TaggedValue;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
||||
class InlineTest extends TestCase
|
||||
@@ -80,38 +81,6 @@ class InlineTest extends TestCase
|
||||
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),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @dataProvider getTestsForParseWithMapObjects
|
||||
*/
|
||||
public function testParseWithMapObjectsPassingTrue($yaml, $value)
|
||||
{
|
||||
$actual = Inline::parse($yaml, false, false, true);
|
||||
|
||||
$this->assertSame(serialize($value), serialize($actual));
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getTestsForDump
|
||||
*/
|
||||
@@ -194,13 +163,12 @@ 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 Symfony 3.2 and will throw a ParseException in 4.0 on line 1.
|
||||
* throws \Symfony\Component\Yaml\Exception\ParseException in 4.0
|
||||
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
|
||||
* @expectedExceptionMessage Colons must be followed by a space or an indication character (i.e. " ", ",", "[", "]", "{", "}")
|
||||
*/
|
||||
public function testParseMappingKeyWithColonNotFollowedBySpace()
|
||||
{
|
||||
Inline::parse('{1:""}');
|
||||
Inline::parse('{foo:""}');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -235,15 +203,6 @@ class InlineTest extends TestCase
|
||||
$this->assertSame($expected, Inline::parse($yaml, 0, array('var' => 'var-value')));
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @dataProvider getDataForParseReferences
|
||||
*/
|
||||
public function testParseReferencesAsFifthArgument($yaml, $expected)
|
||||
{
|
||||
$this->assertSame($expected, Inline::parse($yaml, false, false, false, array('var' => 'var-value')));
|
||||
}
|
||||
|
||||
public function getDataForParseReferences()
|
||||
{
|
||||
return array(
|
||||
@@ -268,19 +227,6 @@ class InlineTest extends TestCase
|
||||
$this->assertSame(array($foo), Inline::parse('[*foo]', 0, array('foo' => $foo)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testParseMapReferenceInSequenceAsFifthArgument()
|
||||
{
|
||||
$foo = array(
|
||||
'a' => 'Steve',
|
||||
'b' => 'Clark',
|
||||
'c' => 'Brian',
|
||||
);
|
||||
$this->assertSame(array($foo), Inline::parse('[*foo]', false, false, false, array('foo' => $foo)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
|
||||
* @expectedExceptionMessage A reference must contain at least one character at line 1.
|
||||
@@ -306,9 +252,9 @@ class InlineTest extends TestCase
|
||||
{
|
||||
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));
|
||||
$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));
|
||||
$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));
|
||||
@@ -326,9 +272,9 @@ class InlineTest extends TestCase
|
||||
{
|
||||
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));
|
||||
$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));
|
||||
$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));
|
||||
@@ -336,17 +282,7 @@ class InlineTest extends TestCase
|
||||
|
||||
public function getScalarIndicators()
|
||||
{
|
||||
return array(array('|'), array('>'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 on line 1.
|
||||
* throws \Symfony\Component\Yaml\Exception\ParseException in 4.0
|
||||
*/
|
||||
public function testParseUnquotedScalarStartingWithPercentCharacter()
|
||||
{
|
||||
Inline::parse('{ foo: %bar }');
|
||||
return array(array('|'), array('>'), array('%'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -611,12 +547,7 @@ class InlineTest extends TestCase
|
||||
$expected = new \DateTime($yaml);
|
||||
$expected->setTimeZone(new \DateTimeZone('UTC'));
|
||||
$expected->setDate($year, $month, $day);
|
||||
|
||||
if (\PHP_VERSION_ID >= 70100) {
|
||||
$expected->setTime($hour, $minute, $second, 1000000 * ($second - (int) $second));
|
||||
} else {
|
||||
$expected->setTime($hour, $minute, $second);
|
||||
}
|
||||
$expected->setTime($hour, $minute, $second, 1000000 * ($second - (int) $second));
|
||||
|
||||
$date = Inline::parse($yaml, Yaml::PARSE_DATETIME);
|
||||
$this->assertEquals($expected, $date);
|
||||
@@ -641,11 +572,7 @@ class InlineTest extends TestCase
|
||||
$expected = new \DateTime($yaml);
|
||||
$expected->setTimeZone(new \DateTimeZone('UTC'));
|
||||
$expected->setDate($year, $month, $day);
|
||||
if (\PHP_VERSION_ID >= 70100) {
|
||||
$expected->setTime($hour, $minute, $second, 1000000 * ($second - (int) $second));
|
||||
} else {
|
||||
$expected->setTime($hour, $minute, $second);
|
||||
}
|
||||
$expected->setTime($hour, $minute, $second, 1000000 * ($second - (int) $second));
|
||||
|
||||
$expectedNested = array('nested' => array($expected));
|
||||
$yamlNested = "{nested: [$yaml]}";
|
||||
@@ -736,12 +663,12 @@ class InlineTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @expectedDeprecation Omitting the key of a mapping is deprecated and will throw a ParseException in 4.0 on line 1.
|
||||
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
|
||||
* @expectedExceptionMessage Missing mapping key
|
||||
*/
|
||||
public function testOmittedMappingKeyIsParsedAsColon()
|
||||
public function testMappingKeysCannotBeOmitted()
|
||||
{
|
||||
$this->assertSame(array(':' => 'foo'), Inline::parse('{: foo}'));
|
||||
Inline::parse('{: foo}');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -766,8 +693,9 @@ class InlineTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @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.
|
||||
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
|
||||
* @expectedExceptionMessage Implicit casting of incompatible mapping keys to strings is not supported. Quote your evaluable mapping keys instead
|
||||
*
|
||||
* @dataProvider getNotPhpCompatibleMappingKeyData
|
||||
*/
|
||||
public function testImplicitStringCastingOfMappingKeysIsDeprecated($yaml, $expected)
|
||||
@@ -775,17 +703,6 @@ class InlineTest extends TestCase
|
||||
$this->assertSame($expected, Inline::parse($yaml));
|
||||
}
|
||||
|
||||
/**
|
||||
* @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, Yaml::parse($yaml, Yaml::PARSE_KEYS_AS_STRINGS));
|
||||
}
|
||||
|
||||
public function getNotPhpCompatibleMappingKeyData()
|
||||
{
|
||||
return array(
|
||||
@@ -796,13 +713,40 @@ class InlineTest extends TestCase
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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()
|
||||
public function testTagWithoutValueInSequence()
|
||||
{
|
||||
$this->assertSame(array('foo' => 'bar'), Inline::parse('{ foo: !str bar }'));
|
||||
$value = Inline::parse('[!foo]', Yaml::PARSE_CUSTOM_TAGS);
|
||||
|
||||
$this->assertInstanceOf(TaggedValue::class, $value[0]);
|
||||
$this->assertSame('foo', $value[0]->getTag());
|
||||
$this->assertSame('', $value[0]->getValue());
|
||||
}
|
||||
|
||||
public function testTagWithEmptyValueInSequence()
|
||||
{
|
||||
$value = Inline::parse('[!foo ""]', Yaml::PARSE_CUSTOM_TAGS);
|
||||
|
||||
$this->assertInstanceOf(TaggedValue::class, $value[0]);
|
||||
$this->assertSame('foo', $value[0]->getTag());
|
||||
$this->assertSame('', $value[0]->getValue());
|
||||
}
|
||||
|
||||
public function testTagWithoutValueInMapping()
|
||||
{
|
||||
$value = Inline::parse('{foo: !bar}', Yaml::PARSE_CUSTOM_TAGS);
|
||||
|
||||
$this->assertInstanceOf(TaggedValue::class, $value['foo']);
|
||||
$this->assertSame('bar', $value['foo']->getTag());
|
||||
$this->assertSame('', $value['foo']->getValue());
|
||||
}
|
||||
|
||||
public function testTagWithEmptyValueInMapping()
|
||||
{
|
||||
$value = Inline::parse('{foo: !bar ""}', Yaml::PARSE_CUSTOM_TAGS);
|
||||
|
||||
$this->assertInstanceOf(TaggedValue::class, $value['foo']);
|
||||
$this->assertSame('bar', $value['foo']->getTag());
|
||||
$this->assertSame('', $value['foo']->getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
|
280
vendor/symfony/yaml/Tests/ParserTest.php
vendored
280
vendor/symfony/yaml/Tests/ParserTest.php
vendored
@@ -37,34 +37,9 @@ class ParserTest extends TestCase
|
||||
/**
|
||||
* @dataProvider getDataFormSpecifications
|
||||
*/
|
||||
public function testSpecifications($expected, $yaml, $comment, $deprecated)
|
||||
public function testSpecifications($expected, $yaml, $comment)
|
||||
{
|
||||
$deprecations = array();
|
||||
|
||||
if ($deprecated) {
|
||||
set_error_handler(function ($type, $msg) use (&$deprecations) {
|
||||
if (E_USER_DEPRECATED !== $type) {
|
||||
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());
|
||||
}
|
||||
|
||||
$deprecations[] = $msg;
|
||||
});
|
||||
}
|
||||
|
||||
$this->assertEquals($expected, var_export($this->parser->parse($yaml), true), $comment);
|
||||
|
||||
if ($deprecated) {
|
||||
restore_error_handler();
|
||||
|
||||
$this->assertCount(1, $deprecations);
|
||||
$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]);
|
||||
}
|
||||
}
|
||||
|
||||
public function getDataFormSpecifications()
|
||||
@@ -72,35 +47,11 @@ class ParserTest extends TestCase
|
||||
return $this->loadTestsFromFixtureFiles('index.yml');
|
||||
}
|
||||
|
||||
/**
|
||||
* @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)
|
||||
{
|
||||
$this->assertSame($expected, var_export($this->parser->parse($yaml, Yaml::PARSE_KEYS_AS_STRINGS), true), $comment);
|
||||
}
|
||||
|
||||
public function getNonStringMappingKeysData()
|
||||
{
|
||||
return $this->loadTestsFromFixtureFiles('nonStringKeys.yml');
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @dataProvider getLegacyNonStringMappingKeysData
|
||||
*/
|
||||
public function testLegacyNonStringMappingKeys($expected, $yaml, $comment)
|
||||
{
|
||||
$this->assertSame($expected, var_export($this->parser->parse($yaml), true), $comment);
|
||||
}
|
||||
|
||||
public function getLegacyNonStringMappingKeysData()
|
||||
{
|
||||
return $this->loadTestsFromFixtureFiles('legacyNonStringKeys.yml');
|
||||
}
|
||||
|
||||
public function testTabsInYaml()
|
||||
{
|
||||
// test tabs in YAML
|
||||
@@ -479,50 +430,12 @@ EOF;
|
||||
$this->assertEquals(array('foo' => new B(), 'bar' => 1), $this->parser->parse($input, Yaml::PARSE_OBJECT), '->parse() is able to parse objects');
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testObjectSupportEnabledPassingTrue()
|
||||
public function testObjectSupportDisabledButNoExceptions()
|
||||
{
|
||||
$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\Tests\Component\Yaml\B":1:{s:1:"b";s:3:"foo";}
|
||||
bar: 1
|
||||
EOF;
|
||||
$this->assertEquals(array('foo' => new B(), 'bar' => 1), $this->parser->parse($input, false, true), '->parse() is able to parse objects');
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @dataProvider deprecatedObjectValueProvider
|
||||
*/
|
||||
public function testObjectSupportEnabledWithDeprecatedTag($yaml)
|
||||
{
|
||||
$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
|
||||
YAML
|
||||
),
|
||||
array(
|
||||
<<<YAML
|
||||
foo: !php/object:O:30:"Symfony\Component\Yaml\Tests\B":1:{s:1:"b";s:3:"foo";}
|
||||
bar: 1
|
||||
YAML
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider invalidDumpedObjectProvider
|
||||
*/
|
||||
public function testObjectSupportDisabledButNoExceptions($input)
|
||||
{
|
||||
$this->assertEquals(array('foo' => null, 'bar' => 1), $this->parser->parse($input), '->parse() does not parse objects');
|
||||
}
|
||||
|
||||
@@ -536,15 +449,6 @@ YAML
|
||||
$this->assertEquals($expected, $this->parser->parse($yaml, $flags));
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @dataProvider getObjectForMapTests
|
||||
*/
|
||||
public function testObjectForMapEnabledWithMappingUsingBooleanToggles($yaml, $expected)
|
||||
{
|
||||
$this->assertEquals($expected, $this->parser->parse($yaml, false, false, true));
|
||||
}
|
||||
|
||||
public function getObjectForMapTests()
|
||||
{
|
||||
$tests = array();
|
||||
@@ -609,11 +513,15 @@ YAML;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider invalidDumpedObjectProvider
|
||||
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
|
||||
*/
|
||||
public function testObjectsSupportDisabledWithExceptions($yaml)
|
||||
public function testObjectsSupportDisabledWithExceptions()
|
||||
{
|
||||
$yaml = <<<'EOF'
|
||||
foo: !php/object:O:30:"Symfony\Tests\Component\Yaml\B":1:{s:1:"b";s:3:"foo";}
|
||||
bar: 1
|
||||
EOF;
|
||||
|
||||
$this->parser->parse($yaml, Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE);
|
||||
}
|
||||
|
||||
@@ -628,33 +536,6 @@ YAML;
|
||||
$this->assertSame($expected, $this->parser->parse($yaml));
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @dataProvider invalidDumpedObjectProvider
|
||||
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
|
||||
*/
|
||||
public function testObjectsSupportDisabledWithExceptionsUsingBooleanToggles($yaml)
|
||||
{
|
||||
$this->parser->parse($yaml, true);
|
||||
}
|
||||
|
||||
public function invalidDumpedObjectProvider()
|
||||
{
|
||||
$yamlTag = <<<'EOF'
|
||||
foo: !!php/object:O:30:"Symfony\Tests\Component\Yaml\B":1:{s:1:"b";s:3:"foo";}
|
||||
bar: 1
|
||||
EOF;
|
||||
$localTag = <<<'EOF'
|
||||
foo: !php/object:O:30:"Symfony\Tests\Component\Yaml\B":1:{s:1:"b";s:3:"foo";}
|
||||
bar: 1
|
||||
EOF;
|
||||
|
||||
return array(
|
||||
'yaml-tag' => array($yamlTag),
|
||||
'local-tag' => array($localTag),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires extension iconv
|
||||
*/
|
||||
@@ -902,6 +783,9 @@ EOF
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
|
||||
* @expectedExceptionMessage Duplicate key "child" detected
|
||||
*
|
||||
* > It is an error for two equal keys to appear in the same mapping node.
|
||||
* > In such a case the YAML processor may continue, ignoring the second
|
||||
* > `key: value` pair and issuing an appropriate warning. This strategy
|
||||
@@ -910,7 +794,6 @@ EOF
|
||||
*
|
||||
* @see http://yaml.org/spec/1.2/spec.html#id2759572
|
||||
* @see http://yaml.org/spec/1.1/#id932806
|
||||
* @group legacy
|
||||
*/
|
||||
public function testMappingDuplicateKeyBlock()
|
||||
{
|
||||
@@ -931,7 +814,8 @@ EOD;
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
|
||||
* @expectedExceptionMessage Duplicate key "child" detected
|
||||
*/
|
||||
public function testMappingDuplicateKeyFlow()
|
||||
{
|
||||
@@ -948,13 +832,13 @@ EOD;
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
|
||||
* @dataProvider getParseExceptionOnDuplicateData
|
||||
* @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)
|
||||
{
|
||||
$this->expectExceptionMessage(sprintf('Duplicate key "%s" detected at line %d', $duplicateKey, $lineNumber));
|
||||
|
||||
Yaml::parse($input);
|
||||
}
|
||||
|
||||
@@ -1177,8 +1061,8 @@ EOF;
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @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.
|
||||
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
|
||||
* @expectedExceptionMessage Numeric keys are not supported. Quote your evaluable mapping keys instead
|
||||
*/
|
||||
public function testFloatKeys()
|
||||
{
|
||||
@@ -1188,19 +1072,12 @@ foo:
|
||||
1.3: "baz"
|
||||
EOF;
|
||||
|
||||
$expected = array(
|
||||
'foo' => array(
|
||||
'1.2' => 'bar',
|
||||
'1.3' => 'baz',
|
||||
),
|
||||
);
|
||||
|
||||
$this->assertEquals($expected, $this->parser->parse($yaml));
|
||||
$this->parser->parse($yaml);
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @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.
|
||||
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
|
||||
* @expectedExceptionMessage Non-string keys are not supported. Quote your evaluable mapping keys instead
|
||||
*/
|
||||
public function testBooleanKeys()
|
||||
{
|
||||
@@ -1209,12 +1086,7 @@ true: foo
|
||||
false: bar
|
||||
EOF;
|
||||
|
||||
$expected = array(
|
||||
1 => 'foo',
|
||||
0 => 'bar',
|
||||
);
|
||||
|
||||
$this->assertEquals($expected, $this->parser->parse($yaml));
|
||||
$this->parser->parse($yaml);
|
||||
}
|
||||
|
||||
public function testExplicitStringCasting()
|
||||
@@ -1776,6 +1648,18 @@ EOF;
|
||||
public function taggedValuesProvider()
|
||||
{
|
||||
return array(
|
||||
'scalars' => array(
|
||||
array(
|
||||
'foo' => new TaggedValue('inline', 'bar'),
|
||||
'quz' => new TaggedValue('long', 'this is a long text'),
|
||||
),
|
||||
<<<YAML
|
||||
foo: !inline bar
|
||||
quz: !long >
|
||||
this is a long
|
||||
text
|
||||
YAML
|
||||
),
|
||||
'sequences' => array(
|
||||
array(new TaggedValue('foo', array('yaml')), new TaggedValue('quz', array('bar'))),
|
||||
<<<YAML
|
||||
@@ -1800,9 +1684,18 @@ YAML
|
||||
- !quz {foo: bar, quz: !bar {one: bar}}
|
||||
YAML
|
||||
),
|
||||
'spaces-around-tag-value-in-sequence' => array(
|
||||
array(new TaggedValue('foo', 'bar')),
|
||||
'[ !foo bar ]',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
public function testNonSpecificTagSupport()
|
||||
{
|
||||
$this->assertSame('12', $this->parser->parse('! 12'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
|
||||
* @expectedExceptionMessage Tags support is not enabled. Enable the `Yaml::PARSE_CUSTOM_TAGS` flag to use "!iterator" at line 1 (near "!iterator [foo]").
|
||||
@@ -1813,12 +1706,21 @@ YAML
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @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.
|
||||
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
|
||||
* @expectedExceptionMessage Tags support is not enabled. Enable the `Yaml::PARSE_CUSTOM_TAGS` flag to use "!iterator" at line 1 (near "!iterator foo").
|
||||
*/
|
||||
public function testUnsupportedTagWithScalar()
|
||||
{
|
||||
$this->assertEquals('!iterator foo', $this->parser->parse('!iterator foo'));
|
||||
$this->parser->parse('!iterator foo');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
|
||||
* @expectedExceptionMessage The string "!!iterator foo" could not be parsed as it uses an unsupported built-in tag at line 1 (near "!!iterator foo").
|
||||
*/
|
||||
public function testUnsupportedBuiltInTagWithScalar()
|
||||
{
|
||||
$this->parser->parse('!!iterator foo');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1831,8 +1733,8 @@ YAML
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @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.
|
||||
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
|
||||
* @expectedExceptionMessage Complex mappings are not supported at line 1 (near "? "1"").
|
||||
*/
|
||||
public function testComplexMappingThrowsParseException()
|
||||
{
|
||||
@@ -1846,8 +1748,8 @@ YAML;
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @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.
|
||||
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
|
||||
* @expectedExceptionMessage Complex mappings are not supported at line 2 (near "? "1"").
|
||||
*/
|
||||
public function testComplexMappingNestedInMappingThrowsParseException()
|
||||
{
|
||||
@@ -1862,8 +1764,8 @@ YAML;
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @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.
|
||||
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
|
||||
* @expectedExceptionMessage Complex mappings are not supported at line 1 (near "- ? "1"").
|
||||
*/
|
||||
public function testComplexMappingNestedInSequenceThrowsParseException()
|
||||
{
|
||||
@@ -1912,7 +1814,7 @@ INI;
|
||||
} else {
|
||||
eval('$expected = '.trim($test['php']).';');
|
||||
|
||||
$tests[] = array(var_export($expected, true), $test['yaml'], $test['test'], isset($test['deprecated']) ? $test['deprecated'] : false);
|
||||
$tests[] = array(var_export($expected, true), $test['yaml'], $test['test']);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1975,62 +1877,6 @@ YAML;
|
||||
$this->assertSame($expected, $this->parser->parse($yaml, Yaml::PARSE_CONSTANT));
|
||||
}
|
||||
|
||||
/**
|
||||
* @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:
|
||||
!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));
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
|
Reference in New Issue
Block a user