summaryrefslogtreecommitdiff
path: root/tests/Unit/Logger/LoggerServiceProviderTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Unit/Logger/LoggerServiceProviderTest.php')
-rw-r--r--tests/Unit/Logger/LoggerServiceProviderTest.php47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/Unit/Logger/LoggerServiceProviderTest.php b/tests/Unit/Logger/LoggerServiceProviderTest.php
new file mode 100644
index 00000000..5143d236
--- /dev/null
+++ b/tests/Unit/Logger/LoggerServiceProviderTest.php
@@ -0,0 +1,47 @@
+<?php
+
+namespace Engelsystem\Test\Logger;
+
+use Engelsystem\Application;
+use Engelsystem\Logger\EngelsystemLogger;
+use Engelsystem\Logger\LoggerServiceProvider;
+use PHPUnit\Framework\TestCase;
+use PHPUnit_Framework_MockObject_MockObject;
+use Psr\Log\LoggerInterface;
+
+class LoggerServiceProviderTest extends TestCase
+{
+ /**
+ * @covers \Engelsystem\Logger\LoggerServiceProvider::register()
+ */
+ public function testRegister()
+ {
+ /** @var PHPUnit_Framework_MockObject_MockObject|EngelsystemLogger $logger */
+ $logger = $this->getMockBuilder(EngelsystemLogger::class)
+ ->getMock();
+
+ /** @var PHPUnit_Framework_MockObject_MockObject|Application $app */
+ $app = $this->getMockBuilder(Application::class)
+ ->setMethods(['make', 'instance', 'bind'])
+ ->getMock();
+
+ $app->expects($this->once())
+ ->method('make')
+ ->with(EngelsystemLogger::class)
+ ->willReturn($logger);
+
+ $app->expects($this->once())
+ ->method('instance')
+ ->with('logger', $logger);
+
+ $app->expects($this->atLeastOnce())
+ ->method('bind')
+ ->withConsecutive(
+ [LoggerInterface::class, 'logger'],
+ [EngelsystemLogger::class, 'logger']
+ );
+
+ $serviceProvider = new LoggerServiceProvider($app);
+ $serviceProvider->register();
+ }
+}