summaryrefslogtreecommitdiff
path: root/tests/Unit/Exceptions/ExceptionsServiceProviderTest.php
blob: 01fb2f116a7689c6942713b78c406e31b949191a (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
<?php

namespace Engelsystem\Test\Unit\Exceptions;

use Engelsystem\Exceptions\BasicHandler as ExceptionHandler;
use Engelsystem\Exceptions\ExceptionsServiceProvider;
use Engelsystem\Exceptions\Handler;
use Engelsystem\Test\Unit\ServiceProviderTest;
use PHPUnit_Framework_MockObject_MockObject;

class ExceptionsServiceProviderTest extends ServiceProviderTest
{
    /**
     * @covers \Engelsystem\Exceptions\ExceptionsServiceProvider::register()
     */
    public function testRegister()
    {
        /** @var PHPUnit_Framework_MockObject_MockObject|ExceptionHandler $exceptionHandler */
        $exceptionHandler = $this->getMockBuilder(ExceptionHandler::class)
            ->getMock();

        $app = $this->getApp(['make', 'instance', 'bind']);

        $this->setExpects($app, 'make', [ExceptionHandler::class], $exceptionHandler);
        $this->setExpects($app, 'instance', ['error.handler', $exceptionHandler]);
        $this->setExpects($app, 'bind', [Handler::class, 'error.handler']);

        $serviceProvider = new ExceptionsServiceProvider($app);
        $serviceProvider->register();
    }
}