From e9f751eb09181ac5e258bc7d8b438b63e88c4ff1 Mon Sep 17 00:00:00 2001 From: othillo Date: Tue, 28 Apr 2020 08:53:31 +0200 Subject: [PATCH] expose state values --- src/State.php | 5 +++++ test/StateTest.php | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/State.php b/src/State.php index 586da44..ef97026 100644 --- a/src/State.php +++ b/src/State.php @@ -72,6 +72,11 @@ public function getId(): string return $this->id; } + public function getValues(): array + { + return $this->values; + } + /** * Mark the saga as done. */ diff --git a/test/StateTest.php b/test/StateTest.php index bc2926a..59134f2 100644 --- a/test/StateTest.php +++ b/test/StateTest.php @@ -79,6 +79,20 @@ public function it_exposes_its_id() $this->assertEquals(42, $this->state->getId()); } + /** + * @test + */ + public function it_exposes_its_values() + { + $state = new State('42'); + $state->set('foo', 'bar'); + $state->set('bar', 'baz'); + $this->assertEquals([ + 'foo' => 'bar', + 'bar' => 'baz', + ], $state->getValues()); + } + /** * @test */