Completed
Push — master ( 9ae585...c62064 )
by Aimeos
03:07
created

ConfigTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 22 1
A getFrontend() 0 7 1
A getBackend() 0 7 1
1
<?php
2
3
4
namespace Aimeos\Shop\Tests\Unit\Base;
5
6
7
class ConfigTest extends \TYPO3\Flow\Tests\UnitTestCase
8
{
9
	private $object;
10
11
12
	public function setUp()
13
	{
14
		$this->object = new \Aimeos\Shop\Base\Config();
15
16
		$aimeos = new \Aimeos\Shop\Base\Aimeos();
17
18
		$resource = array(
19
			'host' => '127.0.0.1',
20
			'dbname' => 'flow',
21
			'user' => 'root',
22
			'password' => '',
23
		);
24
25
		$settings = array(
26
			'backend' => array( 'test' => 1 ),
27
			'frontend' => array( 'test' => 0 ),
28
		);
29
30
		$this->inject( $this->object, 'aimeos', $aimeos );
31
		$this->inject( $this->object, 'resource', $resource );
32
		$this->inject( $this->object, 'settings', $settings );
33
	}
34
35
36
	/**
37
	 * @test
38
	 */
39
	public function getFrontend()
40
	{
41
		$config = $this->object->get();
42
43
		$this->assertInstanceOf( '\Aimeos\MW\Config\Iface', $config );
44
		$this->assertEquals( 0, $config->get( 'test', -1 ) );
45
	}
46
47
48
	/**
49
	 * @test
50
	 */
51
	public function getBackend()
52
	{
53
		$config = $this->object->get( 'backend' );
54
55
		$this->assertInstanceOf( '\Aimeos\MW\Config\Iface', $config );
56
		$this->assertEquals( 1, $config->get( 'test', -1 ) );
57
	}
58
}