update v1.0.7.9 R.C.
This is a Release Candidate. We are still testing.
This commit is contained in:
20
vendor/symfony/yaml/Tests/InlineTest.php
vendored
20
vendor/symfony/yaml/Tests/InlineTest.php
vendored
@@ -277,6 +277,24 @@ class InlineTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertContains('Not quoting a scalar starting with the "%" indicator character is deprecated since Symfony 3.1 and will throw a ParseException in 4.0.', $deprecations[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getDataForIsHash
|
||||
*/
|
||||
public function testIsHash($array, $expected)
|
||||
{
|
||||
$this->assertSame($expected, Inline::isHash($array));
|
||||
}
|
||||
|
||||
public function getDataForIsHash()
|
||||
{
|
||||
return array(
|
||||
array(array(), false),
|
||||
array(array(1, 2, 3), false),
|
||||
array(array(2 => 1, 1 => 2, 0 => 3), true),
|
||||
array(array('foo' => 1, 'bar' => 2), true),
|
||||
);
|
||||
}
|
||||
|
||||
public function getTestsForParse()
|
||||
{
|
||||
return array(
|
||||
@@ -483,6 +501,8 @@ class InlineTest extends \PHPUnit_Framework_TestCase
|
||||
array('[foo, { bar: foo, foo: [foo, { bar: foo }] }, [foo, { bar: foo }]]', array('foo', array('bar' => 'foo', 'foo' => array('foo', array('bar' => 'foo'))), array('foo', array('bar' => 'foo')))),
|
||||
|
||||
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)))),
|
||||
);
|
||||
}
|
||||
|
||||
|
87
vendor/symfony/yaml/Tests/ParserTest.php
vendored
87
vendor/symfony/yaml/Tests/ParserTest.php
vendored
@@ -693,6 +693,25 @@ EOT;
|
||||
$this->assertSame($expected, $this->parser->parse($yaml));
|
||||
}
|
||||
|
||||
public function testSequenceFollowedByCommentEmbeddedInMapping()
|
||||
{
|
||||
$yaml = <<<EOT
|
||||
a:
|
||||
b:
|
||||
- c
|
||||
# comment
|
||||
d: e
|
||||
EOT;
|
||||
$expected = array(
|
||||
'a' => array(
|
||||
'b' => array('c'),
|
||||
'd' => 'e',
|
||||
),
|
||||
);
|
||||
|
||||
$this->assertSame($expected, $this->parser->parse($yaml));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
|
||||
*/
|
||||
@@ -1243,6 +1262,74 @@ EOT;
|
||||
|
||||
$this->assertEquals(array('date' => $expectedDate), $this->parser->parse($yaml, Yaml::PARSE_DATETIME));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $lineNumber
|
||||
* @param $yaml
|
||||
* @dataProvider parserThrowsExceptionWithCorrectLineNumberProvider
|
||||
*/
|
||||
public function testParserThrowsExceptionWithCorrectLineNumber($lineNumber, $yaml)
|
||||
{
|
||||
$this->setExpectedException(
|
||||
'\Symfony\Component\Yaml\Exception\ParseException',
|
||||
sprintf('Unexpected characters near "," at line %d (near "bar: "123",").', $lineNumber)
|
||||
);
|
||||
|
||||
$this->parser->parse($yaml);
|
||||
}
|
||||
|
||||
public function parserThrowsExceptionWithCorrectLineNumberProvider()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
4,
|
||||
<<<YAML
|
||||
foo:
|
||||
-
|
||||
# bar
|
||||
bar: "123",
|
||||
YAML
|
||||
),
|
||||
array(
|
||||
5,
|
||||
<<<YAML
|
||||
foo:
|
||||
-
|
||||
# bar
|
||||
# bar
|
||||
bar: "123",
|
||||
YAML
|
||||
),
|
||||
array(
|
||||
8,
|
||||
<<<YAML
|
||||
foo:
|
||||
-
|
||||
# foobar
|
||||
baz: 123
|
||||
bar:
|
||||
-
|
||||
# bar
|
||||
bar: "123",
|
||||
YAML
|
||||
),
|
||||
array(
|
||||
10,
|
||||
<<<YAML
|
||||
foo:
|
||||
-
|
||||
# foobar
|
||||
# foobar
|
||||
baz: 123
|
||||
bar:
|
||||
-
|
||||
# bar
|
||||
# bar
|
||||
bar: "123",
|
||||
YAML
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class B
|
||||
|
Reference in New Issue
Block a user