ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
InlineTest.php
Go to the documentation of this file.
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
13
14use Symfony\Bridge\PhpUnit\ErrorAssert;
17
19{
23 public function testParse($yaml, $value)
24 {
25 $this->assertSame($value, Inline::parse($yaml), sprintf('::parse() converts an inline YAML to a PHP structure (%s)', $yaml));
26 }
27
31 public function testParseWithMapObjects($yaml, $value)
32 {
34
35 $this->assertSame(serialize($value), serialize($actual));
36 }
37
42 public function testParseWithMapObjectsPassingTrue($yaml, $value)
43 {
44 $actual = Inline::parse($yaml, false, false, true);
45
46 $this->assertSame(serialize($value), serialize($actual));
47 }
48
52 public function testDump($yaml, $value)
53 {
54 $this->assertEquals($yaml, Inline::dump($value), sprintf('::dump() converts a PHP structure to an inline YAML (%s)', $yaml));
55
56 $this->assertSame($value, Inline::parse(Inline::dump($value)), 'check consistency');
57 }
58
60 {
61 $locale = setlocale(LC_NUMERIC, 0);
62 if (false === $locale) {
63 $this->markTestSkipped('Your platform does not support locales.');
64 }
65
66 try {
67 $requiredLocales = array('fr_FR.UTF-8', 'fr_FR.UTF8', 'fr_FR.utf-8', 'fr_FR.utf8', 'French_France.1252');
68 if (false === setlocale(LC_NUMERIC, $requiredLocales)) {
69 $this->markTestSkipped('Could not set any of required locales: '.implode(', ', $requiredLocales));
70 }
71
72 $this->assertEquals('1.2', Inline::dump(1.2));
73 $this->assertContains('fr', strtolower(setlocale(LC_NUMERIC, 0)));
74 } finally {
75 setlocale(LC_NUMERIC, $locale);
76 }
77 }
78
80 {
81 $value = '686e444';
82
83 $this->assertSame($value, Inline::parse(Inline::dump($value)));
84 }
85
91 {
92 Inline::parse('"Foo\Var"');
93 }
94
99 {
100 Inline::parse('"Foo\\"');
101 }
102
107 {
108 $value = "'don't do somthin' like that'";
109 Inline::parse($value);
110 }
111
116 {
117 $value = '"don"t do somthin" like that"';
118 Inline::parse($value);
119 }
120
125 {
126 $value = '{ "foo " bar": "bar" }';
127 Inline::parse($value);
128 }
129
134 {
135 Inline::parse('[foo] bar');
136 }
137
142 {
143 Inline::parse('{ foo: bar } bar');
144 }
145
147 {
148 $value = "'don''t do somthin'' like that'";
149 $expect = "don't do somthin' like that";
150
151 $this->assertSame($expect, Inline::parseScalar($value));
152 }
153
157 public function testParseReferences($yaml, $expected)
158 {
159 $this->assertSame($expected, Inline::parse($yaml, 0, array('var' => 'var-value')));
160 }
161
166 public function testParseReferencesAsFifthArgument($yaml, $expected)
167 {
168 $this->assertSame($expected, Inline::parse($yaml, false, false, false, array('var' => 'var-value')));
169 }
170
172 {
173 return array(
174 'scalar' => array('*var', 'var-value'),
175 'list' => array('[ *var ]', array('var-value')),
176 'list-in-list' => array('[[ *var ]]', array(array('var-value'))),
177 'map-in-list' => array('[ { key: *var } ]', array(array('key' => 'var-value'))),
178 'embedded-mapping-in-list' => array('[ key: *var ]', array(array('key' => 'var-value'))),
179 'map' => array('{ key: *var }', array('key' => 'var-value')),
180 'list-in-map' => array('{ key: [*var] }', array('key' => array('var-value'))),
181 'map-in-map' => array('{ foo: { bar: *var } }', array('foo' => array('bar' => 'var-value'))),
182 );
183 }
184
186 {
187 $foo = array(
188 'a' => 'Steve',
189 'b' => 'Clark',
190 'c' => 'Brian',
191 );
192 $this->assertSame(array($foo), Inline::parse('[*foo]', 0, array('foo' => $foo)));
193 }
194
199 {
200 $foo = array(
201 'a' => 'Steve',
202 'b' => 'Clark',
203 'c' => 'Brian',
204 );
205 $this->assertSame(array($foo), Inline::parse('[*foo]', false, false, false, array('foo' => $foo)));
206 }
207
213 {
214 Inline::parse('{ foo: * }');
215 }
216
222 {
223 Inline::parse('{ foo: * #foo }');
224 }
225
232 {
233 Inline::parse(sprintf('{ foo: %sfoo }', $indicator));
234 }
235
236 public function getReservedIndicators()
237 {
238 return array(array('@'), array('`'));
239 }
240
247 {
248 Inline::parse(sprintf('{ foo: %sfoo }', $indicator));
249 }
250
251 public function getScalarIndicators()
252 {
253 return array(array('|'), array('>'));
254 }
255
262 {
263 ErrorAssert::assertDeprecationsAreTriggered('Not quoting a scalar starting with the "%" indicator character is deprecated since Symfony 3.1 and will throw a ParseException in 4.0.', function () {
264 Inline::parse('{ foo: %foo }');
265 });
266 }
267
271 public function testIsHash($array, $expected)
272 {
273 $this->assertSame($expected, Inline::isHash($array));
274 }
275
276 public function getDataForIsHash()
277 {
278 return array(
279 array(array(), false),
280 array(array(1, 2, 3), false),
281 array(array(2 => 1, 1 => 2, 0 => 3), true),
282 array(array('foo' => 1, 'bar' => 2), true),
283 );
284 }
285
286 public function getTestsForParse()
287 {
288 return array(
289 array('', ''),
290 array('null', null),
291 array('false', false),
292 array('true', true),
293 array('12', 12),
294 array('-12', -12),
295 array('"quoted string"', 'quoted string'),
296 array("'quoted string'", 'quoted string'),
297 array('12.30e+02', 12.30e+02),
298 array('0x4D2', 0x4D2),
299 array('02333', 02333),
300 array('.Inf', -log(0)),
301 array('-.Inf', log(0)),
302 array("'686e444'", '686e444'),
303 array('686e444', 646e444),
304 array('123456789123456789123456789123456789', '123456789123456789123456789123456789'),
305 array('"foo\r\nbar"', "foo\r\nbar"),
306 array("'foo#bar'", 'foo#bar'),
307 array("'foo # bar'", 'foo # bar'),
308 array("'#cfcfcf'", '#cfcfcf'),
309 array('::form_base.html.twig', '::form_base.html.twig'),
310
311 // Pre-YAML-1.2 booleans
312 array("'y'", 'y'),
313 array("'n'", 'n'),
314 array("'yes'", 'yes'),
315 array("'no'", 'no'),
316 array("'on'", 'on'),
317 array("'off'", 'off'),
318
319 array('2007-10-30', gmmktime(0, 0, 0, 10, 30, 2007)),
320 array('2007-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 2007)),
321 array('2007-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 2007)),
322 array('1960-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 1960)),
323 array('1730-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 1730)),
324
325 array('"a \\"string\\" with \'quoted strings inside\'"', 'a "string" with \'quoted strings inside\''),
326 array("'a \"string\" with ''quoted strings inside'''", 'a "string" with \'quoted strings inside\''),
327
328 // sequences
329 // urls are no key value mapping. see #3609. Valid yaml "key: value" mappings require a space after the colon
330 array('[foo, http://urls.are/no/mappings, false, null, 12]', array('foo', 'http://urls.are/no/mappings', false, null, 12)),
331 array('[ foo , bar , false , null , 12 ]', array('foo', 'bar', false, null, 12)),
332 array('[\'foo,bar\', \'foo bar\']', array('foo,bar', 'foo bar')),
333
334 // mappings
335 array('{foo:bar,bar:foo,false:false,null:null,integer:12}', array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12)),
336 array('{ foo : bar, bar : foo, false : false, null : null, integer : 12 }', array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12)),
337 array('{foo: \'bar\', bar: \'foo: bar\'}', array('foo' => 'bar', 'bar' => 'foo: bar')),
338 array('{\'foo\': \'bar\', "bar": \'foo: bar\'}', array('foo' => 'bar', 'bar' => 'foo: bar')),
339 array('{\'foo\'\'\': \'bar\', "bar\"": \'foo: bar\'}', array('foo\'' => 'bar', 'bar"' => 'foo: bar')),
340 array('{\'foo: \': \'bar\', "bar: ": \'foo: bar\'}', array('foo: ' => 'bar', 'bar: ' => 'foo: bar')),
341
342 // nested sequences and mappings
343 array('[foo, [bar, foo]]', array('foo', array('bar', 'foo'))),
344 array('[foo, {bar: foo}]', array('foo', array('bar' => 'foo'))),
345 array('{ foo: {bar: foo} }', array('foo' => array('bar' => 'foo'))),
346 array('{ foo: [bar, foo] }', array('foo' => array('bar', 'foo'))),
347
348 array('[ foo, [ bar, foo ] ]', array('foo', array('bar', 'foo'))),
349
350 array('[{ foo: {bar: foo} }]', array(array('foo' => array('bar' => 'foo')))),
351
352 array('[foo, [bar, [foo, [bar, foo]], foo]]', array('foo', array('bar', array('foo', array('bar', 'foo')), 'foo'))),
353
354 array('[foo, {bar: foo, foo: [foo, {bar: foo}]}, [foo, {bar: foo}]]', array('foo', array('bar' => 'foo', 'foo' => array('foo', array('bar' => 'foo'))), array('foo', array('bar' => 'foo')))),
355
356 array('[foo, bar: { foo: bar }]', array('foo', '1' => array('bar' => array('foo' => 'bar')))),
357 array('[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', array('foo', '@foo.baz', array('%foo%' => 'foo is %foo%', 'bar' => '%foo%'), true, '@service_container')),
358 );
359 }
360
362 {
363 return array(
364 array('', ''),
365 array('null', null),
366 array('false', false),
367 array('true', true),
368 array('12', 12),
369 array('-12', -12),
370 array('"quoted string"', 'quoted string'),
371 array("'quoted string'", 'quoted string'),
372 array('12.30e+02', 12.30e+02),
373 array('0x4D2', 0x4D2),
374 array('02333', 02333),
375 array('.Inf', -log(0)),
376 array('-.Inf', log(0)),
377 array("'686e444'", '686e444'),
378 array('686e444', 646e444),
379 array('123456789123456789123456789123456789', '123456789123456789123456789123456789'),
380 array('"foo\r\nbar"', "foo\r\nbar"),
381 array("'foo#bar'", 'foo#bar'),
382 array("'foo # bar'", 'foo # bar'),
383 array("'#cfcfcf'", '#cfcfcf'),
384 array('::form_base.html.twig', '::form_base.html.twig'),
385
386 array('2007-10-30', gmmktime(0, 0, 0, 10, 30, 2007)),
387 array('2007-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 2007)),
388 array('2007-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 2007)),
389 array('1960-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 1960)),
390 array('1730-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 1730)),
391
392 array('"a \\"string\\" with \'quoted strings inside\'"', 'a "string" with \'quoted strings inside\''),
393 array("'a \"string\" with ''quoted strings inside'''", 'a "string" with \'quoted strings inside\''),
394
395 // sequences
396 // urls are no key value mapping. see #3609. Valid yaml "key: value" mappings require a space after the colon
397 array('[foo, http://urls.are/no/mappings, false, null, 12]', array('foo', 'http://urls.are/no/mappings', false, null, 12)),
398 array('[ foo , bar , false , null , 12 ]', array('foo', 'bar', false, null, 12)),
399 array('[\'foo,bar\', \'foo bar\']', array('foo,bar', 'foo bar')),
400
401 // mappings
402 array('{foo:bar,bar:foo,false:false,null:null,integer:12}', (object) array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12)),
403 array('{ foo : bar, bar : foo, false : false, null : null, integer : 12 }', (object) array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12)),
404 array('{foo: \'bar\', bar: \'foo: bar\'}', (object) array('foo' => 'bar', 'bar' => 'foo: bar')),
405 array('{\'foo\': \'bar\', "bar": \'foo: bar\'}', (object) array('foo' => 'bar', 'bar' => 'foo: bar')),
406 array('{\'foo\'\'\': \'bar\', "bar\"": \'foo: bar\'}', (object) array('foo\'' => 'bar', 'bar"' => 'foo: bar')),
407 array('{\'foo: \': \'bar\', "bar: ": \'foo: bar\'}', (object) array('foo: ' => 'bar', 'bar: ' => 'foo: bar')),
408
409 // nested sequences and mappings
410 array('[foo, [bar, foo]]', array('foo', array('bar', 'foo'))),
411 array('[foo, {bar: foo}]', array('foo', (object) array('bar' => 'foo'))),
412 array('{ foo: {bar: foo} }', (object) array('foo' => (object) array('bar' => 'foo'))),
413 array('{ foo: [bar, foo] }', (object) array('foo' => array('bar', 'foo'))),
414
415 array('[ foo, [ bar, foo ] ]', array('foo', array('bar', 'foo'))),
416
417 array('[{ foo: {bar: foo} }]', array((object) array('foo' => (object) array('bar' => 'foo')))),
418
419 array('[foo, [bar, [foo, [bar, foo]], foo]]', array('foo', array('bar', array('foo', array('bar', 'foo')), 'foo'))),
420
421 array('[foo, {bar: foo, foo: [foo, {bar: foo}]}, [foo, {bar: foo}]]', array('foo', (object) array('bar' => 'foo', 'foo' => array('foo', (object) array('bar' => 'foo'))), array('foo', (object) array('bar' => 'foo')))),
422
423 array('[foo, bar: { foo: bar }]', array('foo', '1' => (object) array('bar' => (object) array('foo' => 'bar')))),
424 array('[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', array('foo', '@foo.baz', (object) array('%foo%' => 'foo is %foo%', 'bar' => '%foo%'), true, '@service_container')),
425
426 array('{}', new \stdClass()),
427 array('{ foo : bar, bar : {} }', (object) array('foo' => 'bar', 'bar' => new \stdClass())),
428 array('{ foo : [], bar : {} }', (object) array('foo' => array(), 'bar' => new \stdClass())),
429 array('{foo: \'bar\', bar: {} }', (object) array('foo' => 'bar', 'bar' => new \stdClass())),
430 array('{\'foo\': \'bar\', "bar": {}}', (object) array('foo' => 'bar', 'bar' => new \stdClass())),
431 array('{\'foo\': \'bar\', "bar": \'{}\'}', (object) array('foo' => 'bar', 'bar' => '{}')),
432
433 array('[foo, [{}, {}]]', array('foo', array(new \stdClass(), new \stdClass()))),
434 array('[foo, [[], {}]]', array('foo', array(array(), new \stdClass()))),
435 array('[foo, [[{}, {}], {}]]', array('foo', array(array(new \stdClass(), new \stdClass()), new \stdClass()))),
436 array('[foo, {bar: {}}]', array('foo', '1' => (object) array('bar' => new \stdClass()))),
437 );
438 }
439
440 public function getTestsForDump()
441 {
442 return array(
443 array('null', null),
444 array('false', false),
445 array('true', true),
446 array('12', 12),
447 array("'quoted string'", 'quoted string'),
448 array('!!float 1230', 12.30e+02),
449 array('1234', 0x4D2),
450 array('1243', 02333),
451 array('.Inf', -log(0)),
452 array('-.Inf', log(0)),
453 array("'686e444'", '686e444'),
454 array('"foo\r\nbar"', "foo\r\nbar"),
455 array("'foo#bar'", 'foo#bar'),
456 array("'foo # bar'", 'foo # bar'),
457 array("'#cfcfcf'", '#cfcfcf'),
458
459 array("'a \"string\" with ''quoted strings inside'''", 'a "string" with \'quoted strings inside\''),
460
461 array("'-dash'", '-dash'),
462 array("'-'", '-'),
463
464 // Pre-YAML-1.2 booleans
465 array("'y'", 'y'),
466 array("'n'", 'n'),
467 array("'yes'", 'yes'),
468 array("'no'", 'no'),
469 array("'on'", 'on'),
470 array("'off'", 'off'),
471
472 // sequences
473 array('[foo, bar, false, null, 12]', array('foo', 'bar', false, null, 12)),
474 array('[\'foo,bar\', \'foo bar\']', array('foo,bar', 'foo bar')),
475
476 // mappings
477 array('{ foo: bar, bar: foo, \'false\': false, \'null\': null, integer: 12 }', array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12)),
478 array('{ foo: bar, bar: \'foo: bar\' }', array('foo' => 'bar', 'bar' => 'foo: bar')),
479
480 // nested sequences and mappings
481 array('[foo, [bar, foo]]', array('foo', array('bar', 'foo'))),
482
483 array('[foo, [bar, [foo, [bar, foo]], foo]]', array('foo', array('bar', array('foo', array('bar', 'foo')), 'foo'))),
484
485 array('{ foo: { bar: foo } }', array('foo' => array('bar' => 'foo'))),
486
487 array('[foo, { bar: foo }]', array('foo', array('bar' => 'foo'))),
488
489 array('[foo, { bar: foo, foo: [foo, { bar: foo }] }, [foo, { bar: foo }]]', array('foo', array('bar' => 'foo', 'foo' => array('foo', array('bar' => 'foo'))), array('foo', array('bar' => 'foo')))),
490
491 array('[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', array('foo', '@foo.baz', array('%foo%' => 'foo is %foo%', 'bar' => '%foo%'), true, '@service_container')),
492
493 array('{ foo: { bar: { 1: 2, baz: 3 } } }', array('foo' => array('bar' => array(1 => 2, 'baz' => 3)))),
494 );
495 }
496
500 public function testParseTimestampAsUnixTimestampByDefault($yaml, $year, $month, $day, $hour, $minute, $second)
501 {
502 $this->assertSame(gmmktime($hour, $minute, $second, $month, $day, $year), Inline::parse($yaml));
503 }
504
508 public function testParseTimestampAsDateTimeObject($yaml, $year, $month, $day, $hour, $minute, $second)
509 {
510 $expected = new \DateTime($yaml);
511 $expected->setTimeZone(new \DateTimeZone('UTC'));
512 $expected->setDate($year, $month, $day);
513 $expected->setTime($hour, $minute, $second);
514
515 $this->assertEquals($expected, Inline::parse($yaml, Yaml::PARSE_DATETIME));
516 }
517
518 public function getTimestampTests()
519 {
520 return array(
521 'canonical' => array('2001-12-15T02:59:43.1Z', 2001, 12, 15, 2, 59, 43),
522 'ISO-8601' => array('2001-12-15t21:59:43.10-05:00', 2001, 12, 16, 2, 59, 43),
523 'spaced' => array('2001-12-15 21:59:43.10 -5', 2001, 12, 16, 2, 59, 43),
524 'date' => array('2001-12-15', 2001, 12, 15, 0, 0, 0),
525 );
526 }
527
531 public function testParseNestedTimestampListAsDateTimeObject($yaml, $year, $month, $day, $hour, $minute, $second)
532 {
533 $expected = new \DateTime($yaml);
534 $expected->setTimeZone(new \DateTimeZone('UTC'));
535 $expected->setDate($year, $month, $day);
536 $expected->setTime($hour, $minute, $second);
537
538 $expectedNested = array('nested' => array($expected));
539 $yamlNested = "{nested: [$yaml]}";
540
541 $this->assertEquals($expectedNested, Inline::parse($yamlNested, Yaml::PARSE_DATETIME));
542 }
543
547 public function testDumpDateTime($dateTime, $expected)
548 {
549 $this->assertSame($expected, Inline::dump($dateTime));
550 }
551
552 public function getDateTimeDumpTests()
553 {
554 $tests = array();
555
556 $dateTime = new \DateTime('2001-12-15 21:59:43', new \DateTimeZone('UTC'));
557 $tests['date-time-utc'] = array($dateTime, '2001-12-15T21:59:43+00:00');
558
559 $dateTime = new \DateTimeImmutable('2001-07-15 21:59:43', new \DateTimeZone('Europe/Berlin'));
560 $tests['immutable-date-time-europe-berlin'] = array($dateTime, '2001-07-15T21:59:43+02:00');
561
562 return $tests;
563 }
564
568 public function testParseBinaryData($data)
569 {
570 $this->assertSame('Hello world', Inline::parse($data));
571 }
572
573 public function getBinaryData()
574 {
575 return array(
576 'enclosed with double quotes' => array('!!binary "SGVsbG8gd29ybGQ="'),
577 'enclosed with single quotes' => array("!!binary 'SGVsbG8gd29ybGQ='"),
578 'containing spaces' => array('!!binary "SGVs bG8gd 29ybGQ="'),
579 );
580 }
581
585 public function testParseInvalidBinaryData($data, $expectedMessage)
586 {
587 $this->setExpectedExceptionRegExp('\Symfony\Component\Yaml\Exception\ParseException', $expectedMessage);
588
590 }
591
592 public function getInvalidBinaryData()
593 {
594 return array(
595 'length not a multiple of four' => array('!!binary "SGVsbG8d29ybGQ="', '/The normalized base64 encoded data \‍(data without whitespace characters\‍) length must be a multiple of four \‍(\d+ bytes given\‍)/'),
596 'invalid characters' => array('!!binary "SGVsbG8#d29ybGQ="', '/The base64 encoded data \‍(.*\‍) contains invalid characters/'),
597 'too many equals characters' => array('!!binary "SGVsbG8gd29yb==="', '/The base64 encoded data \‍(.*\‍) contains invalid characters/'),
598 'misplaced equals character' => array('!!binary "SGVsbG8gd29ybG=Q"', '/The base64 encoded data \‍(.*\‍) contains invalid characters/'),
599 );
600 }
601}
An exception for terminatinating execution or to throw for unit testing.
Inline implements a YAML parser/dumper for the YAML inline syntax.
Definition: Inline.php:25
static parse($value, $flags=0, $references=array())
Converts a YAML string to a PHP array.
Definition: Inline.php:43
static isHash(array $value)
Check if given array is hash or just normal indexed array.
Definition: Inline.php:226
static parseScalar($scalar, $flags=0, $delimiters=null, $stringDelimiters=array('"', "'"), &$i = 0, $evaluate = true, $references = array())
Parses a scalar to a YAML string.
Definition: Inline.php:285
static dump($value, $flags=0)
Dumps a given PHP variable to a YAML string.
Definition: Inline.php:128
testParseScalarWithNonEscapedBlackslashAtTheEndShouldThrowException()
@expectedException \Symfony\Component\Yaml\Exception\ParseException
Definition: InlineTest.php:98
testParse($yaml, $value)
@dataProvider getTestsForParse
Definition: InlineTest.php:23
testParseReferences($yaml, $expected)
@dataProvider getDataForParseReferences
Definition: InlineTest.php:157
testParseScalarWithNonEscapedBlackslashShouldThrowException()
@expectedException \Symfony\Component\Yaml\Exception\ParseException @expectedExceptionMessage Found u...
Definition: InlineTest.php:90
testParseUnquotedScalarStartingWithScalarIndicator($indicator)
@dataProvider getScalarIndicators @expectedException Symfony\Component\Yaml\Exception\ParseException ...
Definition: InlineTest.php:246
testParseWithMapObjectsPassingTrue($yaml, $value)
@group legacy @dataProvider getTestsForParseWithMapObjects
Definition: InlineTest.php:42
testParseInvalidBinaryData($data, $expectedMessage)
@dataProvider getInvalidBinaryData
Definition: InlineTest.php:585
testDumpDateTime($dateTime, $expected)
@dataProvider getDateTimeDumpTests
Definition: InlineTest.php:547
testParseNestedTimestampListAsDateTimeObject($yaml, $year, $month, $day, $hour, $minute, $second)
@dataProvider getTimestampTests
Definition: InlineTest.php:531
testParseInvalidMappingKeyShouldThrowException()
@expectedException \Symfony\Component\Yaml\Exception\ParseException
Definition: InlineTest.php:124
testParseUnquotedAsteriskFollowedByAComment()
@expectedException \Symfony\Component\Yaml\Exception\ParseException @expectedExceptionMessage A refer...
Definition: InlineTest.php:221
testParseMapReferenceInSequenceAsFifthArgument()
@group legacy
Definition: InlineTest.php:198
testParseScalarWithIncorrectlyDoubleQuotedStringShouldThrowException()
@expectedException \Symfony\Component\Yaml\Exception\ParseException
Definition: InlineTest.php:115
testParseUnquotedScalarStartingWithReservedIndicator($indicator)
@dataProvider getReservedIndicators @expectedException Symfony\Component\Yaml\Exception\ParseExceptio...
Definition: InlineTest.php:231
testParseUnquotedAsterisk()
@expectedException \Symfony\Component\Yaml\Exception\ParseException @expectedExceptionMessage A refer...
Definition: InlineTest.php:212
testParseTimestampAsUnixTimestampByDefault($yaml, $year, $month, $day, $hour, $minute, $second)
@dataProvider getTimestampTests
Definition: InlineTest.php:500
testParseReferencesAsFifthArgument($yaml, $expected)
@group legacy @dataProvider getDataForParseReferences
Definition: InlineTest.php:166
testDump($yaml, $value)
@dataProvider getTestsForDump
Definition: InlineTest.php:52
testParseWithMapObjects($yaml, $value)
@dataProvider getTestsForParseWithMapObjects
Definition: InlineTest.php:31
testParseBinaryData($data)
@dataProvider getBinaryData
Definition: InlineTest.php:568
testParseScalarWithIncorrectlyQuotedStringShouldThrowException()
@expectedException \Symfony\Component\Yaml\Exception\ParseException
Definition: InlineTest.php:106
testParseUnquotedScalarStartingWithPercentCharacter()
@group legacy @requires function Symfony\Bridge\PhpUnit\ErrorAssert::assertDeprecationsAreTriggered t...
Definition: InlineTest.php:261
testIsHash($array, $expected)
@dataProvider getDataForIsHash
Definition: InlineTest.php:271
testParseInvalidSequenceShouldThrowException()
@expectedException \Symfony\Component\Yaml\Exception\ParseException
Definition: InlineTest.php:141
testParseTimestampAsDateTimeObject($yaml, $year, $month, $day, $hour, $minute, $second)
@dataProvider getTimestampTests
Definition: InlineTest.php:508
testParseInvalidMappingShouldThrowException()
@expectedException \Symfony\Component\Yaml\Exception\ParseException
Definition: InlineTest.php:133
Yaml offers convenience methods to load and dump YAML.
Definition: Yaml.php:22
$tests
Definition: bench.php:104
$data
Definition: bench.php:6