testExceptionWithoutMessage()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 11
rs 9.4285
cc 1
eloc 7
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Kickbox Bundle.
5
 *
6
 * (c) Abdoul Ndiaye <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Andi\KickBoxBundle\Tests\Exception;
13
14
use Andi\KickBoxBundle\Exception\EmptyContentException;
15
16
/**
17
 * Class EmptyContentExceptionTest
18
 *
19
 * @author Abdoul Ndiaye <[email protected]>
20
 *
21
 * @see Andi\KickBoxBundle\Exception\EmptyContentException
22
 */
23
class EmptyContentExceptionTest extends \PHPUnit_Framework_TestCase
24
{
25
    public function testExceptionWithMessage()
26
    {
27
        $message = 'message';
28
        $e       = new EmptyContentException($message, 500);
29
        $this->assertEquals(
30
            $message,
31
            $e->getMessage(),
32
            'The message should be returned.'
33
        );
34
35
        $this->assertEquals(500, $e->getCode());
36
    }
37
38
    public function testExceptionWithoutMessage()
39
    {
40
        $e = new EmptyContentException();
41
        $this->assertEquals(
42
            'The status is valid but the response is empty.',
43
            $e->getMessage(),
44
            'default message should be returned.'
45
        );
46
47
        $this->assertEquals(0, $e->getCode());
48
    }
49
}
50