1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-08 06:06:40 +02:00

Fixing tests and CS, refs #468

This commit is contained in:
Jordi Boggiano
2014-12-29 20:45:41 +00:00
parent da0a7f3c8e
commit 5ce2b38b3b
2 changed files with 8 additions and 7 deletions

View File

@@ -34,7 +34,7 @@ class MongoDBFormatter implements FormatterInterface
/**
* {@inheritDoc}
*/
public function format (array $record)
public function format(array $record)
{
return $this->formatArray($record);
}
@@ -42,7 +42,7 @@ class MongoDBFormatter implements FormatterInterface
/**
* {@inheritDoc}
*/
public function formatBatch (array $records)
public function formatBatch(array $records)
{
foreach ($records as $key => $record) {
$records[$key] = $this->format($record);
@@ -51,7 +51,7 @@ class MongoDBFormatter implements FormatterInterface
return $records;
}
protected function formatArray (array $record, $nestingLevel = 0)
protected function formatArray(array $record, $nestingLevel = 0)
{
if ($this->maxNestingLevel == 0 || $nestingLevel <= $this->maxNestingLevel) {
foreach ($record as $name => $value) {
@@ -72,14 +72,15 @@ class MongoDBFormatter implements FormatterInterface
return $record;
}
protected function formatObject ($value, $nestingLevel)
protected function formatObject($value, $nestingLevel)
{
$objectVars = get_object_vars($value);
$objectVars['class'] = get_class($value);
return $this->formatArray($objectVars, $nestingLevel);
}
protected function formatException (\Exception $exception, $nestingLevel)
protected function formatException(\Exception $exception, $nestingLevel)
{
$formattedException = array(
'class' => get_class($exception),
@@ -97,7 +98,7 @@ class MongoDBFormatter implements FormatterInterface
return $this->formatArray($formattedException, $nestingLevel);
}
protected function formatDate (\DateTime $value, $nestingLevel)
protected function formatDate(\DateTime $value, $nestingLevel)
{
return new \MongoDate($value->getTimestamp());
}

View File

@@ -110,7 +110,7 @@ class MongoDBFormatterTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('some string', $formattedRecord['context']['context_string']);
$this->assertEquals(123456, $formattedRecord['context']['context_int']);
$this->assertCount(6, $formattedRecord['context']['except']);
$this->assertCount(5, $formattedRecord['context']['except']);
$this->assertEquals('exception message', $formattedRecord['context']['except']['message']);
$this->assertEquals(987, $formattedRecord['context']['except']['code']);
$this->assertInternalType('string', $formattedRecord['context']['except']['file']);