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->assertIsArray($paths); $this->assertTrue(in_array('/metrics', $paths)); }); $serviceProvider = new SessionHandlerServiceProvider($app); $serviceProvider->register(); } }