SerialStrategyTest::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 RuntimeException;
13
use Symfony\Component\Debug\Extension\ErrorHandler;
14
use Symfony\Component\Debug\Extension\Tests\TestCase;
15
use Symfony\Component\Debug\Extension\Strategies\SerialStrategy;
16
use Symfony\Component\Debug\Extension\Tests\Handlers\ExceptionHandler;
17
use Symfony\Component\Debug\Extension\Exceptions\ErrorHandlerException;
18
use Symfony\Component\Debug\Extension\Tests\Handlers\RuntimeExceptionHandler;
19
use Symfony\Component\Debug\Extension\Tests\Handlers\InvalidArgumentExceptionHandler;
20
21
/**
22
 * Class SerialStrategyTest
23
 * @package Symfony\Component\Debug\Extension\Tests\Strategies
24
 */
25
class SerialStrategyTest extends TestCase {
26
27
    /**
28
     * @throws ErrorHandlerException
29
     */
30
    public function testHandle() {
31
32
        $errorHandler = new ErrorHandler(new SerialStrategy());
33
34
        $errorHandler->registerHandler(new ExceptionHandler());
35
        $errorHandler->registerHandler(new InvalidArgumentExceptionHandler());
36
        $errorHandler->registerHandler(new RuntimeExceptionHandler());
37
38
        $errorHandler->handle(new RuntimeException('Hello World!'));
39
40
        $this->assertHandleException(self::getRootFolder() . ExceptionHandler::FILE);
41
        $this->assertHandleException(self::getRootFolder() . InvalidArgumentExceptionHandler::FILE);
42
    }
43
}
44