engelsystem/tests/Unit/Http/UrlGeneratorServiceProvider...

40 lines
1.3 KiB
PHP
Raw Normal View History

2017-10-31 13:40:13 +01:00
<?php
namespace Engelsystem\Test\Unit\Http;
2017-10-31 13:40:13 +01:00
use Engelsystem\Http\UrlGenerator;
2018-10-25 18:53:05 +02:00
use Engelsystem\Http\UrlGeneratorInterface;
use Engelsystem\Http\UrlGeneratorServiceProvider;
2017-10-31 14:15:19 +01:00
use Engelsystem\Test\Unit\ServiceProviderTest;
use PHPUnit\Framework\MockObject\MockObject;
2017-10-31 13:40:13 +01:00
class UrlGeneratorServiceProviderTest extends ServiceProviderTest
2017-10-31 13:40:13 +01:00
{
/**
* @covers \Engelsystem\Http\UrlGeneratorServiceProvider::register()
2017-10-31 13:40:13 +01:00
*/
public function testRegister(): void
2017-10-31 13:40:13 +01:00
{
/** @var UrlGenerator|MockObject $urlGenerator */
2017-10-31 13:40:13 +01:00
$urlGenerator = $this->getMockBuilder(UrlGenerator::class)
->getMock();
$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
);
$app->expects($this->once())
->method('bind')
->with(UrlGeneratorInterface::class, UrlGenerator::class);
2017-10-31 13:40:13 +01:00
$serviceProvider = new UrlGeneratorServiceProvider($app);
2017-10-31 13:40:13 +01:00
$serviceProvider->register();
}
}