Vendor lock

This commit is contained in:
2023-06-16 02:08:47 +00:00
parent 7933e70e90
commit 3351b92dd6
4099 changed files with 345789 additions and 0 deletions

21
vendor/rmoiseev/spyc/COPYING vendored Normal file
View File

@ -0,0 +1,21 @@
The MIT License
Copyright (c) 2011 Vladimir Andersen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

159
vendor/rmoiseev/spyc/README vendored Normal file
View File

@ -0,0 +1,159 @@
#
# S P Y C
# a simple php yaml class
#
# Load this README!
# >> $readme = Spyc::YAMLLoad('README');
#
--- %YAML:1.1
title: Spyc -- a Simple PHP YAML Class
version: 0.5.1
authors: [chris wanstrath (chris@ozmm.org), vlad andersen (vlad.andersen@gmail.com)]
websites: [http://www.yaml.org, http://spyc.sourceforge.net]
license: [MIT License, http://www.opensource.org/licenses/mit-license.php]
copyright: "(c) 2005-2006 Chris Wanstrath, 2006-2011 Vlad Andersen"
tested on: [php 5.2.x]
installation: >
Copy Spyc.php to a directory you can
access with your YAML-ready PHP script.
That's it!
about: >
From www.yaml.org:
"YAML(tm) (rhymes with 'camel') is a human-friendly, cross language,
Unicode based data serialization language designed around the common
native data structures of agile programming languages. It is broadly
useful for programming needs ranging from configuration files to
Internet messaging to object persistence to data auditing. Together
with the Unicode standard for characters, the YAML specification provides
all the information necessary to understand YAML Version 1.1 and to
creating programs that process YAML information.
YAML(tm) is a balance of the following design goals:
- YAML documents are very readable by humans.
- YAML interacts well with scripting languages.
- YAML uses host languages' native data structures.
- YAML has a consistent information model.
- YAML enables stream-based processing.
- YAML is expressive and extensible.
- YAML is easy to implement."
YAML makes a lot of sense. It's easy to use, easy to learn, and cool.
As the lucky stiff named why once said, "YAML is a beacon of light."
If you're new to YAML, may we suggest YAML In Five Minutes:
- http://yaml.kwiki.org/?YamlInFiveMinutes
If you don't have five minutes, realize that this README is a completely
valid YAML document. Dig in, load this or any YAML file into an array
with Spyc and see how easy it is to translate friendly text into usable
data.
The purpose of Spyc is to provide a pure PHP alternative to Syck, a
simple API for loading and dumping YAML documents, a YAML loader which
understands a usable subset of the YAML spec, and to further spread
the glory of YAML to the PHP masses.
If you're at all hesitant ("usable subset of YAML?!"), navigate
http://yaml.org/start.html. Spyc completely understands the YAML
document shown there, a document which has features way beyond the
scope of what normal config files might require. Try it for yourself,
and then start enjoying the peace of mind YAML brings to your life.
meat and a few potatoes:
- concept: Loading a YAML document into PHP
brief: >
$yaml will become an array of all the data in wicked.yaml
code: |
include('Spyc.php');
$yaml = Spyc::YAMLLoad('wicked.yaml');
- concept: Loading a YAML string into PHP
brief: >
$array will look like this:
array('A YAML','document in a','string')
code: |
include('Spyc.php');
$yaml = '- A YAML\n- document in a\n- string.';
$array = Spyc::YAMLLoad($yaml);
- concept: Dumping a PHP array to YAML
brief: >
$yaml will become a string of a YAML document created from
$array.
code: |
include('Spyc.php');
$array['name'] = 'chris';
$array['sport'] = 'curbing';
$yaml = Spyc::YAMLDump($array);
prior art:
- who: [Brian Ingerson, Clark Evans, Oren Ben-Kiki]
why?: >
The YAML spec is really a piece of work, and these guys
did a great job on it. A simple and elegant language like
YAML was a long time coming and it's refreshing to know
such able minded individuals took the task to heart and
executed it with cunning and strength. In addition to
their various noteworthy contributions to YAML parsers
and related projects, YAML.pm's README is a treasure trove
of information for knowledge seekers. Thanks, guys.
- who: why the lucky stiff
why?: >
As the author of Syck, the code used in Ruby for the language's
YAML class and methods, why is indirectly (directly?) responsible
for my first exposure to YAML (as a config file in a Ruby web-app)
and the countless hours I spent playing with this sheik new data
format afterwards. Syck's README is a YAML file and thus the
inspiration for this file and, even, this very piece of software.
- who: Steve Howell
why?: >
Python's YAML implementation. PyYAML's README file is also YAML,
so it too inspired the YAML format of this README file.
- who: [Rasmus Lerdorf, Zeev Suraski, Andi Gutmans, et al]
why?: >
PHP is great at what it does best. It's also paid a lot of my bills.
Thanks.
bugs:
report: >
Please see Spyc's Sourceforge project page for information on reporting bugs.
speed: >
This implementation was not designed for speed. Rather, it
was designed for those who need a pure PHP implementation of
a YAML parser and who are not overly concerned with performance.
If you want speed, check out Syck.
depth: >
This parser is by no means a comprehensive YAML parser. For supported
features and future plans, check the website.
unicode: >
YAML is supposed to be unicode, but for now we're just using ASCII.
PHP has crappy unicode support but who knows what the future holds.
resources:
- http://www.yaml.org
- http://www.yaml.org/spec/
- http://yaml.kwiki.org/?YamlInFiveMinutes
- http://www.whytheluckystiff.net/syck/
- http://yaml4r.sourceforge.net/cookbook/
thanks:
- Adam Wood
- Daniel Ferreira
- Aaron Jensen
- Mike Thornton
- Fabien Potencier
- Mustafa Kumas

1045
vendor/rmoiseev/spyc/Spyc.php vendored Normal file

File diff suppressed because it is too large Load Diff

27
vendor/rmoiseev/spyc/composer.json vendored Normal file
View File

@ -0,0 +1,27 @@
{
"name": "mustangostang/spyc",
"description": "A simple YAML loader/dumper class for PHP",
"type": "library",
"keywords": [
"spyc",
"yaml",
"yml"
],
"homepage": "https://github.com/mustangostang/spyc/",
"authors" : [{
"name": "mustangostang",
"email": "vlad.andersen@gmail.com"
}],
"license": "MIT License",
"require": {
"php": ">=5.3.1"
},
"autoload": {
"files": [ "Spyc.php" ]
},
"extra": {
"branch-alias": {
"dev-master": "0.5.x-dev"
}
}
}

View File

@ -0,0 +1,25 @@
<?php
#
# S P Y C
# a simple php yaml class
#
# Feel free to dump an array to YAML, and then to load that YAML back into an
# array. This is a good way to test the limitations of the parser and maybe
# learn some basic YAML.
#
include('../Spyc.php');
$array[] = 'Sequence item';
$array['The Key'] = 'Mapped value';
$array[] = array('A sequence','of a sequence');
$array[] = array('first' => 'A sequence','second' => 'of mapped values');
$array['Mapped'] = array('A sequence','which is mapped');
$array['A Note'] = 'What if your text is too long?';
$array['Another Note'] = 'If that is the case, the dumper will probably fold your text by using a block. Kinda like this.';
$array['The trick?'] = 'The trick is that we overrode the default indent, 2, to 4 and the default wordwrap, 40, to 60.';
$array['Old Dog'] = "And if you want\n to preserve line breaks, \ngo ahead!";
$array['key:withcolon'] = "Should support this to";
$yaml = Spyc::YAMLDump($array,4,60);

View File

@ -0,0 +1,21 @@
<?php
#
# S P Y C
# a simple php yaml class
#
# license: [MIT License, http://www.opensource.org/licenses/mit-license.php]
#
include('../Spyc.php');
$array = Spyc::YAMLLoad('../spyc.yaml');
echo '<pre><a href="spyc.yaml">spyc.yaml</a> loaded into PHP:<br/>';
print_r($array);
echo '</pre>';
echo '<pre>YAML Data dumped back:<br/>';
echo Spyc::YAMLDump($array);
echo '</pre>';

17
vendor/rmoiseev/spyc/php4/5to4.php vendored Normal file
View File

@ -0,0 +1,17 @@
<?php
php5to4 ("../spyc.php", 'spyc-latest.php4');
function php5to4 ($src, $dest) {
$code = file_get_contents ($src);
$code = preg_replace ('#(public|private|protected)\s+\$#i', 'var \$', $code);
$code = preg_replace ('#(public|private|protected)\s+static\s+\$#i', 'var \$', $code);
$code = preg_replace ('#(public|private|protected)\s+function#i', 'function', $code);
$code = preg_replace ('#(public|private|protected)\s+static\s+function#i', 'function', $code);
$code = preg_replace ('#throw new Exception\\(([^)]*)\\)#i', 'trigger_error($1,E_USER_ERROR)', $code);
$code = str_replace ('self::', '$this->', $code);
$f = fopen ($dest, 'w');
fwrite($f, $code);
fclose ($f);
print "Written to $dest.\n";
}

1023
vendor/rmoiseev/spyc/php4/spyc.php4 vendored Normal file

File diff suppressed because it is too large Load Diff

162
vendor/rmoiseev/spyc/php4/test.php4 vendored Normal file
View File

@ -0,0 +1,162 @@
<?php
#
# S P Y C
# a simple php yaml class
# v0.3
#
# author: [chris wanstrath, chris@ozmm.org]
# websites: [http://www.yaml.org, http://spyc.sourceforge.net/]
# license: [MIT License, http://www.opensource.org/licenses/mit-license.php]
# copyright: (c) 2005-2006 Chris Wanstrath
#
# We're gonna load a file into memory and see if we get what we expect.
# If not, we're gonna complain.
#
# Pretty lo-fi. Let's see if we can't get some unit testing going in the next,
# I dunno, 20 months? Alright. Go team.
#
error_reporting(E_ALL);
include('spyc.php4');
$yaml = Spyc::YAMLLoad('../spyc.yaml');
// print_r ($yaml);
# Added in .2
if ($yaml[1040] != "Ooo, a numeric key!")
die('Key: 1040 failed');
# Test mappings / types
if ($yaml['String'] != "Anyone's name, really.")
die('Key: String failed');
if ($yaml['Int'] !== 13)
die('Key: Int failed');
if ($yaml['True'] !== true)
die('Key: True failed');
if ($yaml['False'] !== false)
die('Key: False failed');
if ($yaml['Zero'] !== 0)
die('Key: Zero failed');
if (isset($yaml['Null']))
die('Key: Null failed');
if ($yaml['Float'] !== 5.34)
die('Key: Float failed');
# Test sequences
if ($yaml[0] != "PHP Class")
die('Sequence 0 failed');
if ($yaml[1] != "Basic YAML Loader")
die('Sequence 1 failed');
if ($yaml[2] != "Very Basic YAML Dumper")
die('Sequence 2 failed');
# A sequence of a sequence
if ($yaml[3] != array("YAML is so easy to learn.",
"Your config files will never be the same."))
die('Sequence 3 failed');
# Sequence of mappings
if ($yaml[4] != array("cpu" => "1.5ghz", "ram" => "1 gig",
"os" => "os x 10.4.1"))
die('Sequence 4 failed');
# Mapped sequence
if ($yaml['domains'] != array("yaml.org", "php.net"))
die("Key: 'domains' failed");
# A sequence like this.
if ($yaml[5] != array("program" => "Adium", "platform" => "OS X",
"type" => "Chat Client"))
die('Sequence 5 failed');
# A folded block as a mapped value
if ($yaml['no time'] != "There isn't any time for your tricks!\nDo you understand?")
die("Key: 'no time' failed");
# A literal block as a mapped value
if ($yaml['some time'] != "There is nothing but time\nfor your tricks.")
die("Key: 'some time' failed");
# Crazy combinations
if ($yaml['databases'] != array( array("name" => "spartan", "notes" =>
array( "Needs to be backed up",
"Needs to be normalized" ),
"type" => "mysql" )))
die("Key: 'databases' failed");
# You can be a bit tricky
if ($yaml["if: you'd"] != "like")
die("Key: 'if: you\'d' failed");
# Inline sequences
if ($yaml[6] != array("One", "Two", "Three", "Four"))
die("Sequence 6 failed");
# Nested Inline Sequences
if ($yaml[7] != array("One", array("Two", "And", "Three"), "Four", "Five"))
die("Sequence 7 failed");
# Nested Nested Inline Sequences
if ($yaml[8] != array( "This", array("Is", "Getting", array("Ridiculous", "Guys")),
"Seriously", array("Show", "Mercy")))
die("Sequence 8 failed");
# Inline mappings
if ($yaml[9] != array("name" => "chris", "age" => "young", "brand" => "lucky strike"))
die("Sequence 9 failed");
# Nested inline mappings
if ($yaml[10] != array("name" => "mark", "age" => "older than chris",
"brand" => array("marlboro", "lucky strike")))
die("Sequence 10 failed");
# References -- they're shaky, but functional
if ($yaml['dynamic languages'] != array('Perl', 'Python', 'PHP', 'Ruby'))
die("Key: 'dynamic languages' failed");
if ($yaml['compiled languages'] != array('C/C++', 'Java'))
die("Key: 'compiled languages' failed");
if ($yaml['all languages'] != array(
array('Perl', 'Python', 'PHP', 'Ruby'),
array('C/C++', 'Java')
))
die("Key: 'all languages' failed");
# Added in .2.2: Escaped quotes
if ($yaml[11] != "you know, this shouldn't work. but it does.")
die("Sequence 11 failed.");
if ($yaml[12] != "that's my value.")
die("Sequence 12 failed.");
if ($yaml[13] != "again, that's my value.")
die("Sequence 13 failed.");
if ($yaml[14] != "here's to \"quotes\", boss.")
die("Sequence 14 failed.");
if ($yaml[15] != array( 'name' => "Foo, Bar's", 'age' => 20))
die("Sequence 15 failed.");
if ($yaml[16] != array( 0 => "a", 1 => array (0 => 1, 1 => 2), 2 => "b"))
die("Sequence 16 failed.");
if ($yaml['endloop'] != "Does this line in the end indeed make Spyc go to an infinite loop?")
die("[endloop] failed.");
print "spyc.yaml parsed correctly\n";
?>

206
vendor/rmoiseev/spyc/spyc.yaml vendored Normal file
View File

@ -0,0 +1,206 @@
#
# S P Y C
# a simple php yaml class
#
# authors: [vlad andersen (vlad.andersen@gmail.com), chris wanstrath (chris@ozmm.org)]
# websites: [http://www.yaml.org, http://spyc.sourceforge.net/]
# license: [MIT License, http://www.opensource.org/licenses/mit-license.php]
# copyright: (c) 2005-2006 Chris Wanstrath, 2006-2011 Vlad Andersen
#
# spyc.yml - A file containing the YAML that Spyc understands.
---
# Mappings - with proper types
String: Anyone's name, really.
Int: 13
True: true
False: false
Zero: 0
Null: NULL
NotNull: 'null'
NotTrue: 'y'
NotBoolTrue: 'true'
NotInt: '5'
Float: 5.34
Negative: -90
SmallFloat: 0.7
NewLine: \n
# A sequence
- PHP Class
- Basic YAML Loader
- Very Basic YAML Dumper
# A sequence of a sequence
-
- YAML is so easy to learn.
- Your config files will never be the same.
# Sequence of mappings
-
cpu: 1.5ghz
ram: 1 gig
os : os x 10.4.1
# Mapped sequence
domains:
- yaml.org
- php.net
# A sequence like this.
- program: Adium
platform: OS X
type: Chat Client
# A folded block as a mapped value
no time: >
There isn't any time
for your tricks!
Do you understand?
# A literal block as a mapped value
some time: |
There is nothing but time
for your tricks.
# Crazy combinations
databases:
- name: spartan
notes:
- Needs to be backed up
- Needs to be normalized
type: mysql
# You can be a bit tricky
"if: you'd": like
# Inline sequences
- [One, Two, Three, Four]
# Nested Inline Sequences
- [One, [Two, And, Three], Four, Five]
# Nested Nested Inline Sequences
- [This, [Is, Getting, [Ridiculous, Guys]], Seriously, [Show, Mercy]]
# Inline mappings
- {name: chris, age: young, brand: lucky strike}
# Nested inline mappings
- {name: mark, age: older than chris, brand: [marlboro, lucky strike]}
# References -- they're shaky, but functional
dynamic languages: &DLANGS
- Perl
- Python
- PHP
- Ruby
compiled languages: &CLANGS
- C/C++
- Java
all languages:
- *DLANGS
- *CLANGS
# Added in .2.2: Escaped quotes
- you know, this shouldn't work. but it does.
- 'that''s my value.'
- 'again, that\'s my value.'
- "here's to \"quotes\", boss."
# added in .2.3
- {name: "Foo, Bar's", age: 20}
# Added in .2.4: bug [ 1418193 ] Quote Values in Nested Arrays
- [a, ['1', "2"], b]
# Added in .2.4: malformed YAML
all
javascripts: [dom1.js, dom.js]
# Added in .2
1040: Ooo, a numeric key! # And working comments? Wow! Colons in comments: a menace (0.3).
hash_1: Hash #and a comment
hash_2: "Hash #and a comment"
"hash#3": "Hash (#) can appear in key too"
float_test: 1.0
float_test_with_quotes: '1.0'
float_inverse_test: 001
a_really_large_number: 115792089237316195423570985008687907853269984665640564039457584007913129639936 # 2^256
int array: [ 1, 2, 3 ]
array on several lines:
[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
10, 11, 12, 13, 14, 15, 16, 17, 18, 19 ]
morelesskey: "<value>"
array_of_zero: [0]
sophisticated_array_of_zero: {rx: {tx: [0]} }
switches:
- { row: 0, col: 0, func: {tx: [0, 1]} }
empty_sequence: [ ]
empty_hash: { }
special_characters: "[{]]{{]]"
asterisks: "*"
empty_key:
:
key: value
trailing_colon: "foo:"
multiline_items:
- type: SomeItem
values: [blah, blah, blah,
blah]
ints: [2, 54, 12,
2143]
many_lines: |
A quick
fox
jumped
over
a lazy
dog
werte:
1: nummer 1
0: Stunde 0
noindent_records:
- record1: value1
- record2: value2
"a:1": [1000]
"a:2":
- 2000
array with commas:
["0","1"]
# [Endloop]
endloop: |
Does this line in the end indeed make Spyc go to an infinite loop?

130
vendor/rmoiseev/spyc/tests/DumpTest.php vendored Normal file
View File

@ -0,0 +1,130 @@
<?php
require_once ("../Spyc.php");
class DumpTest extends PHPUnit_Framework_TestCase {
private $files_to_test = array();
public function setUp() {
$this->files_to_test = array ('../spyc.yaml', 'failing1.yaml', 'indent_1.yaml', 'quotes.yaml');
}
public function testDump() {
foreach ($this->files_to_test as $file) {
$yaml = spyc_load(file_get_contents($file));
$dump = Spyc::YAMLDump ($yaml);
$yaml_after_dump = Spyc::YAMLLoad ($dump);
$this->assertEquals ($yaml, $yaml_after_dump);
}
}
public function testDumpWithQuotes() {
$Spyc = new Spyc();
$Spyc->setting_dump_force_quotes = true;
foreach ($this->files_to_test as $file) {
$yaml = $Spyc->load(file_get_contents($file));
$dump = $Spyc->dump ($yaml);
$yaml_after_dump = Spyc::YAMLLoad ($dump);
$this->assertEquals ($yaml, $yaml_after_dump);
}
}
public function testDumpArrays() {
$dump = Spyc::YAMLDump(array ('item1', 'item2', 'item3'));
$awaiting = "---\n- item1\n- item2\n- item3\n";
$this->assertEquals ($awaiting, $dump);
}
public function testNull() {
$dump = Spyc::YAMLDump(array('a' => 1, 'b' => null, 'c' => 3));
$awaiting = "---\na: 1\nb: null\nc: 3\n";
$this->assertEquals ($awaiting, $dump);
}
public function testNext() {
$array = array("aaa", "bbb", "ccc");
#set arrays internal pointer to next element
next($array);
$dump = Spyc::YAMLDump($array);
$awaiting = "---\n- aaa\n- bbb\n- ccc\n";
$this->assertEquals ($awaiting, $dump);
}
public function testDumpingMixedArrays() {
$array = array();
$array[] = 'Sequence item';
$array['The Key'] = 'Mapped value';
$array[] = array('A sequence','of a sequence');
$array[] = array('first' => 'A sequence','second' => 'of mapped values');
$array['Mapped'] = array('A sequence','which is mapped');
$array['A Note'] = 'What if your text is too long?';
$array['Another Note'] = 'If that is the case, the dumper will probably fold your text by using a block. Kinda like this.';
$array['The trick?'] = 'The trick is that we overrode the default indent, 2, to 4 and the default wordwrap, 40, to 60.';
$array['Old Dog'] = "And if you want\n to preserve line breaks, \ngo ahead!";
$array['key:withcolon'] = "Should support this to";
$yaml = Spyc::YAMLDump($array,4,60);
}
public function testMixed() {
$dump = Spyc::YAMLDump(array(0 => 1, 'b' => 2, 1 => 3));
$awaiting = "---\n0: 1\nb: 2\n1: 3\n";
$this->assertEquals ($awaiting, $dump);
}
public function testDumpNumerics() {
$dump = Spyc::YAMLDump(array ('404', '405', '500'));
$awaiting = "---\n- 404\n- 405\n- 500\n";
$this->assertEquals ($awaiting, $dump);
}
public function testDumpAsterisks() {
$dump = Spyc::YAMLDump(array ('*'));
$awaiting = "---\n- '*'\n";
$this->assertEquals ($awaiting, $dump);
}
public function testDumpAmpersands() {
$dump = Spyc::YAMLDump(array ('some' => '&foo'));
$awaiting = "---\nsome: '&foo'\n";
$this->assertEquals ($awaiting, $dump);
}
public function testDumpExclamations() {
$dump = Spyc::YAMLDump(array ('some' => '!foo'));
$awaiting = "---\nsome: '!foo'\n";
$this->assertEquals ($awaiting, $dump);
}
public function testDumpExclamations2() {
$dump = Spyc::YAMLDump(array ('some' => 'foo!'));
$awaiting = "---\nsome: foo!\n";
$this->assertEquals ($awaiting, $dump);
}
public function testDumpApostrophes() {
$dump = Spyc::YAMLDump(array ('some' => "'Biz' pimpt bedrijventerreinen"));
$awaiting = "---\nsome: \"'Biz' pimpt bedrijventerreinen\"\n";
$this->assertEquals ($awaiting, $dump);
}
public function testDumpNumericHashes() {
$dump = Spyc::YAMLDump(array ("titel"=> array("0" => "", 1 => "Dr.", 5 => "Prof.", 6 => "Prof. Dr.")));
$awaiting = "---\ntitel:\n 0:\n 1: Dr.\n 5: Prof.\n 6: Prof. Dr.\n";
$this->assertEquals ($awaiting, $dump);
}
public function testEmpty() {
$dump = Spyc::YAMLDump(array("foo" => array()));
$awaiting = "---\nfoo: [ ]\n";
$this->assertEquals ($awaiting, $dump);
}
public function testHashesInKeys() {
$dump = Spyc::YAMLDump(array ('#color' => '#ffffff'));
$awaiting = "---\n\"#color\": '#ffffff'\n";
$this->assertEquals ($awaiting, $dump);
}
}

View File

@ -0,0 +1,65 @@
<?php
require_once ("../Spyc.php");
class IndentTest extends PHPUnit_Framework_TestCase {
protected $Y;
protected function setUp() {
$this->Y = Spyc::YAMLLoad("indent_1.yaml");
}
public function testIndent_1() {
$this->assertEquals (array ('child_1' => 2, 'child_2' => 0, 'child_3' => 1), $this->Y['root']);
}
public function testIndent_2() {
$this->assertEquals (array ('child_1' => 1, 'child_2' => 2), $this->Y['root2']);
}
public function testIndent_3() {
$this->assertEquals (array (array ('resolutions' => array (1024 => 768, 1920 => 1200), 'producer' => 'Nec')), $this->Y['display']);
}
public function testIndent_4() {
$this->assertEquals (array (
array ('resolutions' => array (1024 => 768)),
array ('resolutions' => array (1920 => 1200)),
), $this->Y['displays']);
}
public function testIndent_5() {
$this->assertEquals (array (array (
'row' => 0,
'col' => 0,
'headsets_affected' => array (
array (
'ports' => array (0),
'side' => 'left',
)
),
'switch_function' => array (
'ics_ptt' => true
)
)), $this->Y['nested_hashes_and_seqs']);
}
public function testIndent_6() {
$this->assertEquals (array (
'h' => array (
array ('a' => 'b', 'a1' => 'b1'),
array ('c' => 'd')
)
), $this->Y['easier_nest']);
}
public function testIndent_space() {
$this->assertEquals ("By four\n spaces", $this->Y['one_space']);
}
public function testListAndComment() {
$this->assertEquals (array ('one', 'two', 'three'), $this->Y['list_and_comment']);
}
}

355
vendor/rmoiseev/spyc/tests/ParseTest.php vendored Normal file
View File

@ -0,0 +1,355 @@
<?php
require_once ("../Spyc.php");
class ParseTest extends PHPUnit_Framework_TestCase {
protected $yaml;
protected function setUp() {
$this->yaml = spyc_load_file('../spyc.yaml');
}
public function testMergeHashKeys() {
$Expected = array (
array ('step' => array('instrument' => 'Lasik 2000', 'pulseEnergy' => 5.4, 'pulseDuration' => 12, 'repetition' => 1000, 'spotSize' => '1mm')),
array ('step' => array('instrument' => 'Lasik 2000', 'pulseEnergy' => 5.4, 'pulseDuration' => 12, 'repetition' => 1000, 'spotSize' => '2mm')),
);
$Actual = spyc_load_file ('indent_1.yaml');
$this->assertEquals ($Expected, $Actual['steps']);
}
public function testDeathMasks() {
$Expected = array ('sad' => 2, 'magnificent' => 4);
$Actual = spyc_load_file ('indent_1.yaml');
$this->assertEquals ($Expected, $Actual['death masks are']);
}
public function testDevDb() {
$Expected = array ('adapter' => 'mysql', 'host' => 'localhost', 'database' => 'rails_dev');
$Actual = spyc_load_file ('indent_1.yaml');
$this->assertEquals ($Expected, $Actual['development']);
}
public function testNumericKey() {
$this->assertEquals ("Ooo, a numeric key!", $this->yaml[1040]);
}
public function testMappingsString() {
$this->assertEquals ("Anyone's name, really.", $this->yaml['String']);
}
public function testMappingsInt() {
$this->assertSame (13, $this->yaml['Int']);
}
public function testMappingsBooleanTrue() {
$this->assertSame (true, $this->yaml['True']);
}
public function testMappingsBooleanFalse() {
$this->assertSame (false, $this->yaml['False']);
}
public function testMappingsZero() {
$this->assertSame (0, $this->yaml['Zero']);
}
public function testMappingsNull() {
$this->assertSame (null, $this->yaml['Null']);
}
public function testMappingsNotNull() {
$this->assertSame ('null', $this->yaml['NotNull']);
}
public function testMappingsFloat() {
$this->assertSame (5.34, $this->yaml['Float']);
}
public function testMappingsNegative() {
$this->assertSame (-90, $this->yaml['Negative']);
}
public function testMappingsSmallFloat() {
$this->assertSame (0.7, $this->yaml['SmallFloat']);
}
public function testNewline() {
$this->assertSame ("\n", $this->yaml['NewLine']);
}
public function testSeq0() {
$this->assertEquals ("PHP Class", $this->yaml[0]);
}
public function testSeq1() {
$this->assertEquals ("Basic YAML Loader", $this->yaml[1]);
}
public function testSeq2() {
$this->assertEquals ("Very Basic YAML Dumper", $this->yaml[2]);
}
public function testSeq3() {
$this->assertEquals (array("YAML is so easy to learn.",
"Your config files will never be the same."), $this->yaml[3]);
}
public function testSeqMap() {
$this->assertEquals (array("cpu" => "1.5ghz", "ram" => "1 gig",
"os" => "os x 10.4.1"), $this->yaml[4]);
}
public function testMappedSequence() {
$this->assertEquals (array("yaml.org", "php.net"), $this->yaml['domains']);
}
public function testAnotherSequence() {
$this->assertEquals (array("program" => "Adium", "platform" => "OS X",
"type" => "Chat Client"), $this->yaml[5]);
}
public function testFoldedBlock() {
$this->assertEquals ("There isn't any time for your tricks!\nDo you understand?", $this->yaml['no time']);
}
public function testLiteralAsMapped() {
$this->assertEquals ("There is nothing but time\nfor your tricks.", $this->yaml['some time']);
}
public function testCrazy() {
$this->assertEquals (array( array("name" => "spartan", "notes" =>
array( "Needs to be backed up",
"Needs to be normalized" ),
"type" => "mysql" )), $this->yaml['databases']);
}
public function testColons() {
$this->assertEquals ("like", $this->yaml["if: you'd"]);
}
public function testInline() {
$this->assertEquals (array("One", "Two", "Three", "Four"), $this->yaml[6]);
}
public function testNestedInline() {
$this->assertEquals (array("One", array("Two", "And", "Three"), "Four", "Five"), $this->yaml[7]);
}
public function testNestedNestedInline() {
$this->assertEquals (array( "This", array("Is", "Getting", array("Ridiculous", "Guys")),
"Seriously", array("Show", "Mercy")), $this->yaml[8]);
}
public function testInlineMappings() {
$this->assertEquals (array("name" => "chris", "age" => "young", "brand" => "lucky strike"), $this->yaml[9]);
}
public function testNestedInlineMappings() {
$this->assertEquals (array("name" => "mark", "age" => "older than chris",
"brand" => array("marlboro", "lucky strike")), $this->yaml[10]);
}
public function testReferences() {
$this->assertEquals (array('Perl', 'Python', 'PHP', 'Ruby'), $this->yaml['dynamic languages']);
}
public function testReferences2() {
$this->assertEquals (array('C/C++', 'Java'), $this->yaml['compiled languages']);
}
public function testReferences3() {
$this->assertEquals (array(
array('Perl', 'Python', 'PHP', 'Ruby'),
array('C/C++', 'Java')
), $this->yaml['all languages']);
}
public function testEscapedQuotes() {
$this->assertEquals ("you know, this shouldn't work. but it does.", $this->yaml[11]);
}
public function testEscapedQuotes_2() {
$this->assertEquals ( "that's my value.", $this->yaml[12]);
}
public function testEscapedQuotes_3() {
$this->assertEquals ("again, that's my value.", $this->yaml[13]);
}
public function testQuotes() {
$this->assertEquals ("here's to \"quotes\", boss.", $this->yaml[14]);
}
public function testQuoteSequence() {
$this->assertEquals ( array( 'name' => "Foo, Bar's", 'age' => 20), $this->yaml[15]);
}
public function testShortSequence() {
$this->assertEquals (array( 0 => "a", 1 => array (0 => 1, 1 => 2), 2 => "b"), $this->yaml[16]);
}
public function testHash_1() {
$this->assertEquals ("Hash", $this->yaml['hash_1']);
}
public function testHash_2() {
$this->assertEquals ('Hash #and a comment', $this->yaml['hash_2']);
}
public function testHash_3() {
$this->assertEquals ('Hash (#) can appear in key too', $this->yaml['hash#3']);
}
public function testEndloop() {
$this->assertEquals ("Does this line in the end indeed make Spyc go to an infinite loop?", $this->yaml['endloop']);
}
public function testReallyLargeNumber() {
$this->assertEquals ('115792089237316195423570985008687907853269984665640564039457584007913129639936', $this->yaml['a_really_large_number']);
}
public function testFloatWithZeros() {
$this->assertSame ('1.0', $this->yaml['float_test']);
}
public function testFloatWithQuotes() {
$this->assertSame ('1.0', $this->yaml['float_test_with_quotes']);
}
public function testFloatInverse() {
$this->assertEquals ('001', $this->yaml['float_inverse_test']);
}
public function testIntArray() {
$this->assertEquals (array (1, 2, 3), $this->yaml['int array']);
}
public function testArrayOnSeveralLines() {
$this->assertEquals (array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19), $this->yaml['array on several lines']);
}
public function testArrayWithCommas() {
$this->assertEquals(array (0, 1), $this->yaml['array with commas']);
}
public function testmoreLessKey() {
$this->assertEquals ('<value>', $this->yaml['morelesskey']);
}
public function testArrayOfZero() {
$this->assertSame (array(0), $this->yaml['array_of_zero']);
}
public function testSophisticatedArrayOfZero() {
$this->assertSame (array('rx' => array ('tx' => array (0))), $this->yaml['sophisticated_array_of_zero']);
}
public function testSwitches() {
$this->assertEquals (array (array ('row' => 0, 'col' => 0, 'func' => array ('tx' => array(0, 1)))), $this->yaml['switches']);
}
public function testEmptySequence() {
$this->assertSame (array(), $this->yaml['empty_sequence']);
}
public function testEmptyHash() {
$this->assertSame (array(), $this->yaml['empty_hash']);
}
public function testEmptykey() {
$this->assertSame (array('' => array ('key' => 'value')), $this->yaml['empty_key']);
}
public function testMultilines() {
$this->assertSame (array(array('type' => 'SomeItem', 'values' => array ('blah', 'blah', 'blah', 'blah'), 'ints' => array(2, 54, 12, 2143))), $this->yaml['multiline_items']);
}
public function testManyNewlines() {
$this->assertSame ('A quick
fox
jumped
over
a lazy
dog', $this->yaml['many_lines']);
}
public function testWerte() {
$this->assertSame (array ('1' => 'nummer 1', '0' => 'Stunde 0'), $this->yaml['werte']);
}
/* public function testNoIndent() {
$this->assertSame (array(
array ('record1'=>'value1'),
array ('record2'=>'value2')
)
, $this->yaml['noindent_records']);
} */
public function testColonsInKeys() {
$this->assertSame (array (1000), $this->yaml['a:1']);
}
public function testColonsInKeys2() {
$this->assertSame (array (2000), $this->yaml['a:2']);
}
public function testSpecialCharacters() {
$this->assertSame ('[{]]{{]]', $this->yaml['special_characters']);
}
public function testAngleQuotes() {
$Quotes = Spyc::YAMLLoad('quotes.yaml');
$this->assertEquals (array ('html_tags' => array ('<br>', '<p>'), 'html_content' => array ('<p>hello world</p>', 'hello<br>world'), 'text_content' => array ('hello world')),
$Quotes);
}
public function testFailingColons() {
$Failing = Spyc::YAMLLoad('failing1.yaml');
$this->assertSame (array ('MyObject' => array ('Prop1' => array ('key1:val1'))),
$Failing);
}
public function testQuotesWithComments() {
$Expected = 'bar';
$Actual = spyc_load_file ('comments.yaml');
$this->assertEquals ($Expected, $Actual['foo']);
}
public function testArrayWithComments() {
$Expected = array ('x', 'y', 'z');
$Actual = spyc_load_file ('comments.yaml');
$this->assertEquals ($Expected, $Actual['arr']);
}
public function testAfterArrayWithKittens() {
$Expected = 'kittens';
$Actual = spyc_load_file ('comments.yaml');
$this->assertEquals ($Expected, $Actual['bar']);
}
public function testKai() {
$Expected = array (array ('example' => 'value'));
$Actual = spyc_load_file ('indent_1.yaml');
$this->assertEquals ($Expected, $Actual['kai']);
}
public function testKaiList() {
$Expected = array ('-item', '-item', 'item');
$Actual = spyc_load_file ('indent_1.yaml');
$this->assertEquals ($Expected, $Actual['kai_list_of_items']);
}
}

View File

@ -0,0 +1,61 @@
<?php
require_once ("../Spyc.php");
function roundTrip($a) { return Spyc::YAMLLoad(Spyc::YAMLDump(array('x' => $a))); }
class RoundTripTest extends PHPUnit_Framework_TestCase {
protected function setUp() {
}
public function testNull() {
$this->assertEquals (array ('x' => null), roundTrip (null));
}
public function testY() {
$this->assertEquals (array ('x' => 'y'), roundTrip ('y'));
}
public function testExclam() {
$this->assertEquals (array ('x' => '!yeah'), roundTrip ('!yeah'));
}
public function test5() {
$this->assertEquals (array ('x' => '5'), roundTrip ('5'));
}
public function testSpaces() {
$this->assertEquals (array ('x' => 'x '), roundTrip ('x '));
}
public function testApostrophes() {
$this->assertEquals (array ('x' => "'biz'"), roundTrip ("'biz'"));
}
public function testNewLines() {
$this->assertEquals (array ('x' => "\n"), roundTrip ("\n"));
}
public function testHashes() {
$this->assertEquals (array ('x' => array ("#color" => '#fff')), roundTrip (array ("#color" => '#fff')));
}
public function testWordWrap() {
$this->assertEquals (array ('x' => "aaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"), roundTrip ("aaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"));
}
public function testABCD() {
$this->assertEquals (array ('a', 'b', 'c', 'd'), Spyc::YAMLLoad(Spyc::YAMLDump(array('a', 'b', 'c', 'd'))));
}
public function testABCD2() {
$a = array('a', 'b', 'c', 'd'); // Create a simple list
$b = Spyc::YAMLDump($a); // Dump the list as YAML
$c = Spyc::YAMLLoad($b); // Load the dumped YAML
$d = Spyc::YAMLDump($c); // Re-dump the data
$this->assertSame($b, $d);
}
}

View File

@ -0,0 +1,3 @@
foo: 'bar' #Comment
arr: ['x', 'y', 'z'] # Comment here
bar: kittens

View File

@ -0,0 +1,2 @@
MyObject:
Prop1: {key1:val1}

View File

@ -0,0 +1,65 @@
root:
child_1: 2
child_2: 0
child_3: 1
root2:
child_1: 1
# A comment
child_2: 2
displays:
- resolutions:
1024: 768
- resolutions:
1920: 1200
display:
- resolutions:
1024: 768
1920: 1200
producer: "Nec"
nested_hashes_and_seqs:
- { row: 0, col: 0, headsets_affected: [{ports: [0], side: left}], switch_function: {ics_ptt: true} }
easier_nest: { h: [{a: b, a1: b1}, {c: d}] }
one_space: |
By four
spaces
steps:
- step: &id001
instrument: Lasik 2000
pulseEnergy: 5.4
pulseDuration: 12
repetition: 1000
spotSize: 1mm
- step:
<<: *id001
spotSize: 2mm
death masks are:
sad: 2
<<: {magnificent: 4}
login: &login
adapter: mysql
host: localhost
development:
database: rails_dev
<<: *login
"key": "value:"
colon_only: ":"
list_and_comment: [one, two, three] # comment
kai:
-example: value
kai_list_of_items:
- -item
- '-item'
-item

View File

@ -0,0 +1,8 @@
html_tags:
- <br>
- <p>
html_content:
- <p>hello world</p>
- hello<br>world
text_content:
- hello world