예제 #1
0
 function testAppBuilderBuildGetLogger()
 {
     $logger = $this->getMock('Conpago\\Logging\\Contract\\ILogger');
     $container = $this->getMock('Conpago\\DI\\IContainer');
     $this->containerBuilder->expects($this->once())->method('build')->willReturn($container);
     $container->expects($this->once())->method('resolve')->with('Conpago\\Logging\\Contract\\ILogger')->willReturn($logger);
     $this->assertSame($logger, $this->appBuilder->getLogger());
 }
예제 #2
0
/**
 * @param AppBuilder $appBuilder
 * @param Exception $e
 * @param $is_debug
 *
 * @throws Exception
 */
function LogException(AppBuilder $appBuilder, \Exception $e, $is_debug)
{
    try {
        $appBuilder->getLogger()->addCritical('Exception caught', ['exception' => $e]);
    } finally {
        if ($is_debug == true) {
            throw $e;
        }
    }
}