blob: 26eddb755c77633b54fcb7ba098505d38c1997c2 (
plain)
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
|
<?php
namespace Engelsystem\Test\Exceptions;
use Engelsystem\Application;
use Engelsystem\Exceptions\ExceptionsServiceProvider;
use Engelsystem\Exceptions\Handler as ExceptionHandler;
use PHPUnit\Framework\TestCase;
use PHPUnit_Framework_MockObject_MockObject;
class ExceptionsServiceProviderTest extends TestCase
{
/**
* @covers \Engelsystem\Exceptions\ExceptionsServiceProvider::register()
*/
public function testRegister()
{
/** @var PHPUnit_Framework_MockObject_MockObject|ExceptionHandler $exceptionHandler */
$exceptionHandler = $this->getMockBuilder(ExceptionHandler::class)
->getMock();
/** @var PHPUnit_Framework_MockObject_MockObject|Application $app */
$app = $this->getMockBuilder(Application::class)
->setMethods(['make', 'instance'])
->getMock();
$app->expects($this->once())
->method('make')
->with(ExceptionHandler::class)
->willReturn($exceptionHandler);
$app->expects($this->once())
->method('instance')
->with('error.handler', $exceptionHandler);
$serviceProvider = new ExceptionsServiceProvider($app);
$serviceProvider->register();
}
}
|