Updating Symfony lib and dependencies:

Package operations: 2 installs, 23 updates, 0 removals
  - Updating psr/log (1.1.0 => 1.1.2)
  - Updating symfony/debug (v3.4.30 => v3.4.35)
  - Updating symfony/console (v3.4.30 => v3.4.35)
  - Updating symfony/dotenv (v3.4.30 => v3.4.35)
  - Updating symfony/routing (v3.4.30 => v3.4.35)
  - Updating symfony/finder (v3.4.30 => v3.4.35)
  - Updating symfony/filesystem (v3.4.30 => v3.4.35)
  - Installing symfony/polyfill-util (v1.12.0)
  - Installing symfony/polyfill-php56 (v1.12.0)
  - Updating symfony/http-foundation (v3.4.30 => v3.4.35)
  - Updating symfony/event-dispatcher (v3.4.30 => v3.4.35)
  - Updating symfony/http-kernel (v3.4.30 => v3.4.35)
  - Updating symfony/config (v3.4.30 => v3.4.35)
  - Updating symfony/dependency-injection (v3.4.30 => v3.4.35)
  - Updating symfony/class-loader (v3.4.30 => v3.4.35)
  - Updating symfony/cache (v3.4.30 => v3.4.35)
  - Updating symfony/framework-bundle (v3.4.30 => v3.4.35)
  - Updating twig/twig (v1.42.2 => v1.42.4)
  - Updating symfony/twig-bridge (v3.4.30 => v3.4.35)
  - Updating symfony/twig-bundle (v3.4.30 => v3.4.35)
  - Updating symfony/yaml (v3.4.30 => v3.4.35)
  - Updating symfony/stopwatch (v3.4.30 => v3.4.35)
  - Updating symfony/var-dumper (v3.4.30 => v3.4.35)
  - Updating symfony/web-profiler-bundle (v3.4.30 => v3.4.35)
  - Updating symfony/css-selector (v3.4.30 => v3.4.35)
This commit is contained in:
Molkobain
2019-11-18 18:04:32 +01:00
parent 532eb466a1
commit c76cccd2e7
633 changed files with 4154 additions and 4093 deletions

View File

