summaryrefslogtreecommitdiff
path: root/tests/Unit/Http/Psr7ServiceProviderTest.php
blob: 25c2f6e3d256fa9770e14ffb0150eea87c262cd8 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php

namespace Engelsystem\Test\Unit\Http;

use Engelsystem\Application;
use Engelsystem\Http\Psr7ServiceProvider;
use Engelsystem\Test\Unit\ServiceProviderTest;
use Psr\Http\Message\ResponseFactoryInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestFactoryInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\StreamFactoryInterface;
use Psr\Http\Message\UploadedFileFactoryInterface;
use Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface;

class Psr7ServiceProviderTest extends ServiceProviderTest
{
    /**
     * @covers \Engelsystem\Http\Psr7ServiceProvider::register()
     */
    public function testRegister()
    {
        $app = new Application;

        $serviceProvider = new Psr7ServiceProvider($app);
        $serviceProvider->register();

        foreach (
            [
                'psr7.factory.request',
                'psr7.factory.response',
                'psr7.factory.upload',
                'psr7.factory.stream',
                'psr7.factory',
                'psr7.request',
                'psr7.response',
                ServerRequestFactoryInterface::class,
                ResponseFactoryInterface::class,
                UploadedFileFactoryInterface::class,
                StreamFactoryInterface::class,
                HttpMessageFactoryInterface::class,
                ServerRequestInterface::class,
                ResponseInterface::class,
            ] as $id
        ) {
            $this->assertTrue(
                $app->has($id),
                sprintf('"%s" is not registered', $id)
            );
        }
    }
}