ParentsStrategyTest::testHandle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 13
c 1
b 0
f 1
rs 9.4285
cc 1
eloc 8
nc 1
nop 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: roma_bb8
5
 * Date: 30.03.18
6
 * Time: 10:53
7
 */
8
9
namespace Symfony\Component\Debug\Extension\Tests\Strategies;
10
11
12
use Exception;
13
use RuntimeException;
14
use InvalidArgumentException;
15
use Symfony\Component\Debug\Extension\ErrorHandler;
16
use Symfony\Component\Debug\Extension\Tests\TestCase;
17
use Symfony\Component\Debug\Extension\Strategies\ParentsStrategy;
18
use Symfony\Component\Debug\Extension\Tests\Handlers\ExceptionHandler;
19
use Symfony\Component\Debug\Extension\Exceptions\ErrorHandlerException;
20
use Symfony\Component\Debug\Extension\Tests\Handlers\RuntimeExceptionHandler;
21
use Symfony\Component\Debug\Extension\Tests\Handlers\InvalidArgumentExceptionHandler;
22
23
/**
24
 * Class ParentsStrategyTest
25
 * @package Symfony\Component\Debug\Extension\Tests\Strategies
26
 */
27
class ParentsStrategyTest extends TestCase {
28
29
    /**
30
     * @throws ErrorHandlerException
31
     */
32
    public function testHandle() {
33
34
        $errorHandler = new ErrorHandler(new ParentsStrategy());
35
36
        $errorHandler->registerHandler(new InvalidArgumentExceptionHandler(), InvalidArgumentException::class);
37
        $errorHandler->registerHandler(new RuntimeExceptionHandler(), RuntimeException::class);
38
        $errorHandler->registerHandler(new ExceptionHandler(), Exception::class);
39
40
        $errorHandler->handle(new RuntimeException('Hello World!'));
41
42
        $this->assertHandleException(self::getRootFolder() . RuntimeExceptionHandler::FILE);
43
        $this->assertHandleException(self::getRootFolder() . ExceptionHandler::FILE);
44
    }
45
}
46