2017-10-31 13:40:13 +01:00
|
|
|
<?php
|
|
|
|
|
2017-10-31 14:23:23 +01:00
|
|
|
namespace Engelsystem\Test\Unit\Logger;
|
2017-10-31 13:40:13 +01:00
|
|
|
|
|
|
|
use Engelsystem\Logger\EngelsystemLogger;
|
|
|
|
use Engelsystem\Logger\LoggerServiceProvider;
|
2017-10-31 14:15:19 +01:00
|
|
|
use Engelsystem\Test\Unit\ServiceProviderTest;
|
2017-10-31 13:40:13 +01:00
|
|
|
use PHPUnit_Framework_MockObject_MockObject;
|
|
|
|
use Psr\Log\LoggerInterface;
|
|
|
|
|
2017-10-31 14:15:19 +01:00
|
|
|
class LoggerServiceProviderTest extends ServiceProviderTest
|
2017-10-31 13:40:13 +01:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @covers \Engelsystem\Logger\LoggerServiceProvider::register()
|
|
|
|
*/
|
|
|
|
public function testRegister()
|
|
|
|
{
|
|
|
|
/** @var PHPUnit_Framework_MockObject_MockObject|EngelsystemLogger $logger */
|
|
|
|
$logger = $this->getMockBuilder(EngelsystemLogger::class)
|
|
|
|
->getMock();
|
|
|
|
|
2017-10-31 14:15:19 +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', [EngelsystemLogger::class], $logger);
|
|
|
|
$this->setExpects($app, 'instance', ['logger', $logger]);
|
2017-10-31 13:40:13 +01:00
|
|
|
|
|
|
|
$app->expects($this->atLeastOnce())
|
|
|
|
->method('bind')
|
|
|
|
->withConsecutive(
|
|
|
|
[LoggerInterface::class, 'logger'],
|
|
|
|
[EngelsystemLogger::class, 'logger']
|
|
|
|
);
|
|
|
|
|
|
|
|
$serviceProvider = new LoggerServiceProvider($app);
|
|
|
|
$serviceProvider->register();
|
|
|
|
}
|
|
|
|
}
|