From a62c0961fc6916190a20461fabe6a923568f6e16 Mon Sep 17 00:00:00 2001 From: edalzell Date: Thu, 9 Jul 2026 17:28:29 -0700 Subject: [PATCH 1/3] use form handle in key --- src/Stache/Stores/FormSubmissionsStore.php | 2 +- .../Stache/Stores/FormSubmissionStoreTest.php | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/Stache/Stores/FormSubmissionsStore.php b/src/Stache/Stores/FormSubmissionsStore.php index 9501732a79f..4660f869168 100644 --- a/src/Stache/Stores/FormSubmissionsStore.php +++ b/src/Stache/Stores/FormSubmissionsStore.php @@ -22,7 +22,7 @@ class FormSubmissionsStore extends ChildStore public function getItemKey($item) { - return $item->id(); + return $item->form()->handle().'::'.$item->id(); } public function getItemFilter(SplFileInfo $file) diff --git a/tests/Stache/Stores/FormSubmissionStoreTest.php b/tests/Stache/Stores/FormSubmissionStoreTest.php index 669e4d3175c..9b8968992b2 100644 --- a/tests/Stache/Stores/FormSubmissionStoreTest.php +++ b/tests/Stache/Stores/FormSubmissionStoreTest.php @@ -29,6 +29,24 @@ public function setUp(): void Stache::store('form-submissions')->directory($this->directory); } + #[Test] + public function it_has_handle_in_key() + { + Facades\Form::make('contact_form')->save(); + Facades\Form::make('other_form')->save(); + $contactSubmission = $this->parent->store('contact_form')->makeItemFromFile( + Path::tidy($this->directory).'/contact_form/1631083591.2832.yaml', + 'contact form submission' + ); + $otherSubmission = $this->parent->store('other_form')->makeItemFromFile( + Path::tidy($this->directory).'/other_form/1631083591.2832.yaml', + 'other form submissions' + ); + + $this->assertEquals('contact_form::1631083591.2832', $this->parent->store('contact_form')->getItemKey($contactSubmission)); + $this->assertEquals('other_form::1631083591.2832', $this->parent->store('other_form')->getItemKey($otherSubmission)); + } + #[Test] public function it_makes_entry_instances_from_files() { From aaddd8856bc39025b415c0cd2a9a021eeab836b5 Mon Sep 17 00:00:00 2001 From: edalzell Date: Fri, 10 Jul 2026 07:56:31 -0700 Subject: [PATCH 2/3] fix test --- tests/Stache/Stores/FormSubmissionStoreTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Stache/Stores/FormSubmissionStoreTest.php b/tests/Stache/Stores/FormSubmissionStoreTest.php index 9b8968992b2..fb6cde83f5e 100644 --- a/tests/Stache/Stores/FormSubmissionStoreTest.php +++ b/tests/Stache/Stores/FormSubmissionStoreTest.php @@ -90,6 +90,6 @@ public function it_saves_to_disk() @unlink($path); $this->assertFileDoesNotExist($path); - $this->assertEquals($path, $this->parent->store('test_form')->paths()->get($submission->id())); + $this->assertEquals($path, $this->parent->store('test_form')->paths()->get('test_form::'.$submission->id())); } } From ae901b7e8a348203d295535b8dcdc96f0f4a06f3 Mon Sep 17 00:00:00 2001 From: edalzell Date: Fri, 10 Jul 2026 11:48:13 -0700 Subject: [PATCH 3/3] use proper yaml content --- tests/Stache/Stores/FormSubmissionStoreTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Stache/Stores/FormSubmissionStoreTest.php b/tests/Stache/Stores/FormSubmissionStoreTest.php index fb6cde83f5e..2dd3093e4f4 100644 --- a/tests/Stache/Stores/FormSubmissionStoreTest.php +++ b/tests/Stache/Stores/FormSubmissionStoreTest.php @@ -36,11 +36,11 @@ public function it_has_handle_in_key() Facades\Form::make('other_form')->save(); $contactSubmission = $this->parent->store('contact_form')->makeItemFromFile( Path::tidy($this->directory).'/contact_form/1631083591.2832.yaml', - 'contact form submission' + "name: John Smith\nmessage: Hello" ); $otherSubmission = $this->parent->store('other_form')->makeItemFromFile( Path::tidy($this->directory).'/other_form/1631083591.2832.yaml', - 'other form submissions' + "name: John Smith\nmessage: Hello" ); $this->assertEquals('contact_form::1631083591.2832', $this->parent->store('contact_form')->getItemKey($contactSubmission));