2018-01-18 19:01:34 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Engelsystem\Test\Unit\Http;
|
|
|
|
|
2019-03-17 18:17:33 +01:00
|
|
|
use Engelsystem\Application;
|
2018-01-18 19:01:34 +01:00
|
|
|
use Engelsystem\Http\Psr7ServiceProvider;
|
|
|
|
use Engelsystem\Test\Unit\ServiceProviderTest;
|
2019-03-17 18:17:33 +01:00
|
|
|
use Psr\Http\Message\ResponseFactoryInterface;
|
2018-01-18 19:01:34 +01:00
|
|
|
use Psr\Http\Message\ResponseInterface;
|
2019-03-17 18:17:33 +01:00
|
|
|
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;
|
2018-01-18 19:01:34 +01:00
|
|
|
|
|
|
|
class Psr7ServiceProviderTest extends ServiceProviderTest
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @covers \Engelsystem\Http\Psr7ServiceProvider::register()
|
|
|
|
*/
|
|
|
|
public function testRegister()
|
|
|
|
{
|
2019-11-10 23:26:23 +01:00
|
|
|
$app = new Application();
|
2018-01-18 19:01:34 +01:00
|
|
|
|
|
|
|
$serviceProvider = new Psr7ServiceProvider($app);
|
|
|
|
$serviceProvider->register();
|
2019-03-17 18:17:33 +01:00
|
|
|
|
|
|
|
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)
|
|
|
|
);
|
|
|
|
}
|
2018-01-18 19:01:34 +01:00
|
|
|
}
|
|
|
|
}
|