forked from laravel/framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHandlerTest.php
More file actions
44 lines (36 loc) · 1.64 KB
/
HandlerTest.php
File metadata and controls
44 lines (36 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
use Illuminate\Exception\Handler;
use Mockery as m;
class HandlerTest extends PHPUnit_Framework_TestCase
{
protected function setUp()
{
$this->responsePreparer = m::mock('Illuminate\Support\Contracts\ResponsePreparerInterface');
$this->plainDisplayer = m::mock('Illuminate\Exception\ExceptionDisplayerInterface');
$this->debugDisplayer = m::mock('Illuminate\Exception\ExceptionDisplayerInterface');
$this->handler = new Handler($this->responsePreparer, $this->plainDisplayer, $this->debugDisplayer);
}
public function testHandleErrorExceptionArguments()
{
$error = null;
try {
$this->handler->handleError(E_USER_ERROR, 'message', '/path/to/file', 111, array());
} catch (ErrorException $error) {}
$this->assertInstanceOf('ErrorException', $error);
$this->assertSame(E_USER_ERROR, $error->getSeverity(), 'error handler should not modify severity');
$this->assertSame('message', $error->getMessage(), 'error handler should not modify message');
$this->assertSame('/path/to/file', $error->getFile(), 'error handler should not modify path');
$this->assertSame(111, $error->getLine(), 'error handler should not modify line number');
$this->assertSame(0, $error->getCode(), 'error handler should use 0 exception code');
}
public function testHandleErrorOptionalArguments()
{
$error = null;
try {
$this->handler->handleError(E_USER_ERROR, 'message');
} catch (ErrorException $error) {}
$this->assertInstanceOf('ErrorException', $error);
$this->assertSame('', $error->getFile(), 'error handler should use correct default path');
$this->assertSame(0, $error->getLine(), 'error handler should use correct default line');
}
}