| Total Complexity | 6 |
| Total Lines | 53 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | class YamlTest extends TestCase |
||
| 13 | { |
||
| 14 | protected function doTearDown() |
||
| 15 | { |
||
| 16 | Yaml::$classes = array(); |
||
| 17 | parent::doTearDown(); |
||
| 18 | } |
||
| 19 | |||
| 20 | public function testFileParsing() |
||
| 21 | { |
||
| 22 | $path = __DIR__ . '/../../../bitbucket-pipelines.yml'; |
||
| 23 | |||
| 24 | $struct = Yaml::file($path); |
||
| 25 | |||
| 26 | self::assertIsArray($struct); |
||
| 27 | } |
||
| 28 | |||
| 29 | /** |
||
| 30 | */ |
||
| 31 | public function testCreateFromNonExistentFile() |
||
| 32 | { |
||
| 33 | $this->expectException('InvalidArgumentException'); |
||
| 34 | $this->expectExceptionMessage('not a readable file: \'xxx\''); |
||
| 35 | |||
| 36 | Yaml::file('xxx'); |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Non-YAML files normally parse again to some array |
||
| 41 | */ |
||
| 42 | public function testNonYamlFile() |
||
| 43 | { |
||
| 44 | $array = Yaml::file(__FILE__); |
||
| 45 | |||
| 46 | self::assertNull($array); |
||
| 47 | } |
||
| 48 | |||
| 49 | public function testYamlNull() |
||
| 55 | } |
||
| 56 | |||
| 57 | public function testNoParserAvailable() |
||
| 58 | { |
||
| 59 | Yaml::$classes = array(''); |
||
| 67 |