testNewExceptionWithoutErrorsArray()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 6
rs 10
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