Passed
Push — master ( 4b5f24...20219f )
by Brent
02:15
created

DefaultConfiguratorTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 25
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A test_default_construct() 0 3 1
A test_construct_merges_config() 0 8 1
A test_construct_throws_exception_with_unknown_driver() 0 5 1
1
<?php
2
3
namespace brendt\tests\phpunit\config;
4
5
use brendt\image\config\DefaultConfigurator;
6
7
class DefaultConfiguratorTest extends \PHPUnit_Framework_TestCase {
8
9
    public function test_default_construct() {
10
        new DefaultConfigurator();
11
    }
12
13
    public function test_construct_merges_config() {
14
        $configurator = new DefaultConfigurator([
15
            'enableCache' => true
16
        ]);
17
18
        $this->assertTrue($configurator->getConfig()['enableCache']);
19
        $this->assertEquals('gd', $configurator->getConfig()['driver']);
20
    }
21
22
    /**
23
     * @expectedException brendt\image\exception\InvalidConfigurationException
24
     */
25
    public function test_construct_throws_exception_with_unknown_driver() {
26
        new DefaultConfigurator([
27
            'driver' => 'unknown'
28
        ]);
29
    }
30
31
}
32