|
|
@@ -131,22 +131,22 @@ class JsonFormatterTest extends TestCase
|
|
|
$message = $this->formatRecordWithExceptionInContext($formatter, $throwable);
|
|
|
|
|
|
$this->assertEquals(
|
|
|
- '{"...":"Over 0 items, aborting normalization"}'."\n",
|
|
|
+ '{"...":"Over 0 items (6 total), aborting normalization"}'."\n",
|
|
|
$message
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- public function testMaxNormalizeItemCountWith3ItemsMax()
|
|
|
+ public function testMaxNormalizeItemCountWith2ItemsMax()
|
|
|
{
|
|
|
$formatter = new JsonFormatter(JsonFormatter::BATCH_MODE_JSON, true);
|
|
|
$formatter->setMaxNormalizeDepth(9);
|
|
|
- $formatter->setMaxNormalizeItemCount(3);
|
|
|
+ $formatter->setMaxNormalizeItemCount(2);
|
|
|
$throwable = new \Error('Foo');
|
|
|
|
|
|
$message = $this->formatRecordWithExceptionInContext($formatter, $throwable);
|
|
|
|
|
|
$this->assertEquals(
|
|
|
- '{"level_name":"CRITICAL","channel":"core","...":"Over 3 items, aborting normalization"}'."\n",
|
|
|
+ '{"level_name":"CRITICAL","channel":"core","...":"Over 2 items (6 total), aborting normalization"}'."\n",
|
|
|
$message
|
|
|
);
|
|
|
}
|
|
|
@@ -217,4 +217,40 @@ class JsonFormatterTest extends TestCase
|
|
|
|
|
|
return $formattedException;
|
|
|
}
|
|
|
+
|
|
|
+ public function testNormalizeHandleLargeArraysWithExactly1000Items()
|
|
|
+ {
|
|
|
+ $formatter = new NormalizerFormatter();
|
|
|
+ $largeArray = range(1, 1000);
|
|
|
+
|
|
|
+ $res = $formatter->format(array(
|
|
|
+ 'level_name' => 'CRITICAL',
|
|
|
+ 'channel' => 'test',
|
|
|
+ 'message' => 'bar',
|
|
|
+ 'context' => array($largeArray),
|
|
|
+ 'datetime' => new \DateTime,
|
|
|
+ 'extra' => array(),
|
|
|
+ ));
|
|
|
+
|
|
|
+ $this->assertCount(1000, $res['context'][0]);
|
|
|
+ $this->assertArrayNotHasKey('...', $res['context'][0]);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function testNormalizeHandleLargeArrays()
|
|
|
+ {
|
|
|
+ $formatter = new NormalizerFormatter();
|
|
|
+ $largeArray = range(1, 2000);
|
|
|
+
|
|
|
+ $res = $formatter->format(array(
|
|
|
+ 'level_name' => 'CRITICAL',
|
|
|
+ 'channel' => 'test',
|
|
|
+ 'message' => 'bar',
|
|
|
+ 'context' => array($largeArray),
|
|
|
+ 'datetime' => new \DateTime,
|
|
|
+ 'extra' => array(),
|
|
|
+ ));
|
|
|
+
|
|
|
+ $this->assertCount(1001, $res['context'][0]);
|
|
|
+ $this->assertEquals('Over 1000 items (2000 total), aborting normalization', $res['context'][0]['...']);
|
|
|
+ }
|
|
|
}
|