From bb59b1df5c7815d3e13363dbd69137f4b1f93e79 Mon Sep 17 00:00:00 2001 From: gwleuverink Date: Mon, 26 Aug 2024 03:07:23 +0200 Subject: [PATCH] add more failing tests --- tests/Unit/MacroTest.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/Unit/MacroTest.php b/tests/Unit/MacroTest.php index 489523f..4f3ef44 100644 --- a/tests/Unit/MacroTest.php +++ b/tests/Unit/MacroTest.php @@ -63,6 +63,24 @@ ]); }); +it('can iterate over properties in a group when the each() method was chained', function () { + $component = new class extends TestComponent + { + #[Group('a')] + public $foo = 1; + + #[Group('a')] + public $bar = 2; + }; + + $iterations = 0; + + group($component, 'a')->each(fn () => $iterations++); + + expect($iterations)->toBe(2); +}); + // Should be Integration tests? Component not mounted on unit level. Can't reset properties this way it('resets all properties in a group when the reset() method was chained')->todo(); // add two groups for unhappy path it('returns & resets all properties in a group when the pull() method was chained')->todo(); // add two groups for unhappy path +it('validates all properties in a group when the validate() method was chained')->todo(); // add two groups for unhappy path