Completed
Push — master ( 121d2a...008d57 )
by Eymen
11s
created

testNewExceptionWithErrorsArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
namespace Passbook\Tests\Exception;
4
5
use Passbook\Exception\PassInvalidException;
6
7
class PassInvalidExceptionTest extends \PHPUnit_Framework_TestCase
8
{
9
    public function testNewExceptionWithoutErrorsArray()
10
    {
11
        $exception = new PassInvalidException();
12
13
        self::assertTrue(is_array($exception->getErrors()));
14
        self::assertEmpty($exception->getErrors());
15
    }
16
17
    public function testNewExceptionWithErrorsArray()
18
    {
19
        $errors = array('error 1', 'error 2');
20
        $exception = new PassInvalidException('', $errors);
21
22
        self::assertTrue(is_array($exception->getErrors()));
23
        self::assertEquals($errors, $exception->getErrors());
24
    }
25
26
    public function testNewExceptionWithMessageAndArray()
27
    {
28
        $errors = array('error 1', 'error 2');
29
        $exception = new PassInvalidException('Exception message', $errors);
30
31
        self::assertTrue(is_array($exception->getErrors()));
32
        self::assertEquals($errors, $exception->getErrors());
33
        self::assertSame('Exception message', $exception->getMessage());
34
    }
35
36
}
37