Kohana v3.3.0
This commit is contained in:
166
vendor/symfony/yaml/Symfony/Component/Yaml/Tests/DumperTest.php
vendored
Normal file
166
vendor/symfony/yaml/Symfony/Component/Yaml/Tests/DumperTest.php
vendored
Normal file
@@ -0,0 +1,166 @@
|
||||
<?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;
|
||||
use Symfony\Component\Yaml\Parser;
|
||||
use Symfony\Component\Yaml\Dumper;
|
||||
|
||||
class DumperTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $parser;
|
||||
protected $dumper;
|
||||
protected $path;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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 {
|
||||
$expected = eval('return '.trim($test['php']).';');
|
||||
|
||||
$this->assertEquals($expected, $this->parser->parse($this->dumper->dump($expected, 10)), $test['test']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function testInlineLevel()
|
||||
{
|
||||
// inline level
|
||||
$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'),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$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($array, -10), '->dump() takes an inline level argument');
|
||||
$this->assertEquals($expected, $this->dumper->dump($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($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($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($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($array, 4), '->dump() takes an inline level argument');
|
||||
$this->assertEquals($expected, $this->dumper->dump($array, 10), '->dump() takes an inline level argument');
|
||||
}
|
||||
|
||||
public function testObjectsSupport()
|
||||
{
|
||||
$a = array('foo' => new A(), 'bar' => 1);
|
||||
|
||||
$this->assertEquals('{ foo: !!php/object:O:30:"Symfony\Component\Yaml\Tests\A":1:{s:1:"a";s:3:"foo";}, bar: 1 }', $this->dumper->dump($a), '->dump() is able to dump objects');
|
||||
}
|
||||
}
|
||||
|
||||
class A
|
||||
{
|
||||
public $a = 'foo';
|
||||
}
|
31
vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/YtsAnchorAlias.yml
vendored
Normal file
31
vendor/symfony/yaml/Symfony/Component/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'))
|
178
vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/YtsBasicTests.yml
vendored
Normal file
178
vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/YtsBasicTests.yml
vendored
Normal file
@@ -0,0 +1,178 @@
|
||||
--- %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: 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 seperating 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/Symfony/Component/Yaml/Tests/Fixtures/YtsBlockMapping.yml
vendored
Normal file
51
vendor/symfony/yaml/Symfony/Component/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/Symfony/Component/Yaml/Tests/Fixtures/YtsDocumentSeparator.yml
vendored
Normal file
85
vendor/symfony/yaml/Symfony/Component/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 explicity 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/Symfony/Component/Yaml/Tests/Fixtures/YtsErrorTests.yml
vendored
Normal file
25
vendor/symfony/yaml/Symfony/Component/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/Symfony/Component/Yaml/Tests/Fixtures/YtsFlowCollections.yml
vendored
Normal file
60
vendor/symfony/yaml/Symfony/Component/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/Symfony/Component/Yaml/Tests/Fixtures/YtsFoldedScalars.yml
vendored
Normal file
176
vendor/symfony/yaml/Symfony/Component/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/Symfony/Component/Yaml/Tests/Fixtures/YtsNullsAndEmpties.yml
vendored
Normal file
45
vendor/symfony/yaml/Symfony/Component/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: |
|
||||
''
|
1695
vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/YtsSpecificationExamples.yml
vendored
Normal file
1695
vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/YtsSpecificationExamples.yml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
244
vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/YtsTypeTransfers.yml
vendored
Normal file
244
vendor/symfony/yaml/Symfony/Component/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,
|
||||
'negative one-thousand' => -1000
|
||||
)
|
||||
---
|
||||
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 seperated: 2001-12-14 21:59:43.10 -05:00
|
||||
php: |
|
||||
array(
|
||||
'iso8601' => mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" ),
|
||||
'space seperated' => 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/Symfony/Component/Yaml/Tests/Fixtures/embededPhp.yml
vendored
Normal file
1
vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/embededPhp.yml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
value: <?php echo 1 + 2 + 3 ?>
|
139
vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/escapedCharacters.yml
vendored
Normal file
139
vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/escapedCharacters.yml
vendored
Normal file
@@ -0,0 +1,139 @@
|
||||
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"
|
18
vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/index.yml
vendored
Normal file
18
vendor/symfony/yaml/Symfony/Component/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
|
51
vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/sfComments.yml
vendored
Normal file
51
vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/sfComments.yml
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
--- %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
|
||||
php: |
|
||||
array('ex1' => 'foo # bar', 'ex2' => 'foo # bar', 'ex3' => 'foo # bar', 'ex4' => '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')
|
159
vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/sfCompact.yml
vendored
Normal file
159
vendor/symfony/yaml/Symfony/Component/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'
|
||||
)
|
||||
)
|
||||
)
|
27
vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/sfMergeKey.yml
vendored
Normal file
27
vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/sfMergeKey.yml
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
--- %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: &bar
|
||||
<<: *foo
|
||||
x: Oren
|
||||
foo2: &foo2
|
||||
a: Ballmer
|
||||
ding: &dong [ fi, fei, fo, fam]
|
||||
check:
|
||||
<<:
|
||||
- *foo
|
||||
- *dong
|
||||
isit: tested
|
||||
head:
|
||||
<<: [ *foo , *dong , *foo2 ]
|
||||
php: |
|
||||
array('foo' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian'), 'bar' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'x' => 'Oren'), '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' => 'Ballmer', 'b' => 'Clark', 'c' => 'Brian', 'fi', 'fei', 'fo', 'fam'))
|
11
vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/sfObjects.yml
vendored
Normal file
11
vendor/symfony/yaml/Symfony/Component/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/Symfony/Component/Yaml/Tests/Fixtures/sfQuotes.yml
vendored
Normal file
33
vendor/symfony/yaml/Symfony/Component/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',
|
||||
),
|
||||
)
|
135
vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/sfTests.yml
vendored
Normal file
135
vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/sfTests.yml
vendored
Normal file
@@ -0,0 +1,135 @@
|
||||
--- %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 folded blocks
|
||||
brief: >
|
||||
Empty lines in folded blocks
|
||||
yaml: |
|
||||
foo:
|
||||
bar: |
|
||||
foo
|
||||
|
||||
|
||||
|
||||
bar
|
||||
php: |
|
||||
array('foo' => array('bar' => "foo\n\n\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')
|
62
vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/unindentedCollections.yml
vendored
Normal file
62
vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/unindentedCollections.yml
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
--- %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'))
|
211
vendor/symfony/yaml/Symfony/Component/Yaml/Tests/InlineTest.php
vendored
Normal file
211
vendor/symfony/yaml/Symfony/Component/Yaml/Tests/InlineTest.php
vendored
Normal file
@@ -0,0 +1,211 @@
|
||||
<?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;
|
||||
use Symfony\Component\Yaml\Inline;
|
||||
|
||||
class InlineTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testParse()
|
||||
{
|
||||
foreach ($this->getTestsForParse() as $yaml => $value) {
|
||||
$this->assertEquals($value, Inline::parse($yaml), sprintf('::parse() converts an inline YAML to a PHP structure (%s)', $yaml));
|
||||
}
|
||||
}
|
||||
|
||||
public function testDump()
|
||||
{
|
||||
$testsForDump = $this->getTestsForDump();
|
||||
|
||||
foreach ($testsForDump as $yaml => $value) {
|
||||
$this->assertEquals($yaml, Inline::dump($value), sprintf('::dump() converts a PHP structure to an inline YAML (%s)', $yaml));
|
||||
}
|
||||
|
||||
foreach ($this->getTestsForParse() as $yaml => $value) {
|
||||
$this->assertEquals($value, Inline::parse(Inline::dump($value)), 'check consistency');
|
||||
}
|
||||
|
||||
foreach ($testsForDump as $yaml => $value) {
|
||||
$this->assertEquals($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.');
|
||||
}
|
||||
|
||||
$required_locales = array('fr_FR.UTF-8', 'fr_FR.UTF8', 'fr_FR.utf-8', 'fr_FR.utf8', 'French_France.1252');
|
||||
if (false === setlocale(LC_ALL, $required_locales)) {
|
||||
$this->markTestSkipped('Could not set any of required locales: ' . implode(", ", $required_locales));
|
||||
}
|
||||
|
||||
$this->assertEquals('1.2', Inline::dump(1.2));
|
||||
$this->assertContains('fr', strtolower(setlocale(LC_NUMERIC, 0)));
|
||||
|
||||
setlocale(LC_ALL, $locale);
|
||||
}
|
||||
|
||||
public function testHashStringsResemblingExponentialNumericsShouldNotBeChangedToINF()
|
||||
{
|
||||
$value = '686e444';
|
||||
|
||||
$this->assertSame($value, Inline::parse(Inline::dump($value)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @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);
|
||||
}
|
||||
|
||||
public function testParseScalarWithCorrectlyQuotedStringShouldReturnString()
|
||||
{
|
||||
$value = "'don''t do somthin'' like that'";
|
||||
$expect = "don't do somthin' like that";
|
||||
|
||||
$this->assertSame($expect, Inline::parseScalar($value));
|
||||
}
|
||||
|
||||
protected function getTestsForParse()
|
||||
{
|
||||
return array(
|
||||
'' => '',
|
||||
'null' => null,
|
||||
'false' => false,
|
||||
'true' => true,
|
||||
'12' => 12,
|
||||
'"quoted string"' => 'quoted string',
|
||||
"'quoted string'" => 'quoted string',
|
||||
'12.30e+02' => 12.30e+02,
|
||||
'0x4D2' => 0x4D2,
|
||||
'02333' => 02333,
|
||||
'.Inf' => -log(0),
|
||||
'-.Inf' => log(0),
|
||||
"'686e444'" => '686e444',
|
||||
'686e444' => 646e444,
|
||||
'123456789123456789' => '123456789123456789',
|
||||
'"foo\r\nbar"' => "foo\r\nbar",
|
||||
"'foo#bar'" => 'foo#bar',
|
||||
"'foo # bar'" => 'foo # bar',
|
||||
"'#cfcfcf'" => '#cfcfcf',
|
||||
'::form_base.html.twig' => '::form_base.html.twig',
|
||||
|
||||
'2007-10-30' => mktime(0, 0, 0, 10, 30, 2007),
|
||||
'2007-10-30T02:59:43Z' => gmmktime(2, 59, 43, 10, 30, 2007),
|
||||
'2007-10-30 02:59:43 Z' => gmmktime(2, 59, 43, 10, 30, 2007),
|
||||
|
||||
'"a \\"string\\" with \'quoted strings inside\'"' => 'a "string" with \'quoted strings inside\'',
|
||||
"'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
|
||||
'[foo, http://urls.are/no/mappings, false, null, 12]' => array('foo', 'http://urls.are/no/mappings', false, null, 12),
|
||||
'[ foo , bar , false , null , 12 ]' => array('foo', 'bar', false, null, 12),
|
||||
'[\'foo,bar\', \'foo bar\']' => array('foo,bar', 'foo bar'),
|
||||
|
||||
// mappings
|
||||
'{foo:bar,bar:foo,false:false,null:null,integer:12}' => array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12),
|
||||
'{ foo : bar, bar : foo, false : false, null : null, integer : 12 }' => array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12),
|
||||
'{foo: \'bar\', bar: \'foo: bar\'}' => array('foo' => 'bar', 'bar' => 'foo: bar'),
|
||||
'{\'foo\': \'bar\', "bar": \'foo: bar\'}' => array('foo' => 'bar', 'bar' => 'foo: bar'),
|
||||
'{\'foo\'\'\': \'bar\', "bar\"": \'foo: bar\'}' => array('foo\'' => 'bar', "bar\"" => 'foo: bar'),
|
||||
'{\'foo: \': \'bar\', "bar: ": \'foo: bar\'}' => array('foo: ' => 'bar', "bar: " => 'foo: bar'),
|
||||
|
||||
// nested sequences and mappings
|
||||
'[foo, [bar, foo]]' => array('foo', array('bar', 'foo')),
|
||||
'[foo, {bar: foo}]' => array('foo', array('bar' => 'foo')),
|
||||
'{ foo: {bar: foo} }' => array('foo' => array('bar' => 'foo')),
|
||||
'{ foo: [bar, foo] }' => array('foo' => array('bar', 'foo')),
|
||||
|
||||
'[ foo, [ bar, foo ] ]' => array('foo', array('bar', 'foo')),
|
||||
|
||||
'[{ foo: {bar: foo} }]' => array(array('foo' => array('bar' => 'foo'))),
|
||||
|
||||
'[foo, [bar, [foo, [bar, foo]], foo]]' => array('foo', array('bar', array('foo', array('bar', 'foo')), 'foo')),
|
||||
|
||||
'[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'))),
|
||||
|
||||
'[foo, bar: { foo: bar }]' => array('foo', '1' => array('bar' => array('foo' => 'bar'))),
|
||||
'[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',),
|
||||
);
|
||||
}
|
||||
|
||||
protected function getTestsForDump()
|
||||
{
|
||||
return array(
|
||||
'null' => null,
|
||||
'false' => false,
|
||||
'true' => true,
|
||||
'12' => 12,
|
||||
"'quoted string'" => 'quoted string',
|
||||
'12.30e+02' => 12.30e+02,
|
||||
'1234' => 0x4D2,
|
||||
'1243' => 02333,
|
||||
'.Inf' => -log(0),
|
||||
'-.Inf' => log(0),
|
||||
"'686e444'" => '686e444',
|
||||
'.Inf' => 646e444,
|
||||
'"foo\r\nbar"' => "foo\r\nbar",
|
||||
"'foo#bar'" => 'foo#bar',
|
||||
"'foo # bar'" => 'foo # bar',
|
||||
"'#cfcfcf'" => '#cfcfcf',
|
||||
|
||||
"'a \"string\" with ''quoted strings inside'''" => 'a "string" with \'quoted strings inside\'',
|
||||
|
||||
// sequences
|
||||
'[foo, bar, false, null, 12]' => array('foo', 'bar', false, null, 12),
|
||||
'[\'foo,bar\', \'foo bar\']' => array('foo,bar', 'foo bar'),
|
||||
|
||||
// mappings
|
||||
'{ foo: bar, bar: foo, \'false\': false, \'null\': null, integer: 12 }' => array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12),
|
||||
'{ foo: bar, bar: \'foo: bar\' }' => array('foo' => 'bar', 'bar' => 'foo: bar'),
|
||||
|
||||
// nested sequences and mappings
|
||||
'[foo, [bar, foo]]' => array('foo', array('bar', 'foo')),
|
||||
|
||||
'[foo, [bar, [foo, [bar, foo]], foo]]' => array('foo', array('bar', array('foo', array('bar', 'foo')), 'foo')),
|
||||
|
||||
'{ foo: { bar: foo } }' => array('foo' => array('bar' => 'foo')),
|
||||
|
||||
'[foo, { bar: foo }]' => array('foo', array('bar' => 'foo')),
|
||||
|
||||
'[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'))),
|
||||
|
||||
'[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',),
|
||||
);
|
||||
}
|
||||
}
|
193
vendor/symfony/yaml/Symfony/Component/Yaml/Tests/ParserTest.php
vendored
Normal file
193
vendor/symfony/yaml/Symfony/Component/Yaml/Tests/ParserTest.php
vendored
Normal file
@@ -0,0 +1,193 @@
|
||||
<?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;
|
||||
use Symfony\Component\Yaml\Parser;
|
||||
use Symfony\Component\Yaml\Exception\ParseException;
|
||||
|
||||
class ParserTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $parser;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->parser = new Parser();
|
||||
}
|
||||
|
||||
protected function tearDown()
|
||||
{
|
||||
$this->parser = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getDataFormSpecifications
|
||||
*/
|
||||
public function testSpecifications($file, $expected, $yaml, $comment)
|
||||
{
|
||||
if ('escapedCharacters' == $file) {
|
||||
if (!function_exists('iconv') && !function_exists('mb_convert_encoding')) {
|
||||
$this->markTestSkipped('The iconv and mbstring extensions are not available.');
|
||||
}
|
||||
}
|
||||
|
||||
$this->assertEquals($expected, var_export($this->parser->parse($yaml), true), $comment);
|
||||
}
|
||||
|
||||
public function getDataFormSpecifications()
|
||||
{
|
||||
$parser = new Parser();
|
||||
$path = __DIR__.'/Fixtures';
|
||||
|
||||
$tests = array();
|
||||
$files = $parser->parse(file_get_contents($path.'/index.yml'));
|
||||
foreach ($files as $file) {
|
||||
$yamls = file_get_contents($path.'/'.$file.'.yml');
|
||||
|
||||
// split YAMLs documents
|
||||
foreach (preg_split('/^---( %YAML\:1\.0)?/m', $yamls) as $yaml) {
|
||||
if (!$yaml) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$test = $parser->parse($yaml);
|
||||
if (isset($test['todo']) && $test['todo']) {
|
||||
// TODO
|
||||
} else {
|
||||
$expected = var_export(eval('return '.trim($test['php']).';'), true);
|
||||
|
||||
$tests[] = array($file, $expected, $test['yaml'], $test['test']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $tests;
|
||||
}
|
||||
|
||||
public function testTabsInYaml()
|
||||
{
|
||||
// test tabs in YAML
|
||||
$yamls = array(
|
||||
"foo:\n bar",
|
||||
"foo:\n bar",
|
||||
"foo:\n bar",
|
||||
"foo:\n bar",
|
||||
);
|
||||
|
||||
foreach ($yamls as $yaml) {
|
||||
try {
|
||||
$content = $this->parser->parse($yaml);
|
||||
|
||||
$this->fail('YAML files must not contain tabs');
|
||||
} catch (\Exception $e) {
|
||||
$this->assertInstanceOf('\Exception', $e, 'YAML files must not contain tabs');
|
||||
$this->assertEquals('A YAML file cannot contain tabs as indentation at line 2 (near "'.strpbrk($yaml, "\t").'").', $e->getMessage(), 'YAML files must not contain tabs');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function testEndOfTheDocumentMarker()
|
||||
{
|
||||
$yaml = <<<EOF
|
||||
--- %YAML:1.0
|
||||
foo
|
||||
...
|
||||
EOF;
|
||||
|
||||
$this->assertEquals('foo', $this->parser->parse($yaml));
|
||||
}
|
||||
|
||||
public function testObjectsSupport()
|
||||
{
|
||||
$b = array('foo' => new B(), 'bar' => 1);
|
||||
$this->assertEquals($this->parser->parse(<<<EOF
|
||||
foo: !!php/object:O:30:"Symfony\Component\Yaml\Tests\B":1:{s:1:"b";s:3:"foo";}
|
||||
bar: 1
|
||||
EOF
|
||||
), $b, '->parse() is able to dump objects');
|
||||
}
|
||||
|
||||
public function testNonUtf8Exception()
|
||||
{
|
||||
if (!function_exists('mb_detect_encoding') || !function_exists('iconv')) {
|
||||
$this->markTestSkipped('Exceptions for non-utf8 charsets require the mb_detect_encoding() and iconv() functions.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$yamls = array(
|
||||
iconv("UTF-8", "ISO-8859-1", "foo: 'äöüß'"),
|
||||
iconv("UTF-8", "ISO-8859-15", "euro: '€'"),
|
||||
iconv("UTF-8", "CP1252", "cp1252: '©ÉÇáñ'")
|
||||
);
|
||||
|
||||
foreach ($yamls as $yaml) {
|
||||
try {
|
||||
$this->parser->parse($yaml);
|
||||
|
||||
$this->fail('charsets other than UTF-8 are rejected.');
|
||||
} catch (\Exception $e) {
|
||||
$this->assertInstanceOf('Symfony\Component\Yaml\Exception\ParseException', $e, 'charsets other than UTF-8 are rejected.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @expectedException Symfony\Component\Yaml\Exception\ParseException
|
||||
*
|
||||
*/
|
||||
public function testUnindentedCollectionException()
|
||||
{
|
||||
$yaml = <<<EOF
|
||||
|
||||
collection:
|
||||
-item1
|
||||
-item2
|
||||
-item3
|
||||
|
||||
EOF;
|
||||
|
||||
$this->parser->parse($yaml);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Symfony\Component\Yaml\Exception\ParseException
|
||||
*/
|
||||
public function testSequenceInAMapping()
|
||||
{
|
||||
Yaml::parse(<<<EOF
|
||||
yaml:
|
||||
hash: me
|
||||
- array stuff
|
||||
EOF
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Symfony\Component\Yaml\Exception\ParseException
|
||||
*/
|
||||
public function testMappingInASequence()
|
||||
{
|
||||
Yaml::parse(<<<EOF
|
||||
yaml:
|
||||
- array stuff
|
||||
hash: me
|
||||
EOF
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class B
|
||||
{
|
||||
public $b = 'foo';
|
||||
}
|
41
vendor/symfony/yaml/Symfony/Component/Yaml/Tests/YamlTest.php
vendored
Normal file
41
vendor/symfony/yaml/Symfony/Component/Yaml/Tests/YamlTest.php
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
<?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);
|
||||
|
||||
$filename = __DIR__.'/Fixtures/index.yml';
|
||||
$contents = file_get_contents($filename);
|
||||
$parsedByFilename = Yaml::parse($filename);
|
||||
$parsedByContents = Yaml::parse($contents);
|
||||
$this->assertEquals($parsedByFilename, $parsedByContents);
|
||||
}
|
||||
|
||||
public function testEmbededPhp()
|
||||
{
|
||||
$filename = __DIR__.'/Fixtures/embededPhp.yml';
|
||||
Yaml::enablePhpParsing();
|
||||
$parsed = Yaml::parse($filename);
|
||||
$this->assertEquals(array('value' => 6), $parsed);
|
||||
}
|
||||
|
||||
}
|
18
vendor/symfony/yaml/Symfony/Component/Yaml/Tests/bootstrap.php
vendored
Normal file
18
vendor/symfony/yaml/Symfony/Component/Yaml/Tests/bootstrap.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?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.
|
||||
*/
|
||||
|
||||
spl_autoload_register(function ($class) {
|
||||
if (0 === strpos(ltrim($class, '/'), 'Symfony\Component\Yaml')) {
|
||||
if (file_exists($file = __DIR__.'/../'.substr(str_replace('\\', '/', $class), strlen('Symfony\Component\Yaml')).'.php')) {
|
||||
require_once $file;
|
||||
}
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user