PassInvalidExceptionTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 13
c 2
b 0
f 0
dl 0
loc 27
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testNewExceptionWithoutErrorsArray() 0 6 1
A testNewExceptionWithMessageAndArray() 0 8 1
A testNewExceptionWithErrorsArray() 0 7 1
1
<?php
2
3
namespace Passbook\Tests\Exception;
4
5
use Passbook\Exception\PassInvalidException;
6
use PHPUnit\Framework\TestCase;
7
8
class PassInvalidExceptionTest extends TestCase
9
{
10
    public function testNewExceptionWithoutErrorsArray()
11
    {
12
        $exception = new PassInvalidException();
13
14
        self::assertTrue(is_array($exception->getErrors()));
15
        self::assertEmpty($exception->getErrors());
16
    }
17
18
    public function testNewExceptionWithErrorsArray()
19
    {
20
        $errors = ['error 1', 'error 2'];
21
        $exception = new PassInvalidException('', $errors);
22
23
        self::assertTrue(is_array($exception->getErrors()));
24
        self::assertEquals($errors, $exception->getErrors());
25
    }
26
27
    public function testNewExceptionWithMessageAndArray()
28
    {
29
        $errors = ['error 1', 'error 2'];
30
        $exception = new PassInvalidException('Exception message', $errors);
31
32
        self::assertTrue(is_array($exception->getErrors()));
33
        self::assertEquals($errors, $exception->getErrors());
34
        self::assertSame('Exception message', $exception->getMessage());
35
    }
36
}
37