SimpleStrategyTest::testHandle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 12
c 1
b 0
f 1
rs 9.4285
cc 1
eloc 7
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\SimpleStrategy;
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 SimpleStrategyTest
25
 * @package Symfony\Component\Debug\Extension\Tests\Strategies
26
 */
27
class SimpleStrategyTest extends TestCase {
28
29
    /**
30
     * @throws RuntimeException
31
     * @throws ErrorHandlerException
32
     */
33
    public function testHandle() {
34
35
        $errorHandler = new ErrorHandler(new SimpleStrategy());
36
37
        $errorHandler->registerHandler(new ExceptionHandler(), Exception::class);
38
        $errorHandler->registerHandler(new InvalidArgumentExceptionHandler(), InvalidArgumentException::class);
39
        $errorHandler->registerHandler(new RuntimeExceptionHandler(), RuntimeException::class);
40
41
        $errorHandler->handle(new RuntimeException('Hello World!'));
42
43
        $this->assertHandleException(self::getRootFolder() . RuntimeExceptionHandler::FILE);
44
    }
45
}
46