summaryrefslogtreecommitdiff
path: root/tests/Unit/Middleware/RequestHandlerServiceProviderTest.php
blob: 281016b56d5804c5dceb37d5d4f923f2fdf52ea2 (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
<?php

namespace Engelsystem\Test\Unit\Middleware;

use Engelsystem\Middleware\RequestHandler;
use Engelsystem\Middleware\RequestHandlerServiceProvider;
use Engelsystem\Test\Unit\ServiceProviderTest;
use PHPUnit\Framework\MockObject\MockObject;

class RequestHandlerServiceProviderTest extends ServiceProviderTest
{
    /**
     * @covers \Engelsystem\Middleware\RequestHandlerServiceProvider::register()
     */
    public function testRegister()
    {
        /** @var RequestHandler|MockObject $requestHandler */
        $requestHandler = $this->createMock(RequestHandler::class);

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

        $app->expects($this->once())
            ->method('make')
            ->with(RequestHandler::class)
            ->willReturn($requestHandler);
        $app->expects($this->once())
            ->method('instance')
            ->with('request.handler', $requestHandler);
        $app->expects($this->once())
            ->method('bind')
            ->with(RequestHandler::class, 'request.handler');

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