Completed
Push — master ( bb7259...dc298a )
by Sam
03:00
created

YamlReaderTest::testReader()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 13
rs 9.4285
cc 1
eloc 8
nc 1
nop 0
1
<?php
2
3
namespace Jalle19\StatusManager\Test\Configuration\Reader;
4
5
use Jalle19\StatusManager\Configuration\Reader\YamlReader;
6
use Symfony\Component\Yaml\Yaml;
7
8
/**
9
 * Class YamlReaderTest
10
 * @package   Jalle19\StatusManager\Test\Configuration\Reader
11
 * @copyright Copyright &copy; Sam Stenvall 2016-
12
 * @license   https://www.gnu.org/licenses/gpl.html The GNU General Public License v2.0
13
 */
14
class YamlReaderTest extends \PHPUnit_Framework_TestCase
15
{
16
17
	public function testReader()
18
	{
19
		$configuration = [
20
			'foo' => 'bar',
21
			'baz',
22
		];
23
24
		$tmpFile = $this->getTemporaryFilePath();
25
		file_put_contents($tmpFile, Yaml::dump($configuration));
26
27
		$reader = new YamlReader($tmpFile);
28
		$this->assertEquals($configuration, $reader->readConfiguration());
29
	}
30
31
32
	/**
33
	 * @return string
34
	 */
35
	private function getTemporaryFilePath()
36
	{
37
		return tempnam(sys_get_temp_dir(), 'yaml');
38
	}
39
40
}
41