Symfony\Bundle\MonologBundle\Tests\DependencyInjection\MonologExtensionTest::testSocketHandler PHP Method

testSocketHandler() public method

public testSocketHandler ( )
    public function testSocketHandler()
    {
        try {
            $this->getContainer(array(array('handlers' => array('socket' => array('type' => 'socket')))));
            $this->fail();
        } catch (InvalidConfigurationException $e) {
            $this->assertContains('connection_string', $e->getMessage());
        }
        $container = $this->getContainer(array(array('handlers' => array('socket' => array('type' => 'socket', 'timeout' => 1, 'persistent' => true, 'connection_string' => 'localhost:50505', 'connection_timeout' => '0.6')))));
        $this->assertTrue($container->hasDefinition('monolog.logger'));
        $this->assertTrue($container->hasDefinition('monolog.handler.socket'));
        $logger = $container->getDefinition('monolog.logger');
        $this->assertDICDefinitionMethodCallAt(0, $logger, 'useMicrosecondTimestamps', array('%monolog.use_microseconds%'));
        $this->assertDICDefinitionMethodCallAt(1, $logger, 'pushHandler', array(new Reference('monolog.handler.socket')));
        $handler = $container->getDefinition('monolog.handler.socket');
        $this->assertDICDefinitionClass($handler, 'Monolog\\Handler\\SocketHandler');
        $this->assertDICConstructorArguments($handler, array('localhost:50505', \Monolog\Logger::DEBUG, true));
        $this->assertDICDefinitionMethodCallAt(0, $handler, 'pushProcessor', array(new Reference('monolog.processor.psr_log_message')));
        $this->assertDICDefinitionMethodCallAt(1, $handler, 'setTimeout', array('1'));
        $this->assertDICDefinitionMethodCallAt(2, $handler, 'setConnectionTimeout', array('0.6'));
        $this->assertDICDefinitionMethodCallAt(3, $handler, 'setPersistent', array(true));
    }