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

testCatchExceptionByCoreException()   A

Complexity

Conditions 2
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 2
eloc 5
nc 1
nop 0
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\OverflowException;
20
use Pinepain\ObjectMaps\Exceptions\ObjectMapExceptionInterface;
21
22
23
class OverflowExceptionTest extends TestCase
24
{
25
    public function testCatchExceptionByInterface()
26
    {
27
        try {
28
            throw  new OverflowException('test');
29
        } catch (ObjectMapExceptionInterface $e) {
30
            $this->assertSame('test', $e->getMessage());
31
        }
32
    }
33
34
    public function testCatchExceptionByCoreException()
35
    {
36
        try {
37
            throw new OverflowException('test');
38
        } catch (\OverflowException $e) {
39
            $this->assertSame('test', $e->getMessage());
40
        }
41
    }
42
}
43