@@ -12,7 +12,6 @@
namespace Symfony\Component\Yaml\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Yaml\Exception\ParseException;
use Symfony\Component\Yaml\Parser;
use Symfony\Component\Yaml\Tag\TaggedValue;
use Symfony\Component\Yaml\Yaml;
@@ -46,14 +45,12 @@ class ParserTest extends TestCase
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;
return null;
});
}
@@ -63,7 +60,7 @@ class ParserTest extends TestCase
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]);
$this->assertStringContainsString(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]);
}
}
@@ -113,7 +110,7 @@ class ParserTest extends TestCase
foreach ($yamls as $yaml) {
try {
$content = $this->parser->parse($yaml);
$this->parser->parse($yaml);
$this->fail('YAML files must not contain tabs');
} catch (\Exception $e) {
@@ -610,10 +607,10 @@ YAML;
/**
* @dataProvider invalidDumpedObjectProvider
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
*/
public function testObjectsSupportDisabledWithExceptions($yaml)
{
$this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$this->parser->parse($yaml, Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE);
}
@@ -631,10 +628,10 @@ YAML;
/**
* @group legacy
* @dataProvider invalidDumpedObjectProvider
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
*/
public function testObjectsSupportDisabledWithExceptionsUsingBooleanToggles($yaml)
{
$this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$this->parser->parse($yaml, true);
}
@@ -677,11 +674,9 @@ EOF;
}
}
/**
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
*/
public function testUnindentedCollectionException()
{
$this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$yaml = <<<'EOF'
collection:
@@ -694,11 +689,9 @@ EOF;
$this->parser->parse($yaml);
}
/**
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
*/
public function testShortcutKeyUnindentedCollectionException()
{
$this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$yaml = <<<'EOF'
collection:
@@ -710,12 +703,10 @@ EOF;
$this->parser->parse($yaml);
}
/**
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
* @expectedExceptionMessageRegExp /^Multiple documents are not supported.+/
*/
public function testMultipleDocumentsNotSupportedException()
{
$this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$this->expectExceptionMessageRegExp('/^Multiple documents are not supported.+/');
Yaml::parse(<<<'EOL'
# Ranking of 1998 home runs
---
@@ -731,11 +722,9 @@ EOL
);
}
/**
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
*/
public function testSequenceInAMapping()
{
$this->expectException('Symfony\Component\Yaml\Exception\ParseException');
Yaml::parse(<<<'EOF'
yaml:
hash: me
@@ -840,10 +829,10 @@ EOT;
/**
* @dataProvider getParseExceptionNotAffectedMultiLineStringLastResortParsing
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
*/
public function testParseExceptionNotAffectedByMultiLineStringLastResortParsing($yaml)
{
$this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$this->parser->parse($yaml);
}
@@ -873,11 +862,9 @@ EOT;
$this->assertSame($expected, $this->parser->parse($yaml));
}
/**
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
*/
public function testMappingInASequence()
{
$this->expectException('Symfony\Component\Yaml\Exception\ParseException');
Yaml::parse(<<<'EOF'
yaml:
- array stuff
@@ -886,12 +873,10 @@ EOF
);
}
/**
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
* @expectedExceptionMessage missing colon
*/
public function testScalarInSequence()
{
$this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$this->expectExceptionMessage('missing colon');
Yaml::parse(<<<'EOF'
foo:
- bar
@@ -1242,12 +1227,10 @@ EOF;
$this->assertEquals($expected, $this->parser->parse($yaml));
}
/**
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
* @expectedExceptionMessage A colon cannot be used in an unquoted mapping value
*/
public function testColonInMappingValueException()
{
$this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$this->expectExceptionMessage('A colon cannot be used in an unquoted mapping value');
$yaml = <<<'EOF'
foo: bar: baz
EOF;
@@ -1481,15 +1464,11 @@ EOT
/**
* @dataProvider getInvalidBinaryData
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
*/
public function testParseInvalidBinaryData($data, $expectedMessage)
{
if (method_exists($this, 'expectException')) {
$this->expectExceptionMessageRegExp($expectedMessage);
} else {
$this->setExpectedExceptionRegExp(ParseException::class, $expectedMessage);
}
$this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$this->expectExceptionMessageRegExp($expectedMessage);
$this->parser->parse($data);
}
@@ -1556,12 +1535,8 @@ EOT;
*/
public function testParserThrowsExceptionWithCorrectLineNumber($lineNumber, $yaml)
{
if (method_exists($this, 'expectException')) {
$this->expectException('\Symfony\Component\Yaml\Exception\ParseException');
$this->expectExceptionMessage(sprintf('Unexpected characters near "," at line %d (near "bar: "123",").', $lineNumber));
} else {
$this->setExpectedException('\Symfony\Component\Yaml\Exception\ParseException', sprintf('Unexpected characters near "," at line %d (near "bar: "123",").', $lineNumber));
}
$this->expectException('\Symfony\Component\Yaml\Exception\ParseException');
$this->expectExceptionMessage(sprintf('Unexpected characters near "," at line %d (near "bar: "123",").', $lineNumber));
$this->parser->parse($yaml);
}
@@ -1803,12 +1778,10 @@ YAML
];
}
/**
* @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 testCustomTagsDisabled()
{
$this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$this->expectExceptionMessage('Tags support is not enabled. Enable the `Yaml::PARSE_CUSTOM_TAGS` flag to use "!iterator" at line 1 (near "!iterator [foo]").');
$this->parser->parse('!iterator [foo]');
}
@@ -1821,12 +1794,10 @@ YAML
$this->assertEquals('!iterator foo', $this->parser->parse('!iterator foo'));
}
/**
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
* @expectedExceptionMessage The built-in tag "!!foo" is not implemented at line 1 (near "!!foo").
*/
public function testExceptionWhenUsingUnsuportedBuiltInTags()
{
$this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$this->expectExceptionMessage('The built-in tag "!!foo" is not implemented at line 1 (near "!!foo").');
$this->parser->parse('!!foo');
}
@@ -1876,12 +1847,10 @@ YAML;
$this->parser->parse($yaml);
}
/**
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
* @expectedExceptionMessage Unable to parse at line 1 (near "[parameters]").
*/
public function testParsingIniThrowsException()
{
$this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$this->expectExceptionMessage('Unable to parse at line 1 (near "[parameters]").');
$ini = <<<INI
[parameters]
foo = bar
@@ -1931,12 +1900,10 @@ INI;
$this->assertEquals($trickyVal, $arrayFromYaml);
}
/**
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
* @expectedExceptionMessage Reference "foo" does not exist at line 2
*/
public function testParserCleansUpReferencesBetweenRuns()
{
$this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$this->expectExceptionMessage('Reference "foo" does not exist at line 2');
$yaml = <<<YAML
foo: &foo
baz: foobar
@@ -2077,24 +2044,20 @@ YAML;
public function testParseFile()
{
$this->assertInternalType('array', $this->parser->parseFile(__DIR__.'/Fixtures/index.yml'));
$this->assertIsArray($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->expectException('Symfony\Component\Yaml\Exception\ParseException');
$this->expectExceptionMessageRegExp('#^File ".+/Fixtures/nonexistent.yml" does not exist\.$#');
$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()
{
$this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$this->expectExceptionMessageRegExp('#^File ".+/Fixtures/not_readable.yml" cannot be read\.$#');
if ('\\' === \DIRECTORY_SEPARATOR) {
$this->markTestSkipped('chmod is not supported on Windows');
}
@@ -2165,12 +2128,10 @@ YAML;
$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()
{
$this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$this->expectExceptionMessage('Reference "foo" does not exist');
$yaml = <<<EOE
foo: { &foo { a: Steve, <<: *foo} }
EOE;
@@ -2179,11 +2140,11 @@ EOE;
/**
* @dataProvider circularReferenceProvider
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
* @expectedExceptionMessage Circular reference [foo, bar, foo] detected
*/
public function testDetectCircularReferences($yaml)
{
$this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$this->expectExceptionMessage('Circular reference [foo, bar, foo] detected');
$this->parser->parse($yaml, Yaml::PARSE_CUSTOM_TAGS);
}
@@ -2292,6 +2253,60 @@ YAML;
return $tests;
}
public function testMultiLineComment()
{
$yaml = <<<YAML
parameters:
abc
# Comment
YAML;
$this->assertSame(['parameters' => 'abc'], $this->parser->parse($yaml));
}
public function testParseValueWithModifiers()
{
$yaml = <<<YAML
parameters:
abc: |+5 # plus five spaces indent
one
two
three
four
five
YAML;
$this->assertSame(
[
'parameters' => [
'abc' => implode("\n", ['one', 'two', 'three', 'four', 'five']),
],
],
$this->parser->parse($yaml)
);
}
public function testParseValueWithNegativeModifiers()
{
$yaml = <<<YAML
parameters:
abc: |-3 # minus
one
two
three
four
five
YAML;
$this->assertSame(
[
'parameters' => [
'abc' => implode("\n", ['one', 'two', 'three', 'four', 'five']),
],
],
$this->parser->parse($yaml)
);
}
}
class B