|
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
|
|
|
|