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
12namespace Symfony\Component\Yaml\Tests;
13
14use PHPUnit\Framework\TestCase;
15use Symfony\Component\Yaml\Yaml;
16
17class YamlTest extends TestCase
18{
19    public function testParseAndDump()
20    {
21        $data = ['lorem' => 'ipsum', 'dolor' => 'sit'];
22        $yml = Yaml::dump($data);
23        $parsed = Yaml::parse($yml);
24        $this->assertEquals($data, $parsed);
25    }
26
27    /**
28     * @expectedException \InvalidArgumentException
29     * @expectedExceptionMessage The indentation must be greater than zero
30     */
31    public function testZeroIndentationThrowsException()
32    {
33        Yaml::dump(['lorem' => 'ipsum', 'dolor' => 'sit'], 2, 0);
34    }
35
36    /**
37     * @expectedException \InvalidArgumentException
38     * @expectedExceptionMessage The indentation must be greater than zero
39     */
40    public function testNegativeIndentationThrowsException()
41    {
42        Yaml::dump(['lorem' => 'ipsum', 'dolor' => 'sit'], 2, -4);
43    }
44}
45