Completed
Pull Request — master (#2)
by
unknown
01:26
created

HttpExceptionTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A userMessage() 0 8 1
A httpCode() 0 5 1
1
<?php
2
3
namespace DominionEnterprises;
4
5
use InvalidArgumentException;
6
use PHPUnit\Framework\TestCase;
7
8
/**
9
 * @coversDefaultClass \DominionEnterprises\HttpException
10
 */
11
final class HttpExceptionTest extends TestCase
12
{
13
    /**
14
     * @test
15
     * @covers ::__construct()
16
     * @covers ::getUserMessage()
17
     */
18
    public function userMessage()
19
    {
20
        $eWithNull = new HttpException('message', 1, 1, null, null);
21
        $eWithUserMessage = new HttpException('message', 1, 1, null, 'a user message');
22
23
        $this->assertSame('message', $eWithNull->getUserMessage());
24
        $this->assertSame('a user message', $eWithUserMessage->getUserMessage());
25
    }
26
27
    /**
28
     * @test
29
     * @covers ::__construct()
30
     * @covers ::getHttpStatusCode()
31
     */
32
    public function httpCode()
33
    {
34
        $e = new HttpException('message', 1);
35
        $this->assertSame(1, $e->getHttpStatusCode());
36
    }
37
}
38