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

23 lines
808 B
PHP
Raw 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 () {
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 () {
expect(function () { readConfiguration(__DIR__.'/fixtures/read-configuration/invalid.json'); })
2016-08-05 15:10:28 +02:00
->toThrow(new InvalidArgumentException());
});
});