diff --git a/README.md b/README.md index 2bebfb9..d18571c 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/interfasys/lognormalizer/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/interfasys/lognormalizer/?branch=master) [![Code Climate](https://codeclimate.com/github/interfasys/lognormalizer/badges/gpa.svg)](https://codeclimate.com/github/interfasys/lognormalizer) [![Build Status](https://travis-ci.org/interfasys/lognormalizer.svg?branch=master)](https://travis-ci.org/interfasys/lognormalizer) +[![Code Coverage](https://scrutinizer-ci.com/g/interfasys/lognormalizer/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/interfasys/lognormalizer/?branch=master) Parses variables and converts them to string so that they can be logged diff --git a/tests/NormalizerTest.php b/tests/NormalizerTest.php index 01509b7..bd2d27c 100644 --- a/tests/NormalizerTest.php +++ b/tests/NormalizerTest.php @@ -96,6 +96,20 @@ public function testSimpleObject() { $this->assertEquals($expectedString, $formatted); } + public function testLongArray() { + $keys = range(0, 25); + $data = array_fill_keys($keys, 'normalizer'); + + $normalizer = new Normalizer(4, 20); + $normalized = $normalizer->normalize($data); + + + $expectedResult = array_slice($data, 0, 19); + $expectedResult['...'] = 'Over 20 items, aborting normalization'; + + $this->assertEquals($expectedResult, $normalized); + } + public function testArrayWithObject() { $objectFoo = new TestFooNorm; $data = [ @@ -230,7 +244,7 @@ public function testLimitedObjectRecursion() { // At this stage, we can't inspect deeper objects $objectBazResult = [ '[object] (' . $objectBazName . ')' => [ - 'foo' => '[object] (' . $objectFooName . ')' , + 'foo' => '[object] (' . $objectFooName . ')', 'bar' => '[object] (' . $objectBarName . ')', 'baz' => 'baz' ]