summaryrefslogtreecommitdiff
path: root/tests/Unit/Http/RequestServiceProviderTest.php
blob: 1a42ae869391e54b215617660756292a1b5174ce (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\Http;

use Engelsystem\Http\Request;
use Engelsystem\Http\RequestServiceProvider;
use Engelsystem\Test\Unit\ServiceProviderTest;
use PHPUnit_Framework_MockObject_MockObject as MockObject;
use Symfony\Component\HttpFoundation\Request as SymfonyRequest;

class RequestServiceProviderTest extends ServiceProviderTest
{
    /**
     * @covers \Engelsystem\Http\RequestServiceProvider::register()
     */
    public function testRegister()
    {
        /** @var MockObject|Request $request */
        $request = $this->getMockBuilder(Request::class)
            ->getMock();

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

        $this->setExpects($app, 'call', [[Request::class, 'createFromGlobals']], $request);
        $app->expects($this->exactly(3))
            ->method('instance')
            ->withConsecutive(
                [Request::class, $request],
                [SymfonyRequest::class, $request],
                ['request', $request]
            );

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