2017-10-31 13:40:13 +01:00
|
|
|
<?php
|
|
|
|
|
2018-09-04 18:35:13 +02:00
|
|
|
namespace Engelsystem\Test\Unit\Http;
|
2017-10-31 13:40:13 +01:00
|
|
|
|
2018-08-22 03:10:08 +02:00
|
|
|
use Engelsystem\Http\UrlGenerator;
|
2018-10-25 18:53:05 +02:00
|
|
|
use Engelsystem\Http\UrlGeneratorInterface;
|
2018-08-22 03:10:08 +02:00
|
|
|
use Engelsystem\Http\UrlGeneratorServiceProvider;
|
2017-10-31 14:15:19 +01:00
|
|
|
use Engelsystem\Test\Unit\ServiceProviderTest;
|
2019-04-24 10:45:00 +02:00
|
|
|
use PHPUnit\Framework\MockObject\MockObject;
|
2017-10-31 13:40:13 +01:00
|
|
|
|
2018-08-22 03:10:08 +02:00
|
|
|
class UrlGeneratorServiceProviderTest extends ServiceProviderTest
|
2017-10-31 13:40:13 +01:00
|
|
|
{
|
|
|
|
/**
|
2018-08-22 03:10:08 +02:00
|
|
|
* @covers \Engelsystem\Http\UrlGeneratorServiceProvider::register()
|
2017-10-31 13:40:13 +01:00
|
|
|
*/
|
|
|
|
public function testRegister()
|
|
|
|
{
|
2019-04-24 10:45:00 +02:00
|
|
|
/** @var UrlGenerator|MockObject $urlGenerator */
|
2017-10-31 13:40:13 +01:00
|
|
|
$urlGenerator = $this->getMockBuilder(UrlGenerator::class)
|
|
|
|
->getMock();
|
|
|
|
|
2018-11-27 12:01:36 +01:00
|
|
|
$app = $this->getApp(['make', 'instance', 'bind']);
|
2017-10-31 13:40:13 +01:00
|
|
|
|
2017-10-31 14:15:19 +01:00
|
|
|
$this->setExpects($app, 'make', [UrlGenerator::class], $urlGenerator);
|
2018-08-26 12:23:47 +02:00
|
|
|
$app->expects($this->exactly(2))
|
|
|
|
->method('instance')
|
|
|
|
->withConsecutive(
|
|
|
|
[UrlGenerator::class, $urlGenerator],
|
2018-10-25 18:53:05 +02:00
|
|
|
['http.urlGenerator', $urlGenerator],
|
|
|
|
[UrlGeneratorInterface::class, $urlGenerator]
|
2018-08-26 12:23:47 +02:00
|
|
|
);
|
2018-11-27 12:01:36 +01:00
|
|
|
$app->expects($this->once())
|
|
|
|
->method('bind')
|
|
|
|
->with(UrlGeneratorInterface::class, UrlGenerator::class);
|
2017-10-31 13:40:13 +01:00
|
|
|
|
2018-08-22 03:10:08 +02:00
|
|
|
$serviceProvider = new UrlGeneratorServiceProvider($app);
|
2017-10-31 13:40:13 +01:00
|
|
|
$serviceProvider->register();
|
|
|
|
}
|
|
|
|
}
|