Ejemplo n.º 1
0
 /**
  * Restores everything back to normal
  *
  * @return void
  **/
 public function tearDown()
 {
     parent::tearDown();
     CakeLog::enable('stderr');
     CakeLog::drop('queuetest');
     Configure::write('SQS', array());
     unset($this->logger);
 }
Ejemplo n.º 2
0
/**
 * tearDown
 *
 * @return void
 */
	public function tearDown() {
		parent::tearDown();
		if ($this->_restoreError) {
			restore_error_handler();
		}
		CakeLog::enable('stdout');
		CakeLog::enable('stderr');
	}
Ejemplo n.º 3
0
 /**
  * Restores everything back to normal
  *
  * @return void
  **/
 public function tearDown()
 {
     parent::tearDown();
     GearmanQueue::client(false);
     CakeLog::enable('stderr');
     CakeLog::drop('queuetest');
     Configure::write('Gearman', array());
     unset($this->logger);
 }
 /**
  * Restores everything back to normal
  *
  * @return void
  **/
 public function tearDown()
 {
     parent::tearDown();
     Nodes\Environment::setRoot($this->_root);
     GearmanQueue::config(array('servers' => array('127.0.0.1')));
     GearmanQueue::client(false);
     CakeLog::enable('stderr');
     CakeLog::drop('queuetest');
     unset($this->logger);
 }
Ejemplo n.º 5
0
 /**
  * test LogError()
  *
  * @return void
  */
 public function testLogError()
 {
     @unlink(LOGS . 'error.log');
     // disable stderr output for this test
     if (CakeLog::stream('stderr')) {
         CakeLog::disable('stderr');
     }
     LogError('Testing LogError() basic function');
     LogError("Testing with\nmulti-line\nstring");
     if (CakeLog::stream('stderr')) {
         CakeLog::enable('stderr');
     }
     $result = file_get_contents(LOGS . 'error.log');
     $this->assertRegExp('/Error: Testing LogError\\(\\) basic function/', $result);
     $this->assertNotRegExp("/Error: Testing with\nmulti-line\nstring/", $result);
     $this->assertRegExp('/Error: Testing with multi-line string/', $result);
 }
Ejemplo n.º 6
0
 /**
  * test disable
  *
  * @expectedException CakeLogException
  * @return void
  */
 public function testStreamDisable()
 {
     CakeLog::config('spam', array('engine' => 'File', 'file' => 'spam'));
     $this->assertTrue(CakeLog::enabled('spam'));
     CakeLog::disable('spam');
     $this->assertFalse(CakeLog::enabled('spam'));
     CakeLog::drop('spam');
     CakeLog::enable('bogus_stream');
 }
Ejemplo n.º 7
0
 /**
  * Test file and console and logging
  *
  * @return void
  */
 public function testFileAndConsoleLogging()
 {
     CakeLog::disable('stdout');
     CakeLog::disable('stderr');
     // file logging
     $this->Shell->log_something();
     $this->assertTrue(file_exists(LOGS . 'error.log'));
     unlink(LOGS . 'error.log');
     $this->assertFalse(file_exists(LOGS . 'error.log'));
     // both file and console logging
     require_once CORE_TEST_CASES . DS . 'Log' . DS . 'Engine' . DS . 'ConsoleLogTest.php';
     $mock = $this->getMock('ConsoleLog', array('write'), array(array('types' => 'error')));
     TestCakeLog::config('console', array('engine' => 'Console', 'stream' => 'php://stderr'));
     TestCakeLog::replace('console', $mock);
     $mock->expects($this->once())->method('write')->with('error', $this->Shell->testMessage);
     $this->Shell->log_something();
     $this->assertTrue(file_exists(LOGS . 'error.log'));
     $contents = file_get_contents(LOGS . 'error.log');
     $this->assertContains($this->Shell->testMessage, $contents);
     CakeLog::enable('stdout');
     CakeLog::enable('stderr');
 }