ConfigurationSetTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testSet() 0 22 1
A testSetObject() 0 16 1
A testInvalidClass() 0 5 1
1
<?php
2
3
namespace EquipTests\Configuration;
4
5
use Auryn\Injector;
6
use Equip\Configuration\ConfigurationInterface;
7
use Equip\Configuration\ConfigurationSet;
8
use PHPUnit_Framework_TestCase as TestCase;
9
10
class ConfigurationSetTest extends TestCase
11
{
12
    public function testSet()
13
    {
14
        $config = $this->getMock(ConfigurationInterface::class);
0 ignored issues
show
Deprecated Code introduced by
The method PHPUnit_Framework_TestCase::getMock() has been deprecated with message: Method deprecated since Release 5.4.0

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
15
        $injector = $this->getMock(Injector::class);
0 ignored issues
show
Deprecated Code introduced by
The method PHPUnit_Framework_TestCase::getMock() has been deprecated with message: Method deprecated since Release 5.4.0

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
16
17
        $injector
18
            ->expects($this->once())
19
            ->method('make')
20
            ->with(get_class($config))
21
            ->willReturn($config);
22
23
        $config
24
            ->expects($this->once())
25
            ->method('apply')
26
            ->with($injector);
27
28
        $set = new ConfigurationSet([
29
            get_class($config),
30
        ]);
31
32
        $set->apply($injector);
33
    }
34
35
    public function testSetObject()
36
    {
37
        $config = $this->getMock(ConfigurationInterface::class);
0 ignored issues
show
Deprecated Code introduced by
The method PHPUnit_Framework_TestCase::getMock() has been deprecated with message: Method deprecated since Release 5.4.0

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
38
        $injector = $this->getMock(Injector::class);
0 ignored issues
show
Deprecated Code introduced by
The method PHPUnit_Framework_TestCase::getMock() has been deprecated with message: Method deprecated since Release 5.4.0

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
39
40
        $config
41
            ->expects($this->once())
42
            ->method('apply')
43
            ->with($injector);
44
45
        $set = new ConfigurationSet([
46
            $config,
47
        ]);
48
49
        $set->apply($injector);
50
    }
51
52
    /**
53
     * @expectedException Equip\Exception\ConfigurationException
54
     * @expectedExceptionRegExp /class .* must implement ConfigurationInterface/i
55
     */
56
    public function testInvalidClass()
57
    {
58
        $set = new ConfigurationSet;
59
        $set->withValue('\stdClass');
60
    }
61
}
62