add composer's vendor directory
This commit is contained in:
parent
01a3860d73
commit
60b094d5fa
745 changed files with 56017 additions and 1 deletions
254
vendor/symfony/yaml/Tests/DumperTest.php
vendored
Normal file
254
vendor/symfony/yaml/Tests/DumperTest.php
vendored
Normal file
|
@ -0,0 +1,254 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Yaml\Tests;
|
||||
|
||||
use Symfony\Component\Yaml\Parser;
|
||||
use Symfony\Component\Yaml\Dumper;
|
||||
|
||||
class DumperTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $parser;
|
||||
protected $dumper;
|
||||
protected $path;
|
||||
|
||||
protected $array = array(
|
||||
'' => 'bar',
|
||||
'foo' => '#bar',
|
||||
'foo\'bar' => array(),
|
||||
'bar' => array(1, 'foo'),
|
||||
'foobar' => array(
|
||||
'foo' => 'bar',
|
||||
'bar' => array(1, 'foo'),
|
||||
'foobar' => array(
|
||||
'foo' => 'bar',
|
||||
'bar' => array(1, 'foo'),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->parser = new Parser();
|
||||
$this->dumper = new Dumper();
|
||||
$this->path = __DIR__.'/Fixtures';
|
||||
}
|
||||
|
||||
protected function tearDown()
|
||||
{
|
||||
$this->parser = null;
|
||||
$this->dumper = null;
|
||||
$this->path = null;
|
||||
$this->array = null;
|
||||
}
|
||||
|
||||
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'));
|
||||
foreach ($files as $file) {
|
||||
$yamls = file_get_contents($this->path.'/'.$file.'.yml');
|
||||
|
||||
// split YAMLs documents
|
||||
foreach (preg_split('/^---( %YAML\:1\.0)?/m', $yamls) as $yaml) {
|
||||
if (!$yaml) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$test = $this->parser->parse($yaml);
|
||||
if (isset($test['dump_skip']) && $test['dump_skip']) {
|
||||
continue;
|
||||
} elseif (isset($test['todo']) && $test['todo']) {
|
||||
// TODO
|
||||
} else {
|
||||
eval('$expected = '.trim($test['php']).';');
|
||||
$this->assertSame($expected, $this->parser->parse($this->dumper->dump($expected, 10)), $test['test']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function testInlineLevel()
|
||||
{
|
||||
$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, -10), '->dump() takes an inline level argument');
|
||||
$this->assertEquals($expected, $this->dumper->dump($this->array, 0), '->dump() takes an inline level argument');
|
||||
|
||||
$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, 1), '->dump() takes an inline level argument');
|
||||
|
||||
$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, 2), '->dump() takes an inline level argument');
|
||||
|
||||
$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, 3), '->dump() takes an inline level argument');
|
||||
|
||||
$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), '->dump() takes an inline level argument');
|
||||
$this->assertEquals($expected, $this->dumper->dump($this->array, 10), '->dump() takes an inline level argument');
|
||||
}
|
||||
|
||||
public function testObjectSupportEnabled()
|
||||
{
|
||||
$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));
|
||||
|
||||
$this->assertEquals('{ foo: null, bar: 1 }', $dump, '->dump() does not dump objects when disabled');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Yaml\Exception\DumpException
|
||||
*/
|
||||
public function testObjectSupportDisabledWithExceptions()
|
||||
{
|
||||
$this->dumper->dump(array('foo' => new A(), 'bar' => 1), 0, 0, true, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getEscapeSequences
|
||||
*/
|
||||
public function testEscapedEscapeSequencesInQuotedScalar($input, $expected)
|
||||
{
|
||||
$this->assertEquals($expected, $this->dumper->dump($input));
|
||||
}
|
||||
|
||||
public function getEscapeSequences()
|
||||
{
|
||||
return array(
|
||||
'null' => array("\t\\0", '"\t\\\\0"'),
|
||||
'bell' => array("\t\\a", '"\t\\\\a"'),
|
||||
'backspace' => array("\t\\b", '"\t\\\\b"'),
|
||||
'horizontal-tab' => array("\t\\t", '"\t\\\\t"'),
|
||||
'line-feed' => array("\t\\n", '"\t\\\\n"'),
|
||||
'vertical-tab' => array("\t\\v", '"\t\\\\v"'),
|
||||
'form-feed' => array("\t\\f", '"\t\\\\f"'),
|
||||
'carriage-return' => array("\t\\r", '"\t\\\\r"'),
|
||||
'escape' => array("\t\\e", '"\t\\\\e"'),
|
||||
'space' => array("\t\\ ", '"\t\\\\ "'),
|
||||
'double-quote' => array("\t\\\"", '"\t\\\\\\""'),
|
||||
'slash' => array("\t\\/", '"\t\\\\/"'),
|
||||
'backslash' => array("\t\\\\", '"\t\\\\\\\\"'),
|
||||
'next-line' => array("\t\\N", '"\t\\\\N"'),
|
||||
'non-breaking-space' => array("\t\\<EFBFBD>", '"\t\\\\<5C>"'),
|
||||
'line-separator' => array("\t\\L", '"\t\\\\L"'),
|
||||
'paragraph-separator' => array("\t\\P", '"\t\\\\P"'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @expectedExceptionMessage The indentation must be greater than zero
|
||||
*/
|
||||
public function testZeroIndentationThrowsException()
|
||||
{
|
||||
$this->dumper->setIndentation(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @expectedExceptionMessage The indentation must be greater than zero
|
||||
*/
|
||||
public function testNegativeIndentationThrowsException()
|
||||
{
|
||||
$this->dumper->setIndentation(-4);
|
||||
}
|
||||
}
|
||||
|
||||
class A
|
||||
{
|
||||
public $a = 'foo';
|
||||
}
|
31
vendor/symfony/yaml/Tests/Fixtures/YtsAnchorAlias.yml
vendored
Normal file
31
vendor/symfony/yaml/Tests/Fixtures/YtsAnchorAlias.yml
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
--- %YAML:1.0
|
||||
test: Simple Alias Example
|
||||
brief: >
|
||||
If you need to refer to the same item of data twice,
|
||||
you can give that item an alias. The alias is a plain
|
||||
string, starting with an ampersand. The item may then
|
||||
be referred to by the alias throughout your document
|
||||
by using an asterisk before the name of the alias.
|
||||
This is called an anchor.
|
||||
yaml: |
|
||||
- &showell Steve
|
||||
- Clark
|
||||
- Brian
|
||||
- Oren
|
||||
- *showell
|
||||
php: |
|
||||
array('Steve', 'Clark', 'Brian', 'Oren', 'Steve')
|
||||
|
||||
---
|
||||
test: Alias of a Mapping
|
||||
brief: >
|
||||
An alias can be used on any item of data, including
|
||||
sequences, mappings, and other complex data types.
|
||||
yaml: |
|
||||
- &hello
|
||||
Meat: pork
|
||||
Starch: potato
|
||||
- banana
|
||||
- *hello
|
||||
php: |
|
||||
array(array('Meat'=>'pork', 'Starch'=>'potato'), 'banana', array('Meat'=>'pork', 'Starch'=>'potato'))
|
202
vendor/symfony/yaml/Tests/Fixtures/YtsBasicTests.yml
vendored
Normal file
202
vendor/symfony/yaml/Tests/Fixtures/YtsBasicTests.yml
vendored
Normal file
|
@ -0,0 +1,202 @@
|
|||
--- %YAML:1.0
|
||||
test: Simple Sequence
|
||||
brief: |
|
||||
You can specify a list in YAML by placing each
|
||||
member of the list on a new line with an opening
|
||||
dash. These lists are called sequences.
|
||||
yaml: |
|
||||
- apple
|
||||
- banana
|
||||
- carrot
|
||||
php: |
|
||||
array('apple', 'banana', 'carrot')
|
||||
---
|
||||
test: Sequence With Item Being Null In The Middle
|
||||
brief: |
|
||||
You can specify a list in YAML by placing each
|
||||
member of the list on a new line with an opening
|
||||
dash. These lists are called sequences.
|
||||
yaml: |
|
||||
- apple
|
||||
-
|
||||
- carrot
|
||||
php: |
|
||||
array('apple', null, 'carrot')
|
||||
---
|
||||
test: Sequence With Last Item Being Null
|
||||
brief: |
|
||||
You can specify a list in YAML by placing each
|
||||
member of the list on a new line with an opening
|
||||
dash. These lists are called sequences.
|
||||
yaml: |
|
||||
- apple
|
||||
- banana
|
||||
-
|
||||
php: |
|
||||
array('apple', 'banana', null)
|
||||
---
|
||||
test: Nested Sequences
|
||||
brief: |
|
||||
You can include a sequence within another
|
||||
sequence by giving the sequence an empty
|
||||
dash, followed by an indented list.
|
||||
yaml: |
|
||||
-
|
||||
- foo
|
||||
- bar
|
||||
- baz
|
||||
php: |
|
||||
array(array('foo', 'bar', 'baz'))
|
||||
---
|
||||
test: Mixed Sequences
|
||||
brief: |
|
||||
Sequences can contain any YAML data,
|
||||
including strings and other sequences.
|
||||
yaml: |
|
||||
- apple
|
||||
-
|
||||
- foo
|
||||
- bar
|
||||
- x123
|
||||
- banana
|
||||
- carrot
|
||||
php: |
|
||||
array('apple', array('foo', 'bar', 'x123'), 'banana', 'carrot')
|
||||
---
|
||||
test: Deeply Nested Sequences
|
||||
brief: |
|
||||
Sequences can be nested even deeper, with each
|
||||
level of indentation representing a level of
|
||||
depth.
|
||||
yaml: |
|
||||
-
|
||||
-
|
||||
- uno
|
||||
- dos
|
||||
php: |
|
||||
array(array(array('uno', 'dos')))
|
||||
---
|
||||
test: Simple Mapping
|
||||
brief: |
|
||||
You can add a keyed list (also known as a dictionary or
|
||||
hash) to your document by placing each member of the
|
||||
list on a new line, with a colon separating the key
|
||||
from its value. In YAML, this type of list is called
|
||||
a mapping.
|
||||
yaml: |
|
||||
foo: whatever
|
||||
bar: stuff
|
||||
php: |
|
||||
array('foo' => 'whatever', 'bar' => 'stuff')
|
||||
---
|
||||
test: Sequence in a Mapping
|
||||
brief: |
|
||||
A value in a mapping can be a sequence.
|
||||
yaml: |
|
||||
foo: whatever
|
||||
bar:
|
||||
- uno
|
||||
- dos
|
||||
php: |
|
||||
array('foo' => 'whatever', 'bar' => array('uno', 'dos'))
|
||||
---
|
||||
test: Nested Mappings
|
||||
brief: |
|
||||
A value in a mapping can be another mapping.
|
||||
yaml: |
|
||||
foo: whatever
|
||||
bar:
|
||||
fruit: apple
|
||||
name: steve
|
||||
sport: baseball
|
||||
php: |
|
||||
array(
|
||||
'foo' => 'whatever',
|
||||
'bar' => array(
|
||||
'fruit' => 'apple',
|
||||
'name' => 'steve',
|
||||
'sport' => 'baseball'
|
||||
)
|
||||
)
|
||||
---
|
||||
test: Mixed Mapping
|
||||
brief: |
|
||||
A mapping can contain any assortment
|
||||
of mappings and sequences as values.
|
||||
yaml: |
|
||||
foo: whatever
|
||||
bar:
|
||||
-
|
||||
fruit: apple
|
||||
name: steve
|
||||
sport: baseball
|
||||
- more
|
||||
-
|
||||
python: rocks
|
||||
perl: papers
|
||||
ruby: scissorses
|
||||
php: |
|
||||
array(
|
||||
'foo' => 'whatever',
|
||||
'bar' => array(
|
||||
array(
|
||||
'fruit' => 'apple',
|
||||
'name' => 'steve',
|
||||
'sport' => 'baseball'
|
||||
),
|
||||
'more',
|
||||
array(
|
||||
'python' => 'rocks',
|
||||
'perl' => 'papers',
|
||||
'ruby' => 'scissorses'
|
||||
)
|
||||
)
|
||||
)
|
||||
---
|
||||
test: Mapping-in-Sequence Shortcut
|
||||
todo: true
|
||||
brief: |
|
||||
If you are adding a mapping to a sequence, you
|
||||
can place the mapping on the same line as the
|
||||
dash as a shortcut.
|
||||
yaml: |
|
||||
- work on YAML.py:
|
||||
- work on Store
|
||||
php: |
|
||||
array(array('work on YAML.py' => array('work on Store')))
|
||||
---
|
||||
test: Sequence-in-Mapping Shortcut
|
||||
todo: true
|
||||
brief: |
|
||||
The dash in a sequence counts as indentation, so
|
||||
you can add a sequence inside of a mapping without
|
||||
needing spaces as indentation.
|
||||
yaml: |
|
||||
allow:
|
||||
- 'localhost'
|
||||
- '%.sourceforge.net'
|
||||
- '%.freepan.org'
|
||||
php: |
|
||||
array('allow' => array('localhost', '%.sourceforge.net', '%.freepan.org'))
|
||||
---
|
||||
todo: true
|
||||
test: Merge key
|
||||
brief: |
|
||||
A merge key ('<<') can be used in a mapping to insert other mappings. If
|
||||
the value associated with the merge key is a mapping, each of its key/value
|
||||
pairs is inserted into the current mapping.
|
||||
yaml: |
|
||||
mapping:
|
||||
name: Joe
|
||||
job: Accountant
|
||||
<<:
|
||||
age: 38
|
||||
php: |
|
||||
array(
|
||||
'mapping' =>
|
||||
array(
|
||||
'name' => 'Joe',
|
||||
'job' => 'Accountant',
|
||||
'age' => 38
|
||||
)
|
||||
)
|
51
vendor/symfony/yaml/Tests/Fixtures/YtsBlockMapping.yml
vendored
Normal file
51
vendor/symfony/yaml/Tests/Fixtures/YtsBlockMapping.yml
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
---
|
||||
test: One Element Mapping
|
||||
brief: |
|
||||
A mapping with one key/value pair
|
||||
yaml: |
|
||||
foo: bar
|
||||
php: |
|
||||
array('foo' => 'bar')
|
||||
---
|
||||
test: Multi Element Mapping
|
||||
brief: |
|
||||
More than one key/value pair
|
||||
yaml: |
|
||||
red: baron
|
||||
white: walls
|
||||
blue: berries
|
||||
php: |
|
||||
array(
|
||||
'red' => 'baron',
|
||||
'white' => 'walls',
|
||||
'blue' => 'berries',
|
||||
)
|
||||
---
|
||||
test: Values aligned
|
||||
brief: |
|
||||
Often times human editors of documents will align the values even
|
||||
though YAML emitters generally don't.
|
||||
yaml: |
|
||||
red: baron
|
||||
white: walls
|
||||
blue: berries
|
||||
php: |
|
||||
array(
|
||||
'red' => 'baron',
|
||||
'white' => 'walls',
|
||||
'blue' => 'berries',
|
||||
)
|
||||
---
|
||||
test: Colons aligned
|
||||
brief: |
|
||||
Spaces can come before the ': ' key/value separator.
|
||||
yaml: |
|
||||
red : baron
|
||||
white : walls
|
||||
blue : berries
|
||||
php: |
|
||||
array(
|
||||
'red' => 'baron',
|
||||
'white' => 'walls',
|
||||
'blue' => 'berries',
|
||||
)
|
85
vendor/symfony/yaml/Tests/Fixtures/YtsDocumentSeparator.yml
vendored
Normal file
85
vendor/symfony/yaml/Tests/Fixtures/YtsDocumentSeparator.yml
vendored
Normal file
|
@ -0,0 +1,85 @@
|
|||
--- %YAML:1.0
|
||||
test: Trailing Document Separator
|
||||
todo: true
|
||||
brief: >
|
||||
You can separate YAML documents
|
||||
with a string of three dashes.
|
||||
yaml: |
|
||||
- foo: 1
|
||||
bar: 2
|
||||
---
|
||||
more: stuff
|
||||
python: |
|
||||
[
|
||||
[ { 'foo': 1, 'bar': 2 } ],
|
||||
{ 'more': 'stuff' }
|
||||
]
|
||||
ruby: |
|
||||
[ { 'foo' => 1, 'bar' => 2 } ]
|
||||
|
||||
---
|
||||
test: Leading Document Separator
|
||||
todo: true
|
||||
brief: >
|
||||
You can explicitly give an opening
|
||||
document separator to your YAML stream.
|
||||
yaml: |
|
||||
---
|
||||
- foo: 1
|
||||
bar: 2
|
||||
---
|
||||
more: stuff
|
||||
python: |
|
||||
[
|
||||
[ {'foo': 1, 'bar': 2}],
|
||||
{'more': 'stuff'}
|
||||
]
|
||||
ruby: |
|
||||
[ { 'foo' => 1, 'bar' => 2 } ]
|
||||
|
||||
---
|
||||
test: YAML Header
|
||||
todo: true
|
||||
brief: >
|
||||
The opening separator can contain directives
|
||||
to the YAML parser, such as the version
|
||||
number.
|
||||
yaml: |
|
||||
--- %YAML:1.0
|
||||
foo: 1
|
||||
bar: 2
|
||||
php: |
|
||||
array('foo' => 1, 'bar' => 2)
|
||||
documents: 1
|
||||
|
||||
---
|
||||
test: Red Herring Document Separator
|
||||
brief: >
|
||||
Separators included in blocks or strings
|
||||
are treated as blocks or strings, as the
|
||||
document separator should have no indentation
|
||||
preceding it.
|
||||
yaml: |
|
||||
foo: |
|
||||
---
|
||||
php: |
|
||||
array('foo' => "---\n")
|
||||
|
||||
---
|
||||
test: Multiple Document Separators in Block
|
||||
brief: >
|
||||
This technique allows you to embed other YAML
|
||||
documents within literal blocks.
|
||||
yaml: |
|
||||
foo: |
|
||||
---
|
||||
foo: bar
|
||||
---
|
||||
yo: baz
|
||||
bar: |
|
||||
fooness
|
||||
php: |
|
||||
array(
|
||||
'foo' => "---\nfoo: bar\n---\nyo: baz\n",
|
||||
'bar' => "fooness\n"
|
||||
)
|
25
vendor/symfony/yaml/Tests/Fixtures/YtsErrorTests.yml
vendored
Normal file
25
vendor/symfony/yaml/Tests/Fixtures/YtsErrorTests.yml
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
---
|
||||
test: Missing value for hash item
|
||||
todo: true
|
||||
brief: |
|
||||
Third item in this hash doesn't have a value
|
||||
yaml: |
|
||||
okay: value
|
||||
also okay: ~
|
||||
causes error because no value specified
|
||||
last key: value okay here too
|
||||
python-error: causes error because no value specified
|
||||
|
||||
---
|
||||
test: Not indenting enough
|
||||
brief: |
|
||||
There was a bug in PyYaml where it was off by one
|
||||
in the indentation check. It was allowing the YAML
|
||||
below.
|
||||
# This is actually valid YAML now. Someone should tell showell.
|
||||
yaml: |
|
||||
foo:
|
||||
firstline: 1
|
||||
secondline: 2
|
||||
php: |
|
||||
array('foo' => null, 'firstline' => 1, 'secondline' => 2)
|
60
vendor/symfony/yaml/Tests/Fixtures/YtsFlowCollections.yml
vendored
Normal file
60
vendor/symfony/yaml/Tests/Fixtures/YtsFlowCollections.yml
vendored
Normal file
|
@ -0,0 +1,60 @@
|
|||
---
|
||||
test: Simple Inline Array
|
||||
brief: >
|
||||
Sequences can be contained on a
|
||||
single line, using the inline syntax.
|
||||
Separate each entry with commas and
|
||||
enclose in square brackets.
|
||||
yaml: |
|
||||
seq: [ a, b, c ]
|
||||
php: |
|
||||
array('seq' => array('a', 'b', 'c'))
|
||||
---
|
||||
test: Simple Inline Hash
|
||||
brief: >
|
||||
Mapping can also be contained on
|
||||
a single line, using the inline
|
||||
syntax. Each key-value pair is
|
||||
separated by a colon, with a comma
|
||||
between each entry in the mapping.
|
||||
Enclose with curly braces.
|
||||
yaml: |
|
||||
hash: { name: Steve, foo: bar }
|
||||
php: |
|
||||
array('hash' => array('name' => 'Steve', 'foo' => 'bar'))
|
||||
---
|
||||
test: Multi-line Inline Collections
|
||||
todo: true
|
||||
brief: >
|
||||
Both inline sequences and inline mappings
|
||||
can span multiple lines, provided that you
|
||||
indent the additional lines.
|
||||
yaml: |
|
||||
languages: [ Ruby,
|
||||
Perl,
|
||||
Python ]
|
||||
websites: { YAML: yaml.org,
|
||||
Ruby: ruby-lang.org,
|
||||
Python: python.org,
|
||||
Perl: use.perl.org }
|
||||
php: |
|
||||
array(
|
||||
'languages' => array('Ruby', 'Perl', 'Python'),
|
||||
'websites' => array(
|
||||
'YAML' => 'yaml.org',
|
||||
'Ruby' => 'ruby-lang.org',
|
||||
'Python' => 'python.org',
|
||||
'Perl' => 'use.perl.org'
|
||||
)
|
||||
)
|
||||
---
|
||||
test: Commas in Values (not in the spec!)
|
||||
todo: true
|
||||
brief: >
|
||||
List items in collections are delimited by commas, but
|
||||
there must be a space after each comma. This allows you
|
||||
to add numbers without quoting.
|
||||
yaml: |
|
||||
attendances: [ 45,123, 70,000, 17,222 ]
|
||||
php: |
|
||||
array('attendances' => array(45123, 70000, 17222))
|
176
vendor/symfony/yaml/Tests/Fixtures/YtsFoldedScalars.yml
vendored
Normal file
176
vendor/symfony/yaml/Tests/Fixtures/YtsFoldedScalars.yml
vendored
Normal file
|
@ -0,0 +1,176 @@
|
|||
--- %YAML:1.0
|
||||
test: Single ending newline
|
||||
brief: >
|
||||
A pipe character, followed by an indented
|
||||
block of text is treated as a literal
|
||||
block, in which newlines are preserved
|
||||
throughout the block, including the final
|
||||
newline.
|
||||
yaml: |
|
||||
---
|
||||
this: |
|
||||
Foo
|
||||
Bar
|
||||
php: |
|
||||
array('this' => "Foo\nBar\n")
|
||||
---
|
||||
test: The '+' indicator
|
||||
brief: >
|
||||
The '+' indicator says to keep newlines at the end of text
|
||||
blocks.
|
||||
yaml: |
|
||||
normal: |
|
||||
extra new lines not kept
|
||||
|
||||
preserving: |+
|
||||
extra new lines are kept
|
||||
|
||||
|
||||
dummy: value
|
||||
php: |
|
||||
array(
|
||||
'normal' => "extra new lines not kept\n",
|
||||
'preserving' => "extra new lines are kept\n\n\n",
|
||||
'dummy' => 'value'
|
||||
)
|
||||
---
|
||||
test: Three trailing newlines in literals
|
||||
brief: >
|
||||
To give you more control over how space
|
||||
is preserved in text blocks, YAML has
|
||||
the keep '+' and chomp '-' indicators.
|
||||
The keep indicator will preserve all
|
||||
ending newlines, while the chomp indicator
|
||||
will strip all ending newlines.
|
||||
yaml: |
|
||||
clipped: |
|
||||
This has one newline.
|
||||
|
||||
|
||||
|
||||
same as "clipped" above: "This has one newline.\n"
|
||||
|
||||
stripped: |-
|
||||
This has no newline.
|
||||
|
||||
|
||||
|
||||
same as "stripped" above: "This has no newline."
|
||||
|
||||
kept: |+
|
||||
This has four newlines.
|
||||
|
||||
|
||||
|
||||
same as "kept" above: "This has four newlines.\n\n\n\n"
|
||||
php: |
|
||||
array(
|
||||
'clipped' => "This has one newline.\n",
|
||||
'same as "clipped" above' => "This has one newline.\n",
|
||||
'stripped' => 'This has no newline.',
|
||||
'same as "stripped" above' => 'This has no newline.',
|
||||
'kept' => "This has four newlines.\n\n\n\n",
|
||||
'same as "kept" above' => "This has four newlines.\n\n\n\n"
|
||||
)
|
||||
---
|
||||
test: Extra trailing newlines with spaces
|
||||
todo: true
|
||||
brief: >
|
||||
Normally, only a single newline is kept
|
||||
from the end of a literal block, unless the
|
||||
keep '+' character is used in combination
|
||||
with the pipe. The following example
|
||||
will preserve all ending whitespace
|
||||
since the last line of both literal blocks
|
||||
contains spaces which extend past the indentation
|
||||
level.
|
||||
yaml: |
|
||||
---
|
||||
this: |
|
||||
Foo
|
||||
|
||||
|
||||
kept: |+
|
||||
Foo
|
||||
|
||||
|
||||
php: |
|
||||
array('this' => "Foo\n\n \n",
|
||||
'kept' => "Foo\n\n \n" )
|
||||
|
||||
---
|
||||
test: Folded Block in a Sequence
|
||||
brief: >
|
||||
A greater-then character, followed by an indented
|
||||
block of text is treated as a folded block, in
|
||||
which lines of text separated by a single newline
|
||||
are concatenated as a single line.
|
||||
yaml: |
|
||||
---
|
||||
- apple
|
||||
- banana
|
||||
- >
|
||||
can't you see
|
||||
the beauty of yaml?
|
||||
hmm
|
||||
- dog
|
||||
php: |
|
||||
array(
|
||||
'apple',
|
||||
'banana',
|
||||
"can't you see the beauty of yaml? hmm\n",
|
||||
'dog'
|
||||
)
|
||||
---
|
||||
test: Folded Block as a Mapping Value
|
||||
brief: >
|
||||
Both literal and folded blocks can be
|
||||
used in collections, as values in a
|
||||
sequence or a mapping.
|
||||
yaml: |
|
||||
---
|
||||
quote: >
|
||||
Mark McGwire's
|
||||
year was crippled
|
||||
by a knee injury.
|
||||
source: espn
|
||||
php: |
|
||||
array(
|
||||
'quote' => "Mark McGwire's year was crippled by a knee injury.\n",
|
||||
'source' => 'espn'
|
||||
)
|
||||
---
|
||||
test: Three trailing newlines in folded blocks
|
||||
brief: >
|
||||
The keep and chomp indicators can also
|
||||
be applied to folded blocks.
|
||||
yaml: |
|
||||
clipped: >
|
||||
This has one newline.
|
||||
|
||||
|
||||
|
||||
same as "clipped" above: "This has one newline.\n"
|
||||
|
||||
stripped: >-
|
||||
This has no newline.
|
||||
|
||||
|
||||
|
||||
same as "stripped" above: "This has no newline."
|
||||
|
||||
kept: >+
|
||||
This has four newlines.
|
||||
|
||||
|
||||
|
||||
same as "kept" above: "This has four newlines.\n\n\n\n"
|
||||
php: |
|
||||
array(
|
||||
'clipped' => "This has one newline.\n",
|
||||
'same as "clipped" above' => "This has one newline.\n",
|
||||
'stripped' => 'This has no newline.',
|
||||
'same as "stripped" above' => 'This has no newline.',
|
||||
'kept' => "This has four newlines.\n\n\n\n",
|
||||
'same as "kept" above' => "This has four newlines.\n\n\n\n"
|
||||
)
|
45
vendor/symfony/yaml/Tests/Fixtures/YtsNullsAndEmpties.yml
vendored
Normal file
45
vendor/symfony/yaml/Tests/Fixtures/YtsNullsAndEmpties.yml
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
--- %YAML:1.0
|
||||
test: Empty Sequence
|
||||
brief: >
|
||||
You can represent the empty sequence
|
||||
with an empty inline sequence.
|
||||
yaml: |
|
||||
empty: []
|
||||
php: |
|
||||
array('empty' => array())
|
||||
---
|
||||
test: Empty Mapping
|
||||
brief: >
|
||||
You can represent the empty mapping
|
||||
with an empty inline mapping.
|
||||
yaml: |
|
||||
empty: {}
|
||||
php: |
|
||||
array('empty' => array())
|
||||
---
|
||||
test: Empty Sequence as Entire Document
|
||||
yaml: |
|
||||
[]
|
||||
php: |
|
||||
array()
|
||||
---
|
||||
test: Empty Mapping as Entire Document
|
||||
yaml: |
|
||||
{}
|
||||
php: |
|
||||
array()
|
||||
---
|
||||
test: Null as Document
|
||||
yaml: |
|
||||
~
|
||||
php: |
|
||||
null
|
||||
---
|
||||
test: Empty String
|
||||
brief: >
|
||||
You can represent an empty string
|
||||
with a pair of quotes.
|
||||
yaml: |
|
||||
''
|
||||
php: |
|
||||
''
|
1697
vendor/symfony/yaml/Tests/Fixtures/YtsSpecificationExamples.yml
vendored
Normal file
1697
vendor/symfony/yaml/Tests/Fixtures/YtsSpecificationExamples.yml
vendored
Normal file
File diff suppressed because it is too large
Load diff
244
vendor/symfony/yaml/Tests/Fixtures/YtsTypeTransfers.yml
vendored
Normal file
244
vendor/symfony/yaml/Tests/Fixtures/YtsTypeTransfers.yml
vendored
Normal file
|
@ -0,0 +1,244 @@
|
|||
--- %YAML:1.0
|
||||
test: Strings
|
||||
brief: >
|
||||
Any group of characters beginning with an
|
||||
alphabetic or numeric character is a string,
|
||||
unless it belongs to one of the groups below
|
||||
(such as an Integer or Time).
|
||||
yaml: |
|
||||
String
|
||||
php: |
|
||||
'String'
|
||||
---
|
||||
test: String characters
|
||||
brief: >
|
||||
A string can contain any alphabetic or
|
||||
numeric character, along with many
|
||||
punctuation characters, including the
|
||||
period, dash, space, quotes, exclamation, and
|
||||
question mark.
|
||||
yaml: |
|
||||
- What's Yaml?
|
||||
- It's for writing data structures in plain text.
|
||||
- And?
|
||||
- And what? That's not good enough for you?
|
||||
- No, I mean, "And what about Yaml?"
|
||||
- Oh, oh yeah. Uh.. Yaml for Ruby.
|
||||
php: |
|
||||
array(
|
||||
"What's Yaml?",
|
||||
"It's for writing data structures in plain text.",
|
||||
"And?",
|
||||
"And what? That's not good enough for you?",
|
||||
"No, I mean, \"And what about Yaml?\"",
|
||||
"Oh, oh yeah. Uh.. Yaml for Ruby."
|
||||
)
|
||||
---
|
||||
test: Indicators in Strings
|
||||
brief: >
|
||||
Be careful using indicators in strings. In particular,
|
||||
the comma, colon, and pound sign must be used carefully.
|
||||
yaml: |
|
||||
the colon followed by space is an indicator: but is a string:right here
|
||||
same for the pound sign: here we have it#in a string
|
||||
the comma can, honestly, be used in most cases: [ but not in, inline collections ]
|
||||
php: |
|
||||
array(
|
||||
'the colon followed by space is an indicator' => 'but is a string:right here',
|
||||
'same for the pound sign' => 'here we have it#in a string',
|
||||
'the comma can, honestly, be used in most cases' => array('but not in', 'inline collections')
|
||||
)
|
||||
---
|
||||
test: Forcing Strings
|
||||
brief: >
|
||||
Any YAML type can be forced into a string using the
|
||||
explicit !str method.
|
||||
yaml: |
|
||||
date string: !str 2001-08-01
|
||||
number string: !str 192
|
||||
php: |
|
||||
array(
|
||||
'date string' => '2001-08-01',
|
||||
'number string' => '192'
|
||||
)
|
||||
---
|
||||
test: Single-quoted Strings
|
||||
brief: >
|
||||
You can also enclose your strings within single quotes,
|
||||
which allows use of slashes, colons, and other indicators
|
||||
freely. Inside single quotes, you can represent a single
|
||||
quote in your string by using two single quotes next to
|
||||
each other.
|
||||
yaml: |
|
||||
all my favorite symbols: '#:!/%.)'
|
||||
a few i hate: '&(*'
|
||||
why do i hate them?: 'it''s very hard to explain'
|
||||
entities: '£ me'
|
||||
php: |
|
||||
array(
|
||||
'all my favorite symbols' => '#:!/%.)',
|
||||
'a few i hate' => '&(*',
|
||||
'why do i hate them?' => 'it\'s very hard to explain',
|
||||
'entities' => '£ me'
|
||||
)
|
||||
---
|
||||
test: Double-quoted Strings
|
||||
brief: >
|
||||
Enclosing strings in double quotes allows you
|
||||
to use escapings to represent ASCII and
|
||||
Unicode characters.
|
||||
yaml: |
|
||||
i know where i want my line breaks: "one here\nand another here\n"
|
||||
php: |
|
||||
array(
|
||||
'i know where i want my line breaks' => "one here\nand another here\n"
|
||||
)
|
||||
---
|
||||
test: Multi-line Quoted Strings
|
||||
todo: true
|
||||
brief: >
|
||||
Both single- and double-quoted strings may be
|
||||
carried on to new lines in your YAML document.
|
||||
They must be indented a step and indentation
|
||||
is interpreted as a single space.
|
||||
yaml: |
|
||||
i want a long string: "so i'm going to
|
||||
let it go on and on to other lines
|
||||
until i end it with a quote."
|
||||
php: |
|
||||
array('i want a long string' => "so i'm going to ".
|
||||
"let it go on and on to other lines ".
|
||||
"until i end it with a quote."
|
||||
)
|
||||
|
||||
---
|
||||
test: Plain scalars
|
||||
todo: true
|
||||
brief: >
|
||||
Unquoted strings may also span multiple lines, if they
|
||||
are free of YAML space indicators and indented.
|
||||
yaml: |
|
||||
- My little toe is broken in two places;
|
||||
- I'm crazy to have skied this way;
|
||||
- I'm not the craziest he's seen, since there was always the German guy
|
||||
who skied for 3 hours on a broken shin bone (just below the kneecap);
|
||||
- Nevertheless, second place is respectable, and he doesn't
|
||||
recommend going for the record;
|
||||
- He's going to put my foot in plaster for a month;
|
||||
- This would impair my skiing ability somewhat for the
|
||||
duration, as can be imagined.
|
||||
php: |
|
||||
array(
|
||||
"My little toe is broken in two places;",
|
||||
"I'm crazy to have skied this way;",
|
||||
"I'm not the craziest he's seen, since there was always ".
|
||||
"the German guy who skied for 3 hours on a broken shin ".
|
||||
"bone (just below the kneecap);",
|
||||
"Nevertheless, second place is respectable, and he doesn't ".
|
||||
"recommend going for the record;",
|
||||
"He's going to put my foot in plaster for a month;",
|
||||
"This would impair my skiing ability somewhat for the duration, ".
|
||||
"as can be imagined."
|
||||
)
|
||||
---
|
||||
test: 'Null'
|
||||
brief: >
|
||||
You can use the tilde '~' character for a null value.
|
||||
yaml: |
|
||||
name: Mr. Show
|
||||
hosted by: Bob and David
|
||||
date of next season: ~
|
||||
php: |
|
||||
array(
|
||||
'name' => 'Mr. Show',
|
||||
'hosted by' => 'Bob and David',
|
||||
'date of next season' => null
|
||||
)
|
||||
---
|
||||
test: Boolean
|
||||
brief: >
|
||||
You can use 'true' and 'false' for Boolean values.
|
||||
yaml: |
|
||||
Is Gus a Liar?: true
|
||||
Do I rely on Gus for Sustenance?: false
|
||||
php: |
|
||||
array(
|
||||
'Is Gus a Liar?' => true,
|
||||
'Do I rely on Gus for Sustenance?' => false
|
||||
)
|
||||
---
|
||||
test: Integers
|
||||
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: |
|
||||
zero: 0
|
||||
simple: 12
|
||||
one-thousand: 1,000
|
||||
negative one-thousand: -1,000
|
||||
php: |
|
||||
array(
|
||||
'zero' => 0,
|
||||
'simple' => 12,
|
||||
'one-thousand' => 1000.0,
|
||||
'negative one-thousand' => -1000.0
|
||||
)
|
||||
---
|
||||
test: Integers as Map Keys
|
||||
brief: >
|
||||
An integer can be used a dictionary key.
|
||||
yaml: |
|
||||
1: one
|
||||
2: two
|
||||
3: three
|
||||
php: |
|
||||
array(
|
||||
1 => 'one',
|
||||
2 => 'two',
|
||||
3 => 'three'
|
||||
)
|
||||
---
|
||||
test: Floats
|
||||
dump_skip: 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: |
|
||||
a simple float: 2.00
|
||||
larger float: 1,000.09
|
||||
scientific notation: 1.00009e+3
|
||||
php: |
|
||||
array(
|
||||
'a simple float' => 2.0,
|
||||
'larger float' => 1000.09,
|
||||
'scientific notation' => 1000.09
|
||||
)
|
||||
---
|
||||
test: Time
|
||||
todo: true
|
||||
brief: >
|
||||
You can represent timestamps by using
|
||||
ISO8601 format, or a variation which
|
||||
allows spaces between the date, time and
|
||||
time zone.
|
||||
yaml: |
|
||||
iso8601: 2001-12-14t21:59:43.10-05:00
|
||||
space separated: 2001-12-14 21:59:43.10 -05:00
|
||||
php: |
|
||||
array(
|
||||
'iso8601' => mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" ),
|
||||
'space separated' => mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" )
|
||||
)
|
||||
---
|
||||
test: Date
|
||||
todo: true
|
||||
brief: >
|
||||
A date can be represented by its year,
|
||||
month and day in ISO8601 order.
|
||||
yaml: |
|
||||
1976-07-31
|
||||
php: |
|
||||
date( 1976, 7, 31 )
|
1
vendor/symfony/yaml/Tests/Fixtures/embededPhp.yml
vendored
Normal file
1
vendor/symfony/yaml/Tests/Fixtures/embededPhp.yml
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
value: <?php echo 1 + 2 + 3 ?>
|
155
vendor/symfony/yaml/Tests/Fixtures/escapedCharacters.yml
vendored
Normal file
155
vendor/symfony/yaml/Tests/Fixtures/escapedCharacters.yml
vendored
Normal file
|
@ -0,0 +1,155 @@
|
|||
test: outside double quotes
|
||||
yaml: |
|
||||
\0 \ \a \b \n
|
||||
php: |
|
||||
"\\0 \\ \\a \\b \\n"
|
||||
---
|
||||
test: null
|
||||
yaml: |
|
||||
"\0"
|
||||
php: |
|
||||
"\x00"
|
||||
---
|
||||
test: bell
|
||||
yaml: |
|
||||
"\a"
|
||||
php: |
|
||||
"\x07"
|
||||
---
|
||||
test: backspace
|
||||
yaml: |
|
||||
"\b"
|
||||
php: |
|
||||
"\x08"
|
||||
---
|
||||
test: horizontal tab (1)
|
||||
yaml: |
|
||||
"\t"
|
||||
php: |
|
||||
"\x09"
|
||||
---
|
||||
test: horizontal tab (2)
|
||||
yaml: |
|
||||
"\ "
|
||||
php: |
|
||||
"\x09"
|
||||
---
|
||||
test: line feed
|
||||
yaml: |
|
||||
"\n"
|
||||
php: |
|
||||
"\x0a"
|
||||
---
|
||||
test: vertical tab
|
||||
yaml: |
|
||||
"\v"
|
||||
php: |
|
||||
"\x0b"
|
||||
---
|
||||
test: form feed
|
||||
yaml: |
|
||||
"\f"
|
||||
php: |
|
||||
"\x0c"
|
||||
---
|
||||
test: carriage return
|
||||
yaml: |
|
||||
"\r"
|
||||
php: |
|
||||
"\x0d"
|
||||
---
|
||||
test: escape
|
||||
yaml: |
|
||||
"\e"
|
||||
php: |
|
||||
"\x1b"
|
||||
---
|
||||
test: space
|
||||
yaml: |
|
||||
"\ "
|
||||
php: |
|
||||
"\x20"
|
||||
---
|
||||
test: slash
|
||||
yaml: |
|
||||
"\/"
|
||||
php: |
|
||||
"\x2f"
|
||||
---
|
||||
test: backslash
|
||||
yaml: |
|
||||
"\\"
|
||||
php: |
|
||||
"\\"
|
||||
---
|
||||
test: Unicode next line
|
||||
yaml: |
|
||||
"\N"
|
||||
php: |
|
||||
"\xc2\x85"
|
||||
---
|
||||
test: Unicode non-breaking space
|
||||
yaml: |
|
||||
"\_"
|
||||
php: |
|
||||
"\xc2\xa0"
|
||||
---
|
||||
test: Unicode line separator
|
||||
yaml: |
|
||||
"\L"
|
||||
php: |
|
||||
"\xe2\x80\xa8"
|
||||
---
|
||||
test: Unicode paragraph separator
|
||||
yaml: |
|
||||
"\P"
|
||||
php: |
|
||||
"\xe2\x80\xa9"
|
||||
---
|
||||
test: Escaped 8-bit Unicode
|
||||
yaml: |
|
||||
"\x42"
|
||||
php: |
|
||||
"B"
|
||||
---
|
||||
test: Escaped 16-bit Unicode
|
||||
yaml: |
|
||||
"\u20ac"
|
||||
php: |
|
||||
"\xe2\x82\xac"
|
||||
---
|
||||
test: Escaped 32-bit Unicode
|
||||
yaml: |
|
||||
"\U00000043"
|
||||
php: |
|
||||
"C"
|
||||
---
|
||||
test: Example 5.13 Escaped Characters
|
||||
note: |
|
||||
Currently throws an error parsing first line. Maybe Symfony Yaml doesn't support
|
||||
continuation of string across multiple lines? Keeping test here but disabled.
|
||||
todo: true
|
||||
yaml: |
|
||||
"Fun with \\
|
||||
\" \a \b \e \f \
|
||||
\n \r \t \v \0 \
|
||||
\ \_ \N \L \P \
|
||||
\x41 \u0041 \U00000041"
|
||||
php: |
|
||||
"Fun with \x5C\n\x22 \x07 \x08 \x1B \x0C\n\x0A \x0D \x09 \x0B \x00\n\x20 \xA0 \x85 \xe2\x80\xa8 \xe2\x80\xa9\nA A A"
|
||||
---
|
||||
test: Double quotes with a line feed
|
||||
yaml: |
|
||||
{ double: "some value\n \"some quoted string\" and 'some single quotes one'" }
|
||||
php: |
|
||||
array(
|
||||
'double' => "some value\n \"some quoted string\" and 'some single quotes one'"
|
||||
)
|
||||
---
|
||||
test: Backslashes
|
||||
yaml: |
|
||||
{ single: 'foo\Var', no-quotes: foo\Var, double: "foo\\Var" }
|
||||
php: |
|
||||
array(
|
||||
'single' => 'foo\Var', 'no-quotes' => 'foo\Var', 'double' => 'foo\Var'
|
||||
)
|
18
vendor/symfony/yaml/Tests/Fixtures/index.yml
vendored
Normal file
18
vendor/symfony/yaml/Tests/Fixtures/index.yml
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
- escapedCharacters
|
||||
- sfComments
|
||||
- sfCompact
|
||||
- sfTests
|
||||
- sfObjects
|
||||
- sfMergeKey
|
||||
- sfQuotes
|
||||
- YtsAnchorAlias
|
||||
- YtsBasicTests
|
||||
- YtsBlockMapping
|
||||
- YtsDocumentSeparator
|
||||
- YtsErrorTests
|
||||
- YtsFlowCollections
|
||||
- YtsFoldedScalars
|
||||
- YtsNullsAndEmpties
|
||||
- YtsSpecificationExamples
|
||||
- YtsTypeTransfers
|
||||
- unindentedCollections
|
76
vendor/symfony/yaml/Tests/Fixtures/sfComments.yml
vendored
Normal file
76
vendor/symfony/yaml/Tests/Fixtures/sfComments.yml
vendored
Normal file
|
@ -0,0 +1,76 @@
|
|||
--- %YAML:1.0
|
||||
test: Comments at the end of a line
|
||||
brief: >
|
||||
Comments at the end of a line
|
||||
yaml: |
|
||||
ex1: "foo # bar"
|
||||
ex2: "foo # bar" # comment
|
||||
ex3: 'foo # bar' # comment
|
||||
ex4: foo # comment
|
||||
ex5: foo # comment with tab before
|
||||
ex6: foo#foo # comment here
|
||||
ex7: foo # ignore me # and me
|
||||
php: |
|
||||
array('ex1' => 'foo # bar', 'ex2' => 'foo # bar', 'ex3' => 'foo # bar', 'ex4' => 'foo', 'ex5' => 'foo', 'ex6' => 'foo#foo', 'ex7' => 'foo')
|
||||
---
|
||||
test: Comments in the middle
|
||||
brief: >
|
||||
Comments in the middle
|
||||
yaml: |
|
||||
foo:
|
||||
# some comment
|
||||
# some comment
|
||||
bar: foo
|
||||
# some comment
|
||||
# some comment
|
||||
php: |
|
||||
array('foo' => array('bar' => 'foo'))
|
||||
---
|
||||
test: Comments on a hash line
|
||||
brief: >
|
||||
Comments on a hash line
|
||||
yaml: |
|
||||
foo: # a comment
|
||||
foo: bar # a comment
|
||||
php: |
|
||||
array('foo' => array('foo' => 'bar'))
|
||||
---
|
||||
test: 'Value starting with a #'
|
||||
brief: >
|
||||
'Value starting with a #'
|
||||
yaml: |
|
||||
foo: '#bar'
|
||||
php: |
|
||||
array('foo' => '#bar')
|
||||
---
|
||||
test: Document starting with a comment and a separator
|
||||
brief: >
|
||||
Commenting before document start is allowed
|
||||
yaml: |
|
||||
# document comment
|
||||
---
|
||||
foo: bar # a comment
|
||||
php: |
|
||||
array('foo' => 'bar')
|
||||
---
|
||||
test: Comment containing a colon on a hash line
|
||||
brief: >
|
||||
Comment containing a colon on a scalar line
|
||||
yaml: 'foo # comment: this is also part of the comment'
|
||||
php: |
|
||||
'foo'
|
||||
---
|
||||
test: 'Hash key containing a #'
|
||||
brief: >
|
||||
'Hash key containing a #'
|
||||
yaml: 'foo#bar: baz'
|
||||
php: |
|
||||
array('foo#bar' => 'baz')
|
||||
---
|
||||
test: 'Hash key ending with a space and a #'
|
||||
brief: >
|
||||
'Hash key ending with a space and a #'
|
||||
yaml: |
|
||||
'foo #': baz
|
||||
php: |
|
||||
array('foo #' => 'baz')
|
159
vendor/symfony/yaml/Tests/Fixtures/sfCompact.yml
vendored
Normal file
159
vendor/symfony/yaml/Tests/Fixtures/sfCompact.yml
vendored
Normal file
|
@ -0,0 +1,159 @@
|
|||
--- %YAML:1.0
|
||||
test: Compact notation
|
||||
brief: |
|
||||
Compact notation for sets of mappings with single element
|
||||
yaml: |
|
||||
---
|
||||
# products purchased
|
||||
- item : Super Hoop
|
||||
- item : Basketball
|
||||
quantity: 1
|
||||
- item:
|
||||
name: Big Shoes
|
||||
nick: Biggies
|
||||
quantity: 1
|
||||
php: |
|
||||
array (
|
||||
array (
|
||||
'item' => 'Super Hoop',
|
||||
),
|
||||
array (
|
||||
'item' => 'Basketball',
|
||||
'quantity' => 1,
|
||||
),
|
||||
array (
|
||||
'item' => array(
|
||||
'name' => 'Big Shoes',
|
||||
'nick' => 'Biggies'
|
||||
),
|
||||
'quantity' => 1
|
||||
)
|
||||
)
|
||||
---
|
||||
test: Compact notation combined with inline notation
|
||||
brief: |
|
||||
Combinations of compact and inline notation are allowed
|
||||
yaml: |
|
||||
---
|
||||
items:
|
||||
- { item: Super Hoop, quantity: 1 }
|
||||
- [ Basketball, Big Shoes ]
|
||||
php: |
|
||||
array (
|
||||
'items' => array (
|
||||
array (
|
||||
'item' => 'Super Hoop',
|
||||
'quantity' => 1,
|
||||
),
|
||||
array (
|
||||
'Basketball',
|
||||
'Big Shoes'
|
||||
)
|
||||
)
|
||||
)
|
||||
--- %YAML:1.0
|
||||
test: Compact notation
|
||||
brief: |
|
||||
Compact notation for sets of mappings with single element
|
||||
yaml: |
|
||||
---
|
||||
# products purchased
|
||||
- item : Super Hoop
|
||||
- item : Basketball
|
||||
quantity: 1
|
||||
- item:
|
||||
name: Big Shoes
|
||||
nick: Biggies
|
||||
quantity: 1
|
||||
php: |
|
||||
array (
|
||||
array (
|
||||
'item' => 'Super Hoop',
|
||||
),
|
||||
array (
|
||||
'item' => 'Basketball',
|
||||
'quantity' => 1,
|
||||
),
|
||||
array (
|
||||
'item' => array(
|
||||
'name' => 'Big Shoes',
|
||||
'nick' => 'Biggies'
|
||||
),
|
||||
'quantity' => 1
|
||||
)
|
||||
)
|
||||
---
|
||||
test: Compact notation combined with inline notation
|
||||
brief: |
|
||||
Combinations of compact and inline notation are allowed
|
||||
yaml: |
|
||||
---
|
||||
items:
|
||||
- { item: Super Hoop, quantity: 1 }
|
||||
- [ Basketball, Big Shoes ]
|
||||
php: |
|
||||
array (
|
||||
'items' => array (
|
||||
array (
|
||||
'item' => 'Super Hoop',
|
||||
'quantity' => 1,
|
||||
),
|
||||
array (
|
||||
'Basketball',
|
||||
'Big Shoes'
|
||||
)
|
||||
)
|
||||
)
|
||||
--- %YAML:1.0
|
||||
test: Compact notation
|
||||
brief: |
|
||||
Compact notation for sets of mappings with single element
|
||||
yaml: |
|
||||
---
|
||||
# products purchased
|
||||
- item : Super Hoop
|
||||
- item : Basketball
|
||||
quantity: 1
|
||||
- item:
|
||||
name: Big Shoes
|
||||
nick: Biggies
|
||||
quantity: 1
|
||||
php: |
|
||||
array (
|
||||
array (
|
||||
'item' => 'Super Hoop',
|
||||
),
|
||||
array (
|
||||
'item' => 'Basketball',
|
||||
'quantity' => 1,
|
||||
),
|
||||
array (
|
||||
'item' => array(
|
||||
'name' => 'Big Shoes',
|
||||
'nick' => 'Biggies'
|
||||
),
|
||||
'quantity' => 1
|
||||
)
|
||||
)
|
||||
---
|
||||
test: Compact notation combined with inline notation
|
||||
brief: |
|
||||
Combinations of compact and inline notation are allowed
|
||||
yaml: |
|
||||
---
|
||||
items:
|
||||
- { item: Super Hoop, quantity: 1 }
|
||||
- [ Basketball, Big Shoes ]
|
||||
php: |
|
||||
array (
|
||||
'items' => array (
|
||||
array (
|
||||
'item' => 'Super Hoop',
|
||||
'quantity' => 1,
|
||||
),
|
||||
array (
|
||||
'Basketball',
|
||||
'Big Shoes'
|
||||
)
|
||||
)
|
||||
)
|
58
vendor/symfony/yaml/Tests/Fixtures/sfMergeKey.yml
vendored
Normal file
58
vendor/symfony/yaml/Tests/Fixtures/sfMergeKey.yml
vendored
Normal file
|
@ -0,0 +1,58 @@
|
|||
--- %YAML:1.0
|
||||
test: Simple In Place Substitution
|
||||
brief: >
|
||||
If you want to reuse an entire alias, only overwriting what is different
|
||||
you can use a << in place substitution. This is not part of the official
|
||||
YAML spec, but a widely implemented extension. See the following URL for
|
||||
details: http://yaml.org/type/merge.html
|
||||
yaml: |
|
||||
foo: &foo
|
||||
a: Steve
|
||||
b: Clark
|
||||
c: Brian
|
||||
bar:
|
||||
a: before
|
||||
d: other
|
||||
<<: *foo
|
||||
b: new
|
||||
x: Oren
|
||||
c:
|
||||
foo: bar
|
||||
foo: ignore
|
||||
bar: foo
|
||||
duplicate:
|
||||
foo: bar
|
||||
foo: ignore
|
||||
foo2: &foo2
|
||||
a: Ballmer
|
||||
ding: &dong [ fi, fei, fo, fam]
|
||||
check:
|
||||
<<:
|
||||
- *foo
|
||||
- *dong
|
||||
isit: tested
|
||||
head:
|
||||
<<: [ *foo , *dong , *foo2 ]
|
||||
taz: &taz
|
||||
a: Steve
|
||||
w:
|
||||
p: 1234
|
||||
nested:
|
||||
<<: *taz
|
||||
d: Doug
|
||||
w: &nestedref
|
||||
p: 12345
|
||||
z:
|
||||
<<: *nestedref
|
||||
php: |
|
||||
array(
|
||||
'foo' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian'),
|
||||
'bar' => array('a' => 'before', 'd' => 'other', 'b' => 'new', 'c' => array('foo' => 'bar', 'bar' => 'foo'), 'x' => 'Oren'),
|
||||
'duplicate' => array('foo' => 'bar'),
|
||||
'foo2' => array('a' => 'Ballmer'),
|
||||
'ding' => array('fi', 'fei', 'fo', 'fam'),
|
||||
'check' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'fi', 'fei', 'fo', 'fam', 'isit' => 'tested'),
|
||||
'head' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', '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))
|
||||
)
|
11
vendor/symfony/yaml/Tests/Fixtures/sfObjects.yml
vendored
Normal file
11
vendor/symfony/yaml/Tests/Fixtures/sfObjects.yml
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
--- %YAML:1.0
|
||||
test: Objects
|
||||
brief: >
|
||||
Comments at the end of a line
|
||||
yaml: |
|
||||
ex1: "foo # bar"
|
||||
ex2: "foo # bar" # comment
|
||||
ex3: 'foo # bar' # comment
|
||||
ex4: foo # comment
|
||||
php: |
|
||||
array('ex1' => 'foo # bar', 'ex2' => 'foo # bar', 'ex3' => 'foo # bar', 'ex4' => 'foo')
|
33
vendor/symfony/yaml/Tests/Fixtures/sfQuotes.yml
vendored
Normal file
33
vendor/symfony/yaml/Tests/Fixtures/sfQuotes.yml
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
--- %YAML:1.0
|
||||
test: Some characters at the beginning of a string must be escaped
|
||||
brief: >
|
||||
Some characters at the beginning of a string must be escaped
|
||||
yaml: |
|
||||
foo: '| bar'
|
||||
php: |
|
||||
array('foo' => '| bar')
|
||||
---
|
||||
test: A key can be a quoted string
|
||||
brief: >
|
||||
A key can be a quoted string
|
||||
yaml: |
|
||||
"foo1": bar
|
||||
'foo2': bar
|
||||
"foo \" bar": bar
|
||||
'foo '' bar': bar
|
||||
'foo3: ': bar
|
||||
"foo4: ": bar
|
||||
foo5: { "foo \" bar: ": bar, 'foo '' bar: ': bar }
|
||||
php: |
|
||||
array(
|
||||
'foo1' => 'bar',
|
||||
'foo2' => 'bar',
|
||||
'foo " bar' => 'bar',
|
||||
'foo \' bar' => 'bar',
|
||||
'foo3: ' => 'bar',
|
||||
'foo4: ' => 'bar',
|
||||
'foo5' => array(
|
||||
'foo " bar: ' => 'bar',
|
||||
'foo \' bar: ' => 'bar',
|
||||
),
|
||||
)
|
149
vendor/symfony/yaml/Tests/Fixtures/sfTests.yml
vendored
Normal file
149
vendor/symfony/yaml/Tests/Fixtures/sfTests.yml
vendored
Normal file
|
@ -0,0 +1,149 @@
|
|||
--- %YAML:1.0
|
||||
test: Multiple quoted string on one line
|
||||
brief: >
|
||||
Multiple quoted string on one line
|
||||
yaml: |
|
||||
stripped_title: { name: "foo bar", help: "bar foo" }
|
||||
php: |
|
||||
array('stripped_title' => array('name' => 'foo bar', 'help' => 'bar foo'))
|
||||
---
|
||||
test: Empty sequence
|
||||
yaml: |
|
||||
foo: [ ]
|
||||
php: |
|
||||
array('foo' => array())
|
||||
---
|
||||
test: Empty value
|
||||
yaml: |
|
||||
foo:
|
||||
php: |
|
||||
array('foo' => null)
|
||||
---
|
||||
test: Inline string parsing
|
||||
brief: >
|
||||
Inline string parsing
|
||||
yaml: |
|
||||
test: ['complex: string', 'another [string]']
|
||||
php: |
|
||||
array('test' => array('complex: string', 'another [string]'))
|
||||
---
|
||||
test: Boolean
|
||||
brief: >
|
||||
Boolean
|
||||
yaml: |
|
||||
- false
|
||||
- true
|
||||
- null
|
||||
- ~
|
||||
- 'false'
|
||||
- 'true'
|
||||
- 'null'
|
||||
- '~'
|
||||
php: |
|
||||
array(
|
||||
false,
|
||||
true,
|
||||
null,
|
||||
null,
|
||||
'false',
|
||||
'true',
|
||||
'null',
|
||||
'~',
|
||||
)
|
||||
---
|
||||
test: Empty lines in literal blocks
|
||||
brief: >
|
||||
Empty lines in literal blocks
|
||||
yaml: |
|
||||
foo:
|
||||
bar: |
|
||||
foo
|
||||
|
||||
|
||||
|
||||
bar
|
||||
php: |
|
||||
array('foo' => array('bar' => "foo\n\n\n \nbar\n"))
|
||||
---
|
||||
test: Empty lines in folded blocks
|
||||
brief: >
|
||||
Empty lines in folded blocks
|
||||
yaml: |
|
||||
foo:
|
||||
bar: >
|
||||
|
||||
foo
|
||||
|
||||
|
||||
bar
|
||||
php: |
|
||||
array('foo' => array('bar' => "\nfoo\n\nbar\n"))
|
||||
---
|
||||
test: IP addresses
|
||||
brief: >
|
||||
IP addresses
|
||||
yaml: |
|
||||
foo: 10.0.0.2
|
||||
php: |
|
||||
array('foo' => '10.0.0.2')
|
||||
---
|
||||
test: A sequence with an embedded mapping
|
||||
brief: >
|
||||
A sequence with an embedded mapping
|
||||
yaml: |
|
||||
- foo
|
||||
- bar: { bar: foo }
|
||||
php: |
|
||||
array('foo', array('bar' => array('bar' => 'foo')))
|
||||
---
|
||||
test: A sequence with an unordered array
|
||||
brief: >
|
||||
A sequence with an unordered array
|
||||
yaml: |
|
||||
1: foo
|
||||
0: bar
|
||||
php: |
|
||||
array(1 => 'foo', 0 => 'bar')
|
||||
---
|
||||
test: Octal
|
||||
brief: as in spec example 2.19, octal value is converted
|
||||
yaml: |
|
||||
foo: 0123
|
||||
php: |
|
||||
array('foo' => 83)
|
||||
---
|
||||
test: Octal strings
|
||||
brief: Octal notation in a string must remain a string
|
||||
yaml: |
|
||||
foo: "0123"
|
||||
php: |
|
||||
array('foo' => '0123')
|
||||
---
|
||||
test: Octal strings
|
||||
brief: Octal notation in a string must remain a string
|
||||
yaml: |
|
||||
foo: '0123'
|
||||
php: |
|
||||
array('foo' => '0123')
|
||||
---
|
||||
test: Octal strings
|
||||
brief: Octal notation in a string must remain a string
|
||||
yaml: |
|
||||
foo: |
|
||||
0123
|
||||
php: |
|
||||
array('foo' => "0123\n")
|
||||
---
|
||||
test: Document as a simple hash
|
||||
brief: Document as a simple hash
|
||||
yaml: |
|
||||
{ foo: bar }
|
||||
php: |
|
||||
array('foo' => 'bar')
|
||||
---
|
||||
test: Document as a simple array
|
||||
brief: Document as a simple array
|
||||
yaml: |
|
||||
[ foo, bar ]
|
||||
php: |
|
||||
array('foo', 'bar')
|
82
vendor/symfony/yaml/Tests/Fixtures/unindentedCollections.yml
vendored
Normal file
82
vendor/symfony/yaml/Tests/Fixtures/unindentedCollections.yml
vendored
Normal file
|
@ -0,0 +1,82 @@
|
|||
--- %YAML:1.0
|
||||
test: Unindented collection
|
||||
brief: >
|
||||
Unindented collection
|
||||
yaml: |
|
||||
collection:
|
||||
- item1
|
||||
- item2
|
||||
- item3
|
||||
php: |
|
||||
array('collection' => array('item1', 'item2', 'item3'))
|
||||
---
|
||||
test: Nested unindented collection (two levels)
|
||||
brief: >
|
||||
Nested unindented collection
|
||||
yaml: |
|
||||
collection:
|
||||
key:
|
||||
- a
|
||||
- b
|
||||
- c
|
||||
php: |
|
||||
array('collection' => array('key' => array('a', 'b', 'c')))
|
||||
---
|
||||
test: Nested unindented collection (three levels)
|
||||
brief: >
|
||||
Nested unindented collection
|
||||
yaml: |
|
||||
collection:
|
||||
key:
|
||||
subkey:
|
||||
- one
|
||||
- two
|
||||
- three
|
||||
php: |
|
||||
array('collection' => array('key' => array('subkey' => array('one', 'two', 'three'))))
|
||||
---
|
||||
test: Key/value after unindented collection (1)
|
||||
brief: >
|
||||
Key/value after unindented collection (1)
|
||||
yaml: |
|
||||
collection:
|
||||
key:
|
||||
- a
|
||||
- b
|
||||
- c
|
||||
foo: bar
|
||||
php: |
|
||||
array('collection' => array('key' => array('a', 'b', 'c')), 'foo' => 'bar')
|
||||
---
|
||||
test: Key/value after unindented collection (at the same level)
|
||||
brief: >
|
||||
Key/value after unindented collection
|
||||
yaml: |
|
||||
collection:
|
||||
key:
|
||||
- a
|
||||
- b
|
||||
- c
|
||||
foo: bar
|
||||
php: |
|
||||
array('collection' => array('key' => array('a', 'b', 'c'), 'foo' => 'bar'))
|
||||
---
|
||||
test: Shortcut Key after unindented collection
|
||||
brief: >
|
||||
Key/value after unindented collection
|
||||
yaml: |
|
||||
collection:
|
||||
- key: foo
|
||||
foo: bar
|
||||
php: |
|
||||
array('collection' => array(array('key' => 'foo', 'foo' => 'bar')))
|
||||
---
|
||||
test: Shortcut Key after unindented collection with custom spaces
|
||||
brief: >
|
||||
Key/value after unindented collection
|
||||
yaml: |
|
||||
collection:
|
||||
- key: foo
|
||||
foo: bar
|
||||
php: |
|
||||
array('collection' => array(array('key' => 'foo', 'foo' => 'bar')))
|
429
vendor/symfony/yaml/Tests/InlineTest.php
vendored
Normal file
429
vendor/symfony/yaml/Tests/InlineTest.php
vendored
Normal file
|
@ -0,0 +1,429 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Yaml\Tests;
|
||||
|
||||
use Symfony\Component\Yaml\Inline;
|
||||
|
||||
class InlineTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider getTestsForParse
|
||||
*/
|
||||
public function testParse($yaml, $value)
|
||||
{
|
||||
$this->assertSame($value, Inline::parse($yaml), sprintf('::parse() converts an inline YAML to a PHP structure (%s)', $yaml));
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getTestsForParseWithMapObjects
|
||||
*/
|
||||
public function testParseWithMapObjects($yaml, $value)
|
||||
{
|
||||
$actual = Inline::parse($yaml, false, false, true);
|
||||
|
||||
$this->assertSame(serialize($value), serialize($actual));
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getTestsForDump
|
||||
*/
|
||||
public function testDump($yaml, $value)
|
||||
{
|
||||
$this->assertEquals($yaml, Inline::dump($value), sprintf('::dump() converts a PHP structure to an inline YAML (%s)', $yaml));
|
||||
|
||||
$this->assertSame($value, Inline::parse(Inline::dump($value)), 'check consistency');
|
||||
}
|
||||
|
||||
public function testDumpNumericValueWithLocale()
|
||||
{
|
||||
$locale = setlocale(LC_NUMERIC, 0);
|
||||
if (false === $locale) {
|
||||
$this->markTestSkipped('Your platform does not support locales.');
|
||||
}
|
||||
|
||||
try {
|
||||
$requiredLocales = array('fr_FR.UTF-8', 'fr_FR.UTF8', 'fr_FR.utf-8', 'fr_FR.utf8', 'French_France.1252');
|
||||
if (false === setlocale(LC_NUMERIC, $requiredLocales)) {
|
||||
$this->markTestSkipped('Could not set any of required locales: '.implode(', ', $requiredLocales));
|
||||
}
|
||||
|
||||
$this->assertEquals('1.2', Inline::dump(1.2));
|
||||
$this->assertContains('fr', strtolower(setlocale(LC_NUMERIC, 0)));
|
||||
} finally {
|
||||
setlocale(LC_NUMERIC, $locale);
|
||||
}
|
||||
}
|
||||
|
||||
public function testHashStringsResemblingExponentialNumericsShouldNotBeChangedToINF()
|
||||
{
|
||||
$value = '686e444';
|
||||
|
||||
$this->assertSame($value, Inline::parse(Inline::dump($value)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
|
||||
* @expectedExceptionMessage Found unknown escape character "\V".
|
||||
*/
|
||||
public function testParseScalarWithNonEscapedBlackslashShouldThrowException()
|
||||
{
|
||||
Inline::parse('"Foo\Var"');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
|
||||
*/
|
||||
public function testParseScalarWithNonEscapedBlackslashAtTheEndShouldThrowException()
|
||||
{
|
||||
Inline::parse('"Foo\\"');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
|
||||
*/
|
||||
public function testParseScalarWithIncorrectlyQuotedStringShouldThrowException()
|
||||
{
|
||||
$value = "'don't do somthin' like that'";
|
||||
Inline::parse($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
|
||||
*/
|
||||
public function testParseScalarWithIncorrectlyDoubleQuotedStringShouldThrowException()
|
||||
{
|
||||
$value = '"don"t do somthin" like that"';
|
||||
Inline::parse($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
|
||||
*/
|
||||
public function testParseInvalidMappingKeyShouldThrowException()
|
||||
{
|
||||
$value = '{ "foo " bar": "bar" }';
|
||||
Inline::parse($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
|
||||
*/
|
||||
public function testParseInvalidMappingShouldThrowException()
|
||||
{
|
||||
Inline::parse('[foo] bar');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
|
||||
*/
|
||||
public function testParseInvalidSequenceShouldThrowException()
|
||||
{
|
||||
Inline::parse('{ foo: bar } bar');
|
||||
}
|
||||
|
||||
public function testParseScalarWithCorrectlyQuotedStringShouldReturnString()
|
||||
{
|
||||
$value = "'don''t do somthin'' like that'";
|
||||
$expect = "don't do somthin' like that";
|
||||
|
||||
$this->assertSame($expect, Inline::parseScalar($value));
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getDataForParseReferences
|
||||
*/
|
||||
public function testParseReferences($yaml, $expected)
|
||||
{
|
||||
$this->assertSame($expected, Inline::parse($yaml, false, false, false, array('var' => 'var-value')));
|
||||
}
|
||||
|
||||
public function getDataForParseReferences()
|
||||
{
|
||||
return array(
|
||||
'scalar' => array('*var', 'var-value'),
|
||||
'list' => array('[ *var ]', array('var-value')),
|
||||
'list-in-list' => array('[[ *var ]]', array(array('var-value'))),
|
||||
'map-in-list' => array('[ { key: *var } ]', array(array('key' => 'var-value'))),
|
||||
'embedded-mapping-in-list' => array('[ key: *var ]', array(array('key' => 'var-value'))),
|
||||
'map' => array('{ key: *var }', array('key' => 'var-value')),
|
||||
'list-in-map' => array('{ key: [*var] }', array('key' => array('var-value'))),
|
||||
'map-in-map' => array('{ foo: { bar: *var } }', array('foo' => array('bar' => 'var-value'))),
|
||||
);
|
||||
}
|
||||
|
||||
public function testParseMapReferenceInSequence()
|
||||
{
|
||||
$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.
|
||||
*/
|
||||
public function testParseUnquotedAsterisk()
|
||||
{
|
||||
Inline::parse('{ foo: * }');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
|
||||
* @expectedExceptionMessage A reference must contain at least one character.
|
||||
*/
|
||||
public function testParseUnquotedAsteriskFollowedByAComment()
|
||||
{
|
||||
Inline::parse('{ foo: * #foo }');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getReservedIndicators
|
||||
* @expectedException Symfony\Component\Yaml\Exception\ParseException
|
||||
* @expectedExceptionMessage cannot start a plain scalar; you need to quote the scalar.
|
||||
*/
|
||||
public function testParseUnquotedScalarStartingWithReservedIndicator($indicator)
|
||||
{
|
||||
Inline::parse(sprintf('{ foo: %sfoo }', $indicator));
|
||||
}
|
||||
|
||||
public function getReservedIndicators()
|
||||
{
|
||||
return array(array('@'), array('`'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getScalarIndicators
|
||||
* @expectedException Symfony\Component\Yaml\Exception\ParseException
|
||||
* @expectedExceptionMessage cannot start a plain scalar; you need to quote the scalar.
|
||||
*/
|
||||
public function testParseUnquotedScalarStartingWithScalarIndicator($indicator)
|
||||
{
|
||||
Inline::parse(sprintf('{ foo: %sfoo }', $indicator));
|
||||
}
|
||||
|
||||
public function getScalarIndicators()
|
||||
{
|
||||
return array(array('|'), array('>'));
|
||||
}
|
||||
|
||||
public function getTestsForParse()
|
||||
{
|
||||
return array(
|
||||
array('', ''),
|
||||
array('null', null),
|
||||
array('false', false),
|
||||
array('true', true),
|
||||
array('12', 12),
|
||||
array('-12', -12),
|
||||
array('"quoted string"', 'quoted string'),
|
||||
array("'quoted string'", 'quoted string'),
|
||||
array('12.30e+02', 12.30e+02),
|
||||
array('0x4D2', 0x4D2),
|
||||
array('02333', 02333),
|
||||
array('.Inf', -log(0)),
|
||||
array('-.Inf', log(0)),
|
||||
array("'686e444'", '686e444'),
|
||||
array('686e444', 646e444),
|
||||
array('123456789123456789123456789123456789', '123456789123456789123456789123456789'),
|
||||
array('"foo\r\nbar"', "foo\r\nbar"),
|
||||
array("'foo#bar'", 'foo#bar'),
|
||||
array("'foo # bar'", 'foo # bar'),
|
||||
array("'#cfcfcf'", '#cfcfcf'),
|
||||
array('::form_base.html.twig', '::form_base.html.twig'),
|
||||
|
||||
// Pre-YAML-1.2 booleans
|
||||
array("'y'", 'y'),
|
||||
array("'n'", 'n'),
|
||||
array("'yes'", 'yes'),
|
||||
array("'no'", 'no'),
|
||||
array("'on'", 'on'),
|
||||
array("'off'", 'off'),
|
||||
|
||||
array('2007-10-30', gmmktime(0, 0, 0, 10, 30, 2007)),
|
||||
array('2007-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 2007)),
|
||||
array('2007-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 2007)),
|
||||
array('1960-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 1960)),
|
||||
array('1730-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 1730)),
|
||||
|
||||
array('"a \\"string\\" with \'quoted strings inside\'"', 'a "string" with \'quoted strings inside\''),
|
||||
array("'a \"string\" with ''quoted strings inside'''", 'a "string" with \'quoted strings inside\''),
|
||||
|
||||
// sequences
|
||||
// urls are no key value mapping. see #3609. Valid yaml "key: value" mappings require a space after the colon
|
||||
array('[foo, http://urls.are/no/mappings, false, null, 12]', array('foo', 'http://urls.are/no/mappings', false, null, 12)),
|
||||
array('[ foo , bar , false , null , 12 ]', array('foo', 'bar', false, null, 12)),
|
||||
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)),
|
||||
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')),
|
||||
array('{\'foo: \': \'bar\', "bar: ": \'foo: bar\'}', array('foo: ' => 'bar', 'bar: ' => 'foo: bar')),
|
||||
|
||||
// nested sequences and mappings
|
||||
array('[foo, [bar, foo]]', array('foo', array('bar', 'foo'))),
|
||||
array('[foo, {bar: foo}]', array('foo', array('bar' => 'foo'))),
|
||||
array('{ foo: {bar: foo} }', array('foo' => array('bar' => 'foo'))),
|
||||
array('{ foo: [bar, foo] }', array('foo' => array('bar', 'foo'))),
|
||||
|
||||
array('[ foo, [ bar, foo ] ]', array('foo', array('bar', 'foo'))),
|
||||
|
||||
array('[{ foo: {bar: foo} }]', array(array('foo' => array('bar' => 'foo')))),
|
||||
|
||||
array('[foo, [bar, [foo, [bar, foo]], foo]]', array('foo', array('bar', array('foo', array('bar', 'foo')), 'foo'))),
|
||||
|
||||
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, bar: { foo: bar }]', array('foo', '1' => array('bar' => array('foo' => 'bar')))),
|
||||
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')),
|
||||
);
|
||||
}
|
||||
|
||||
public function getTestsForParseWithMapObjects()
|
||||
{
|
||||
return array(
|
||||
array('', ''),
|
||||
array('null', null),
|
||||
array('false', false),
|
||||
array('true', true),
|
||||
array('12', 12),
|
||||
array('-12', -12),
|
||||
array('"quoted string"', 'quoted string'),
|
||||
array("'quoted string'", 'quoted string'),
|
||||
array('12.30e+02', 12.30e+02),
|
||||
array('0x4D2', 0x4D2),
|
||||
array('02333', 02333),
|
||||
array('.Inf', -log(0)),
|
||||
array('-.Inf', log(0)),
|
||||
array("'686e444'", '686e444'),
|
||||
array('686e444', 646e444),
|
||||
array('123456789123456789123456789123456789', '123456789123456789123456789123456789'),
|
||||
array('"foo\r\nbar"', "foo\r\nbar"),
|
||||
array("'foo#bar'", 'foo#bar'),
|
||||
array("'foo # bar'", 'foo # bar'),
|
||||
array("'#cfcfcf'", '#cfcfcf'),
|
||||
array('::form_base.html.twig', '::form_base.html.twig'),
|
||||
|
||||
array('2007-10-30', gmmktime(0, 0, 0, 10, 30, 2007)),
|
||||
array('2007-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 2007)),
|
||||
array('2007-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 2007)),
|
||||
array('1960-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 1960)),
|
||||
array('1730-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 1730)),
|
||||
|
||||
array('"a \\"string\\" with \'quoted strings inside\'"', 'a "string" with \'quoted strings inside\''),
|
||||
array("'a \"string\" with ''quoted strings inside'''", 'a "string" with \'quoted strings inside\''),
|
||||
|
||||
// sequences
|
||||
// urls are no key value mapping. see #3609. Valid yaml "key: value" mappings require a space after the colon
|
||||
array('[foo, http://urls.are/no/mappings, false, null, 12]', array('foo', 'http://urls.are/no/mappings', false, null, 12)),
|
||||
array('[ foo , bar , false , null , 12 ]', array('foo', 'bar', false, null, 12)),
|
||||
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)),
|
||||
array('{ foo : bar, bar : foo, false : false, null : null, integer : 12 }', (object) array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12)),
|
||||
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')),
|
||||
array('{\'foo: \': \'bar\', "bar: ": \'foo: bar\'}', (object) array('foo: ' => 'bar', 'bar: ' => 'foo: bar')),
|
||||
|
||||
// nested sequences and mappings
|
||||
array('[foo, [bar, foo]]', array('foo', array('bar', 'foo'))),
|
||||
array('[foo, {bar: foo}]', array('foo', (object) array('bar' => 'foo'))),
|
||||
array('{ foo: {bar: foo} }', (object) array('foo' => (object) array('bar' => 'foo'))),
|
||||
array('{ foo: [bar, foo] }', (object) array('foo' => array('bar', 'foo'))),
|
||||
|
||||
array('[ foo, [ bar, foo ] ]', array('foo', array('bar', 'foo'))),
|
||||
|
||||
array('[{ foo: {bar: foo} }]', array((object) array('foo' => (object) array('bar' => 'foo')))),
|
||||
|
||||
array('[foo, [bar, [foo, [bar, foo]], foo]]', array('foo', array('bar', array('foo', array('bar', 'foo')), 'foo'))),
|
||||
|
||||
array('[foo, {bar: foo, foo: [foo, {bar: foo}]}, [foo, {bar: foo}]]', array('foo', (object) array('bar' => 'foo', 'foo' => array('foo', (object) array('bar' => 'foo'))), array('foo', (object) array('bar' => 'foo')))),
|
||||
|
||||
array('[foo, bar: { foo: bar }]', array('foo', '1' => (object) array('bar' => (object) array('foo' => 'bar')))),
|
||||
array('[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', array('foo', '@foo.baz', (object) array('%foo%' => 'foo is %foo%', 'bar' => '%foo%'), true, '@service_container')),
|
||||
|
||||
array('{}', new \stdClass()),
|
||||
array('{ foo : bar, bar : {} }', (object) array('foo' => 'bar', 'bar' => new \stdClass())),
|
||||
array('{ foo : [], bar : {} }', (object) array('foo' => array(), 'bar' => new \stdClass())),
|
||||
array('{foo: \'bar\', bar: {} }', (object) array('foo' => 'bar', 'bar' => new \stdClass())),
|
||||
array('{\'foo\': \'bar\', "bar": {}}', (object) array('foo' => 'bar', 'bar' => new \stdClass())),
|
||||
array('{\'foo\': \'bar\', "bar": \'{}\'}', (object) array('foo' => 'bar', 'bar' => '{}')),
|
||||
|
||||
array('[foo, [{}, {}]]', array('foo', array(new \stdClass(), new \stdClass()))),
|
||||
array('[foo, [[], {}]]', array('foo', array(array(), new \stdClass()))),
|
||||
array('[foo, [[{}, {}], {}]]', array('foo', array(array(new \stdClass(), new \stdClass()), new \stdClass()))),
|
||||
array('[foo, {bar: {}}]', array('foo', '1' => (object) array('bar' => new \stdClass()))),
|
||||
);
|
||||
}
|
||||
|
||||
public function getTestsForDump()
|
||||
{
|
||||
return array(
|
||||
array('null', null),
|
||||
array('false', false),
|
||||
array('true', true),
|
||||
array('12', 12),
|
||||
array("'quoted string'", 'quoted string'),
|
||||
array('!!float 1230', 12.30e+02),
|
||||
array('1234', 0x4D2),
|
||||
array('1243', 02333),
|
||||
array('.Inf', -log(0)),
|
||||
array('-.Inf', log(0)),
|
||||
array("'686e444'", '686e444'),
|
||||
array('"foo\r\nbar"', "foo\r\nbar"),
|
||||
array("'foo#bar'", 'foo#bar'),
|
||||
array("'foo # bar'", 'foo # bar'),
|
||||
array("'#cfcfcf'", '#cfcfcf'),
|
||||
|
||||
array("'a \"string\" with ''quoted strings inside'''", 'a "string" with \'quoted strings inside\''),
|
||||
|
||||
array("'-dash'", '-dash'),
|
||||
array("'-'", '-'),
|
||||
|
||||
// Pre-YAML-1.2 booleans
|
||||
array("'y'", 'y'),
|
||||
array("'n'", 'n'),
|
||||
array("'yes'", 'yes'),
|
||||
array("'no'", 'no'),
|
||||
array("'on'", 'on'),
|
||||
array("'off'", 'off'),
|
||||
|
||||
// sequences
|
||||
array('[foo, bar, false, null, 12]', array('foo', 'bar', false, null, 12)),
|
||||
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)),
|
||||
array('{ foo: bar, bar: \'foo: bar\' }', array('foo' => 'bar', 'bar' => 'foo: bar')),
|
||||
|
||||
// nested sequences and mappings
|
||||
array('[foo, [bar, foo]]', array('foo', array('bar', 'foo'))),
|
||||
|
||||
array('[foo, [bar, [foo, [bar, foo]], foo]]', array('foo', array('bar', array('foo', array('bar', 'foo')), 'foo'))),
|
||||
|
||||
array('{ foo: { bar: foo } }', array('foo' => array('bar' => 'foo'))),
|
||||
|
||||
array('[foo, { bar: foo }]', array('foo', array('bar' => 'foo'))),
|
||||
|
||||
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')),
|
||||
);
|
||||
}
|
||||
}
|
33
vendor/symfony/yaml/Tests/ParseExceptionTest.php
vendored
Normal file
33
vendor/symfony/yaml/Tests/ParseExceptionTest.php
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Yaml\Tests;
|
||||
|
||||
use Symfony\Component\Yaml\Exception\ParseException;
|
||||
|
||||
class ParseExceptionTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testGetMessage()
|
||||
{
|
||||
$exception = new ParseException('Error message', 42, 'foo: bar', '/var/www/app/config.yml');
|
||||
$message = 'Error message in "/var/www/app/config.yml" at line 42 (near "foo: bar")';
|
||||
|
||||
$this->assertEquals($message, $exception->getMessage());
|
||||
}
|
||||
|
||||
public function testGetMessageWithUnicodeInFilename()
|
||||
{
|
||||
$exception = new ParseException('Error message', 42, 'foo: bar', 'äöü.yml');
|
||||
$message = 'Error message in "äöü.yml" at line 42 (near "foo: bar")';
|
||||
|
||||
$this->assertEquals($message, $exception->getMessage());
|
||||
}
|
||||
}
|
1091
vendor/symfony/yaml/Tests/ParserTest.php
vendored
Normal file
1091
vendor/symfony/yaml/Tests/ParserTest.php
vendored
Normal file
File diff suppressed because it is too large
Load diff
43
vendor/symfony/yaml/Tests/YamlTest.php
vendored
Normal file
43
vendor/symfony/yaml/Tests/YamlTest.php
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Yaml\Tests;
|
||||
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
||||
class YamlTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testParseAndDump()
|
||||
{
|
||||
$data = array('lorem' => 'ipsum', 'dolor' => 'sit');
|
||||
$yml = Yaml::dump($data);
|
||||
$parsed = Yaml::parse($yml);
|
||||
$this->assertEquals($data, $parsed);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @expectedExceptionMessage The indentation must be greater than zero
|
||||
*/
|
||||
public function testZeroIndentationThrowsException()
|
||||
{
|
||||
Yaml::dump(array('lorem' => 'ipsum', 'dolor' => 'sit'), 2, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @expectedExceptionMessage The indentation must be greater than zero
|
||||
*/
|
||||
public function testNegativeIndentationThrowsException()
|
||||
{
|
||||
Yaml::dump(array('lorem' => 'ipsum', 'dolor' => 'sit'), 2, -4);
|
||||
}
|
||||
}
|
Reference in a new issue