engelsystem/tests/Unit/Logger/LoggerServiceProviderTest.php

39 lines
1.2 KiB
PHP
Raw Normal View History

2017-10-31 13:40:13 +01:00
<?php
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)
2018-08-31 01:55:05 +02:00
->disableOriginalConstructor()
2017-10-31 13:40:13 +01:00
->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();
}
}