docker-compose-viz/spec/read-configuratoin.php

27 lines
846 B
PHP
Raw Permalink Normal View History

2016-08-05 15:10:28 +02:00
<?php
use function PMSIpilot\DockerComposeViz\readConfiguration;
2016-08-05 20:40:29 +02:00
require_once __DIR__.'/../vendor/autoload.php';
2016-08-05 15:10:28 +02:00
2016-08-05 20:40:29 +02:00
describe('Reading configuration', function () {
it('should check if file exists', function () {
2016-08-05 20:53:13 +02:00
expect(function () {
readConfiguration(uniqid());
})
2016-08-05 15:10:28 +02:00
->toThrow(new InvalidArgumentException());
});
2016-08-05 20:40:29 +02:00
it('should parse YAML and return an array', function () {
2016-08-05 15:10:28 +02:00
expect(readConfiguration(__DIR__.'/fixtures/read-configuration/valid.yml'))
->toBe(['version' => 2, 'services' => ['foo' => ['image' => 'bar']]]);
});
2016-08-05 20:40:29 +02:00
it('should report if YAML is invalid', function () {
2016-08-05 20:53:13 +02:00
expect(function () {
readConfiguration(__DIR__.'/fixtures/read-configuration/invalid.yml');
2016-08-05 20:53:13 +02:00
})
2016-08-05 15:10:28 +02:00
->toThrow(new InvalidArgumentException());
});
});