Passed
Push — master ( d86a4e...217e0a )
by Aimeos
02:12
created

ProtectTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 5
eloc 9
c 2
b 0
f 0
dl 0
loc 34
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A testGet() 0 3 1
A testGetProtected() 0 4 1
A testApply() 0 3 1
A testSet() 0 3 1
1
<?php
2
3
namespace Aimeos\Base\Config\Decorator;
4
5
6
class ProtectTest extends \PHPUnit\Framework\TestCase
7
{
8
	private $object;
9
10
11
	protected function setUp() : void
12
	{
13
		$conf = new \Aimeos\Base\Config\PHPArray( [] );
14
		$this->object = new \Aimeos\Base\Config\Decorator\Protect( $conf, array( 'client', 'admin' ) );
15
	}
16
17
18
	public function testGet()
19
	{
20
		$this->assertEquals( 'value', $this->object->get( 'client/html/test', 'value' ) );
21
	}
22
23
24
	public function testGetProtected()
25
	{
26
		$this->expectException( 'Aimeos\Base\Config\Exception' );
27
		$this->object->get( 'resource/db' );
28
	}
29
30
31
	public function testSet()
32
	{
33
		$this->assertInstanceOf( \Aimeos\Base\Config\Iface::class, $this->object->set( 'client/html/test', 'testval' ) );
34
	}
35
36
37
	public function testApply()
38
	{
39
		$this->assertInstanceOf( \Aimeos\Base\Config\Iface::class, $this->object->apply( ['resource' => ['db' => []]] ) );
40
	}
41
}
42