summaryrefslogtreecommitdiff
path: root/tests/Unit/Middleware/SessionHandlerServiceProviderTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Unit/Middleware/SessionHandlerServiceProviderTest.php')
-rw-r--r--tests/Unit/Middleware/SessionHandlerServiceProviderTest.php44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/Unit/Middleware/SessionHandlerServiceProviderTest.php b/tests/Unit/Middleware/SessionHandlerServiceProviderTest.php
new file mode 100644
index 00000000..bb4f7e92
--- /dev/null
+++ b/tests/Unit/Middleware/SessionHandlerServiceProviderTest.php
@@ -0,0 +1,44 @@
+<?php
+
+namespace Engelsystem\Test\Unit\Middleware;
+
+use Engelsystem\Middleware\SessionHandler;
+use Engelsystem\Middleware\SessionHandlerServiceProvider;
+use Engelsystem\Test\Unit\ServiceProviderTest;
+use Illuminate\Contracts\Container\ContextualBindingBuilder;
+use PHPUnit\Framework\MockObject\MockObject;
+
+class SessionHandlerServiceProviderTest extends ServiceProviderTest
+{
+ /**
+ * @covers \Engelsystem\Middleware\SessionHandlerServiceProvider::register()
+ */
+ public function testRegister()
+ {
+ /** @var ContextualBindingBuilder|MockObject $bindingBuilder */
+ $bindingBuilder = $this->createMock(ContextualBindingBuilder::class);
+ $app = $this->getApp(['when']);
+
+ $app->expects($this->once())
+ ->method('when')
+ ->with(SessionHandler::class)
+ ->willReturn($bindingBuilder);
+
+ $bindingBuilder->expects($this->once())
+ ->method('needs')
+ ->with('$paths')
+ ->willReturn($bindingBuilder);
+
+ $bindingBuilder->expects($this->once())
+ ->method('give')
+ ->willReturnCallback(function (callable $callable) {
+ $paths = $callable();
+
+ $this->assertTrue(is_array($paths));
+ $this->assertTrue(in_array('/metrics', $paths));
+ });
+
+ $serviceProvider = new SessionHandlerServiceProvider($app);
+ $serviceProvider->register();
+ }
+}