2017-11-01 14:47:09 +01:00
|
|
|
<?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;
|
2018-09-02 02:09:56 +02:00
|
|
|
use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
|
2017-11-01 14:47:09 +01:00
|
|
|
|
|
|
|
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);
|
2018-09-02 02:09:56 +02:00
|
|
|
$app->expects($this->exactly(3))
|
|
|
|
->method('instance')
|
|
|
|
->withConsecutive(
|
|
|
|
[Request::class, $request],
|
|
|
|
[SymfonyRequest::class, $request],
|
|
|
|
['request', $request]
|
|
|
|
);
|
2017-11-01 14:47:09 +01:00
|
|
|
|
|
|
|
$serviceProvider = new RequestServiceProvider($app);
|
|
|
|
$serviceProvider->register();
|
|
|
|
}
|
|
|
|
}
|