summaryrefslogtreecommitdiff
path: root/tests/Unit/Http/ResponseServiceProviderTest.php
blob: de252b9968e469f539ec01d3ca9428eb298da64e (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\Response;
use Engelsystem\Http\ResponseServiceProvider;
use Engelsystem\Test\Unit\ServiceProviderTest;
use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Component\HttpFoundation\Response as SymfonyResponse;

class ResponseServiceProviderTest extends ServiceProviderTest
{
    /**
     * @covers \Engelsystem\Http\ResponseServiceProvider::register()
     */
    public function testRegister()
    {
        /** @var Response|MockObject $response */
        $response = $this->getMockBuilder(Response::class)
            ->getMock();

        $app = $this->getApp();

        $this->setExpects($app, 'make', [Response::class], $response);
        $app->expects($this->exactly(3))
            ->method('instance')
            ->withConsecutive(
                [Response::class, $response],
                [SymfonyResponse::class, $response],
                ['response', $response]
            );

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