public function testLogComplex() { $this->expectOutputRegex('/Array\\s\\(\\s+\\[0\\] => 1\\s\\).+stdClass Object/s'); $this->_model->addStreamLog(Mage_Core_Model_Logger::LOGGER_SYSTEM, 'php://output'); $this->_model->log(array(1)); $this->_model->log(new StdClass()); }
/** * @test */ public function logFormatsDetailMessageWithAdditionalDataInLocalErrorArray() { $backendUser = $this->getMock(BackendUserAuthentication::class); $this->subject->BE_USER = $backendUser; $this->subject->enableLogging = TRUE; $this->subject->errorLog = array(); $logDetails = $this->getUniqueId('details'); $this->subject->log('', 23, 0, 42, 1, '%1$s' . $logDetails . '%2$s', -1, array('foo', 'bar')); $expected = 'foo' . $logDetails . 'bar'; $this->assertStringEndsWith($expected, $this->subject->errorLog[0]); }
/** * @test */ public function logParsesContextWithoutException() { $context = ['foo' => 'bar']; $message = 'foobar'; $logLevel = LogLevel::INFO; // Bit of a stretch to check for the exception trace and all, just check the general format and contents $argumentCheckCallback = function ($arg) use($message, $context) { $pattern = sprintf('/^%s \\/ Context\\: %s/', $message, json_encode($context)); return preg_match($pattern, $arg) === 1; }; $this->logger->expects(self::once())->method('format')->with($logLevel, self::callback($argumentCheckCallback))->will(self::returnValue($message)); $this->logger->expects(self::once())->method('output')->with($message); $this->logger->log($logLevel, $message, $context); }
public function testLog() { $this->console->expects($this->once())->method('writeln')->with('<detail>Detail message.</detail>'); $this->consoleLoggerModel->log('Detail message.'); }
public function testLogNoKey() { $key = 'key'; $this->model->log($key); $this->assertFalse($this->model->hasLog($key)); }