InvalidServiceExceptionTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 40
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A testInheritance() 0 4 1
A testDefaultState() 0 6 1
A testInitialState() 0 12 1
1
<?php
2
3
/*
4
 * This file is part of the Lug package.
5
 *
6
 * (c) Eric GELOEN <[email protected]>
7
 *
8
 * For the full copyright and license information, please read the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Lug\Component\Locale\Tests\Exception;
13
14
use Lug\Component\Registry\Exception\InvalidArgumentException;
15
use Lug\Component\Registry\Exception\InvalidServiceException;
16
17
/**
18
 * @author GeLo <[email protected]>
19
 */
20
class InvalidServiceExceptionTest extends \PHPUnit_Framework_TestCase
21
{
22
    /**
23
     * @var InvalidServiceException
24
     */
25
    private $exception;
26
27
    /**
28
     * {@inheritdoc}
29
     */
30
    protected function setUp()
31
    {
32
        $this->exception = new InvalidServiceException();
33
    }
34
35
    public function testInheritance()
36
    {
37
        $this->assertInstanceOf(InvalidArgumentException::class, $this->exception);
38
    }
39
40
    public function testDefaultState()
41
    {
42
        $this->assertSame('', $this->exception->getMessage());
43
        $this->assertSame(0, $this->exception->getCode());
44
        $this->assertNull($this->exception->getPrevious());
45
    }
46
47
    public function testInitialState()
48
    {
49
        $this->exception = new InvalidServiceException(
50
            $message = 'foo',
51
            $code = 123,
52
            $previous = new \Exception()
53
        );
54
55
        $this->assertSame($message, $this->exception->getMessage());
56
        $this->assertSame($code, $this->exception->getCode());
57
        $this->assertSame($previous, $this->exception->getPrevious());
58
    }
59
}
60