Passed
Pull Request — master (#103)
by Razvan
15:39 queued 12:47
created

PassInvalidExceptionTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 30
rs 10
c 0
b 0
f 0
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 = array('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 = array('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
}
38