diff -Nru phpunit-exporter-3.1.1/ChangeLog.md phpunit-exporter-3.1.2/ChangeLog.md --- phpunit-exporter-3.1.1/ChangeLog.md 1970-01-01 00:00:00.000000000 +0000 +++ phpunit-exporter-3.1.2/ChangeLog.md 2019-09-14 09:02:43.000000000 +0000 @@ -0,0 +1,15 @@ +# ChangeLog + +All notable changes are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles. + +## [3.1.2] - 2019-09-14 + +### Fixed + +* Fixed [#29](https://github.com/sebastianbergmann/exporter/pull/29): Second parameter for `str_repeat()` must be an integer + +### Removed + +* Remove HHVM-specific code that is no longer needed + +[3.1.2]: https://github.com/sebastianbergmann/exporter/compare/3.1.1...3.1.2 diff -Nru phpunit-exporter-3.1.1/debian/changelog phpunit-exporter-3.1.2/debian/changelog --- phpunit-exporter-3.1.1/debian/changelog 2019-08-12 17:03:11.000000000 +0000 +++ phpunit-exporter-3.1.2/debian/changelog 2019-09-17 04:23:42.000000000 +0000 @@ -1,3 +1,21 @@ +phpunit-exporter (3.1.2-1) unstable; urgency=medium + + [ Sebastian Bergmann ] + * Add ChangeLog + * Prepare release + + [ Claudio Zizza ] + * Remove unsupported HHVM code + * Increase code coverage + + [ Ciaran McNulty ] + * Make str_repeat call stricter + + [ David Prévot ] + * Remove obsolete fields Name, Contact from debian/upstream/metadata. + + -- David Prévot Mon, 16 Sep 2019 18:23:42 -1000 + phpunit-exporter (3.1.1-1) unstable; urgency=medium [ Sebastian Bergmann ] diff -Nru phpunit-exporter-3.1.1/debian/patches/0001-Compatibility-with-recent-PHPUnit-8.patch phpunit-exporter-3.1.2/debian/patches/0001-Compatibility-with-recent-PHPUnit-8.patch --- phpunit-exporter-3.1.1/debian/patches/0001-Compatibility-with-recent-PHPUnit-8.patch 2019-08-12 17:00:55.000000000 +0000 +++ phpunit-exporter-3.1.2/debian/patches/0001-Compatibility-with-recent-PHPUnit-8.patch 2019-09-17 04:20:17.000000000 +0000 @@ -7,10 +7,10 @@ 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ExporterTest.php b/tests/ExporterTest.php -index a9aded0..f26531c 100644 +index 7fac74c..ddf0a4e 100644 --- a/tests/ExporterTest.php +++ b/tests/ExporterTest.php -@@ -21,7 +21,7 @@ class ExporterTest extends TestCase +@@ -22,7 +22,7 @@ class ExporterTest extends TestCase */ private $exporter; diff -Nru phpunit-exporter-3.1.1/debian/upstream/metadata phpunit-exporter-3.1.2/debian/upstream/metadata --- phpunit-exporter-3.1.1/debian/upstream/metadata 2019-08-12 16:53:24.000000000 +0000 +++ phpunit-exporter-3.1.2/debian/upstream/metadata 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -Name: Exporter -Contact: Sebastian Bergmann diff -Nru phpunit-exporter-3.1.1/src/Exporter.php phpunit-exporter-3.1.2/src/Exporter.php --- phpunit-exporter-3.1.1/src/Exporter.php 2019-08-11 12:43:14.000000000 +0000 +++ phpunit-exporter-3.1.2/src/Exporter.php 2019-09-14 09:02:43.000000000 +0000 @@ -47,8 +47,8 @@ } /** - * @param mixed $data - * @param Context $context + * @param array $data + * @param Context $context * * @return string */ @@ -173,18 +173,6 @@ // above (fast) mechanism nor with reflection in Zend. // Format the output similarly to print_r() in this case if ($value instanceof \SplObjectStorage) { - // However, the fast method does work in HHVM, and exposes the - // internal implementation. Hide it again. - if (\property_exists('\SplObjectStorage', '__storage')) { - unset($array['__storage']); - } elseif (\property_exists('\SplObjectStorage', 'storage')) { - unset($array['storage']); - } - - if (\property_exists('\SplObjectStorage', '__key')) { - unset($array['__key']); - } - foreach ($value as $key => $val) { $array[\spl_object_hash($val)] = [ 'obj' => $val, @@ -252,7 +240,7 @@ "'"; } - $whitespace = \str_repeat(' ', 4 * $indentation); + $whitespace = \str_repeat(' ', (int)(4 * $indentation)); if (!$processed) { $processed = new Context; diff -Nru phpunit-exporter-3.1.1/tests/ExporterTest.php phpunit-exporter-3.1.2/tests/ExporterTest.php --- phpunit-exporter-3.1.1/tests/ExporterTest.php 2019-08-11 12:43:14.000000000 +0000 +++ phpunit-exporter-3.1.2/tests/ExporterTest.php 2019-09-14 09:02:43.000000000 +0000 @@ -10,6 +10,7 @@ namespace SebastianBergmann\Exporter; use PHPUnit\Framework\TestCase; +use SebastianBergmann\RecursionContext\Context; /** * @covers SebastianBergmann\Exporter\Exporter @@ -379,8 +380,53 @@ $this->assertEquals([true], $this->exporter->toArray(true)); } + public function testIgnoreKeysInValue() + { + // Find out what the actual use case was with the PHP bug + $array = []; + $array["\0gcdata"] = ''; + + $this->assertEquals([], $this->exporter->toArray((object) $array)); + } + private function trimNewline($string) { return \preg_replace('/[ ]*\n/', "\n", $string); } + + /** + * @dataProvider shortenedRecursiveExportProvider + */ + public function testShortenedRecursiveExport(array $value, string $expected) + { + $this->assertEquals($expected, $this->exporter->shortenedRecursiveExport($value)); + } + + public function shortenedRecursiveExportProvider() + { + return [ + 'export null' => [[null], 'null'], + 'export boolean true' => [[true], 'true'], + 'export boolean false' => [[false], 'false'], + 'export int 1' => [[1], '1'], + 'export float 1.0' => [[1.0], '1.0'], + 'export float 1.2' => [[1.2], '1.2'], + 'export numeric string' => [['1'], "'1'"], + 'export with numeric array key' => [[2 => 1], '1'], + 'export with assoc array key' => [['foo' => 'bar'], '\'bar\''], + 'export multidimentional array' => [[[1, 2, 3], [3, 4, 5]], 'array(1, 2, 3), array(3, 4, 5)'], + 'export object' => [[new \stdClass], 'stdClass Object ()'], + ]; + } + + public function testShortenedRecursiveOccurredRecursion() + { + $recursiveValue = [1]; + $context = new Context(); + $context->add($recursiveValue); + + $value = [$recursiveValue]; + + $this->assertEquals('*RECURSION*', $this->exporter->shortenedRecursiveExport($value, $context)); + } }