From 3d2a1e14048523c41ca0754f5f18d3aacf25e49a Mon Sep 17 00:00:00 2001 From: Romain Canon Date: Tue, 26 Dec 2023 14:34:24 +0100 Subject: [PATCH] tests: test nested generators normalization --- .../Integration/Normalizer/NormalizerTest.php | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/Integration/Normalizer/NormalizerTest.php b/tests/Integration/Normalizer/NormalizerTest.php index 6ce8a820..20e0d9b3 100644 --- a/tests/Integration/Normalizer/NormalizerTest.php +++ b/tests/Integration/Normalizer/NormalizerTest.php @@ -157,6 +157,33 @@ public function normalize_basic_values_yields_expected_output_data_provider(): i ], ]; + yield 'nested iterable of scalar' => [ + 'input' => (function (): iterable { + yield 'strings' => (function(): iterable { + yield 'foo'; + yield 'bar'; + })(); + yield 'integers' => (function(): iterable { + yield 42; + yield 1337; + })(); + yield 'floats' => (function(): iterable { + yield 42.5; + yield 1337.404; + })(); + yield 'booleans' => (function(): iterable { + yield true; + yield false; + })(); + })(), + 'expected' => [ + 'strings' => ['foo', 'bar'], + 'integers' => [42, 1337], + 'floats' => [42.5, 1337.404], + 'booleans' => [true, false], + ], + ]; + yield 'stdClass' => [ 'input' => (function () { $object = new stdClass();