From d12866587412fbecd3e89ce563c5578b296dbbc7 Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Wed, 27 Nov 2024 17:21:13 -0500 Subject: [PATCH] add test here --- tests/Fields/ValueTest.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/Fields/ValueTest.php b/tests/Fields/ValueTest.php index bd88402554..6ec9af7566 100644 --- a/tests/Fields/ValueTest.php +++ b/tests/Fields/ValueTest.php @@ -8,6 +8,7 @@ use Statamic\Fields\Field; use Statamic\Fields\Fieldtype; use Statamic\Fields\Value; +use Statamic\Fields\Values; use Statamic\Query\Builder; use Tests\TestCase; @@ -301,6 +302,26 @@ public function it_can_iterate_over_query_builder() ], $arr); } + #[Test] + public function it_can_iterate_over_values() + { + $val = new Value(new Values([ + 'a' => 'alfa', + 'b' => 'bravo', + ])); + + $arr = []; + + foreach ($val as $key => $value) { + $arr[$key] = $value; + } + + $this->assertEquals([ + 'a' => 'alfa', + 'b' => 'bravo', + ], $arr); + } + #[Test] public function it_can_proxy_methods_to_value() {