2017-10-31 13:40:13 +01:00
|
|
|
<?php
|
|
|
|
|
2017-10-31 14:23:23 +01:00
|
|
|
namespace Engelsystem\Test\Unit\Exceptions;
|
2017-10-31 13:40:13 +01:00
|
|
|
|
2017-11-20 17:08:05 +01:00
|
|
|
use Engelsystem\Exceptions\BasicHandler as ExceptionHandler;
|
2017-10-31 13:40:13 +01:00
|
|
|
use Engelsystem\Exceptions\ExceptionsServiceProvider;
|
2017-11-20 17:08:05 +01:00
|
|
|
use Engelsystem\Exceptions\Handler;
|
2017-10-31 14:15:19 +01:00
|
|
|
use Engelsystem\Test\Unit\ServiceProviderTest;
|
2017-10-31 13:40:13 +01:00
|
|
|
use PHPUnit_Framework_MockObject_MockObject;
|
|
|
|
|
2017-10-31 14:15:19 +01:00
|
|
|
class ExceptionsServiceProviderTest extends ServiceProviderTest
|
2017-10-31 13:40:13 +01:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @covers \Engelsystem\Exceptions\ExceptionsServiceProvider::register()
|
|
|
|
*/
|
|
|
|
public function testRegister()
|
|
|
|
{
|
|
|
|
/** @var PHPUnit_Framework_MockObject_MockObject|ExceptionHandler $exceptionHandler */
|
|
|
|
$exceptionHandler = $this->getMockBuilder(ExceptionHandler::class)
|
|
|
|
->getMock();
|
|
|
|
|
2017-11-20 17:08:05 +01:00
|
|
|
$app = $this->getApp(['make', 'instance', 'bind']);
|
2017-10-31 13:40:13 +01:00
|
|
|
|
2017-10-31 14:15:19 +01:00
|
|
|
$this->setExpects($app, 'make', [ExceptionHandler::class], $exceptionHandler);
|
|
|
|
$this->setExpects($app, 'instance', ['error.handler', $exceptionHandler]);
|
2017-11-20 17:08:05 +01:00
|
|
|
$this->setExpects($app, 'bind', [Handler::class, 'error.handler']);
|
2017-10-31 13:40:13 +01:00
|
|
|
|
|
|
|
$serviceProvider = new ExceptionsServiceProvider($app);
|
|
|
|
$serviceProvider->register();
|
|
|
|
}
|
|
|
|
}
|