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

YamlReaderTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 0
cbo 3
dl 0
loc 27
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testReader() 0 13 1
A getTemporaryFilePath() 0 4 1
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