Completed
Push — refactor ( a403e4...c06c99 )
by Bogdan
02:18
created

OutOfBoundsExceptionTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 20
c 0
b 0
f 0
wmc 4
lcom 0
cbo 3
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testCatchExceptionByInterface() 0 8 2
A testCatchExceptionByCoreException() 0 8 2
1
<?php declare(strict_types=1);
2
3
/*
4
 * This file is part of the pinepain/php-object-maps PHP library.
5
 *
6
 * Copyright (c) 2016-2017 Bogdan Padalko <[email protected]>
7
 *
8
 * Licensed under the MIT license: http://opensource.org/licenses/MIT
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code or visit http://opensource.org/licenses/MIT
12
 */
13
14
namespace Pinepain\ObjectMaps\Tests\Exceptions;
15
16
17
use PHPUnit\Framework\TestCase;
18
19
use Pinepain\ObjectMaps\Exceptions\OutOfBoundsException;
20
use Pinepain\ObjectMaps\Exceptions\ObjectMapExceptionInterface;
21
22
23
class OutOfBoundsExceptionTest extends TestCase
24
{
25
    public function testCatchExceptionByInterface()
26
    {
27
        try {
28
            throw  new OutOfBoundsException('test');
29
        } catch (ObjectMapExceptionInterface $e) {
30
            $this->assertSame('test', $e->getMessage());
31
        }
32
    }
33
34
    public function testCatchExceptionByCoreException()
35
    {
36
        try {
37
            throw new OutOfBoundsException('test');
38
        } catch (\OutOfBoundsException $e) {
39
            $this->assertSame('test', $e->getMessage());
40
        }
41
    }
42
}
43