Esempio n. 1
0
 protected function setUp()
 {
     $this->connector = \PhpConsole\Connector::getInstance();
     $this->setProtectedProperty($this->connector, 'isActiveClient', true);
     $this->debugDispatcher = $this->getMockBuilder('\\PhpConsole\\Dispatcher\\Debug')->setConstructorArgs(array($this->connector, new \PhpConsole\Dumper()))->setMethods(array('dispatchDebug'))->getMock();
     $this->connector->setDebugDispatcher($this->debugDispatcher);
 }
 protected function setUp()
 {
     if (!class_exists('PhpConsole\\Connector')) {
         $this->markTestSkipped('PHP Console library not found. See https://github.com/barbushin/php-console#installation');
     }
     $this->connector = $this->initConnectorMock();
     $this->debugDispatcher = $this->initDebugDispatcherMock($this->connector);
     $this->connector->setDebugDispatcher($this->debugDispatcher);
     $this->errorDispatcher = $this->initErrorDispatcherMock($this->connector);
     $this->connector->setErrorsDispatcher($this->errorDispatcher);
 }
 public function testDebugTags($tagsContextKeys = null)
 {
     $expectedTags = mt_rand();
     $logger = $this->initLogger($tagsContextKeys ? array('debugTagsKeysInContext' => $tagsContextKeys) : array());
     if (!$tagsContextKeys) {
         $tagsContextKeys = $this->getHandlerDefaultOption('debugTagsKeysInContext');
     }
     foreach ($tagsContextKeys as $key) {
         $debugDispatcher = $this->initDebugDispatcherMock($this->connector);
         $debugDispatcher->expects($this->once())->method('dispatchDebug')->with($this->anything(), $this->equalTo($expectedTags));
         $this->connector->setDebugDispatcher($debugDispatcher);
         $logger->addDebug('test', array($key => $expectedTags));
     }
 }
Esempio n. 4
0
 public function testSetDebugDispatcher()
 {
     $dispatcher = new \PhpConsole\Dispatcher\Debug($this->connector, new \PhpConsole\Dumper());
     $this->connector->setDebugDispatcher($dispatcher);
     $this->assertEquals(spl_object_hash($dispatcher), spl_object_hash($this->connector->getDebugDispatcher()));
 }