diff --git a/.gitignore b/.gitignore index fc7ea17..4b53aba 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /vendor composer.lock .DS_Store +.phpunit.result.cache diff --git a/src/AgentHandler.php b/src/AgentHandler.php new file mode 100644 index 0000000..45cddb1 --- /dev/null +++ b/src/AgentHandler.php @@ -0,0 +1,24 @@ +app->make(MonologHandler::class); $this->assertInstanceOf(MonologHandler::class, $handler); + + $handler = $this->app->make(AgentHandler::class); + $this->assertInstanceOf(AgentHandler::class, $handler); } public function testIsSingleton() @@ -62,6 +66,20 @@ public function testCustomConfiguration() $this->assertEquals(E_ERROR, $config['included_errno']); } + public function testRollbarAgentConfigurationAdapter() + { + $this->app->config->set('logging.channels.rollbar.handler', AgentHandler::class); + + $client = $this->app->make(RollbarLogger::class); + $config = $client->extend([]); + + $this->assertEquals( + 'agent', + $config['handler'], + 'AgentHandler given as Laravel logging config handler should be given as "agent" to Rollbar::init' + ); + } + // public function testAutomaticContext() // { // $this->app->session->put('foo', 'bar');