public function testChannelFlush() { $this->_setupWithoutFrontController(false); $channel = Channel\HttpHeaders::getInstance(); $this->assertFalse($channel->flush(), 'Nothing to flush - No messages'); FirePhp::send('Hello World'); $this->assertTrue($channel->flush(), 'One message to flush'); $this->_request->setUserAgentExtensionEnabled(false); $this->assertFalse($channel->flush(), 'Nothing to flush - Extension not in UserAgent'); }
/** * @group ZF-4934 */ public function testAdvancedLogging() { FirePhp::getInstance()->setOption('maxTraceDepth',0); $message = 'This is a log message!'; $label = 'Test Label'; $table = array( 'Summary line for the table', array( array('Column 1', 'Column 2'), array('Row 1 c 1',' Row 1 c 2'), array('Row 2 c 1',' Row 2 c 2') ) ); $this->_logger->addPriority('TRACE', 8); $this->_logger->addPriority('TABLE', 9); $this->_writer->setPriorityStyle(8, 'TRACE'); $this->_writer->setPriorityStyle(9, 'TABLE'); $this->_logger->trace($message); $this->_logger->table($table); try { throw new \Exception('Test Exception'); } catch (\Exception $e) { $this->_logger->err($e); } try { FirePhp::send($message, $label, 'UNKNOWN'); $this->fail('Should not be able to log with undefined log style'); } catch (\Zend\Wildfire\Plugin\Exception\UnexpectedValueException $e) { // success } $channel = Channel\HttpHeaders::getInstance(); $protocol = $channel->getProtocol(FirePhp::PROTOCOL_URI); $messages = array( FirePhp::STRUCTURE_URI_FIREBUGCONSOLE => array( FirePhp::PLUGIN_URI => array( 1 => '[{"Type":"TABLE"},["Summary line for the table",[["Column 1","Column 2"],["Row 1 c 1"," Row 1 c 2"],["Row 2 c 1"," Row 2 c 2"]]]]' ))); $qued_messages = $protocol->getMessages(); unset($qued_messages[FirePhp::STRUCTURE_URI_FIREBUGCONSOLE][FirePhp::PLUGIN_URI][0]); unset($qued_messages[FirePhp::STRUCTURE_URI_FIREBUGCONSOLE][FirePhp::PLUGIN_URI][2]); $this->assertEquals(serialize($qued_messages), serialize($messages)); }