From c45dbecf14cc625a1c3cf935577653800ee8c8b0 Mon Sep 17 00:00:00 2001 From: antoine Date: Fri, 23 Jan 2026 16:12:30 +0100 Subject: [PATCH] Fix legacy global filter assertions + exception on setUp --- src/Utils/Testing/SharpAssertions.php | 27 +++++++++++++++---- .../Testing/SharpLegacyAssertionsTest.php | 2 +- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/Utils/Testing/SharpAssertions.php b/src/Utils/Testing/SharpAssertions.php index 9b0ffd2ba..e5709258e 100644 --- a/src/Utils/Testing/SharpAssertions.php +++ b/src/Utils/Testing/SharpAssertions.php @@ -18,11 +18,6 @@ trait SharpAssertions private BreadcrumbBuilder $breadcrumbBuilder; - public function setUpSharpAssertions(): void - { - $this->setGlobalFilterUrlDefault(); - } - public function sharpList(string $entityClassNameOrKey): PendingEntityList { $this->setGlobalFilterUrlDefault(); @@ -84,6 +79,8 @@ public function deleteFromSharpShow(string $entityClassNameOrKey, mixed $instanc { $entityKey = $this->resolveEntityKey($entityClassNameOrKey); + $this->setGlobalFilterUrlDefault(); + return $this ->delete( route( @@ -100,6 +97,8 @@ public function deleteFromSharpList(string $entityClassNameOrKey, mixed $instanc { $entityKey = $this->resolveEntityKey($entityClassNameOrKey); + $this->setGlobalFilterUrlDefault(); + return $this ->withHeader( SharpBreadcrumb::CURRENT_PAGE_URL_HEADER, @@ -119,6 +118,8 @@ public function getSharpForm(string $entityClassNameOrKey, mixed $instanceId = n { $entityKey = $this->resolveEntityKey($entityClassNameOrKey); + $this->setGlobalFilterUrlDefault(); + return $this ->get( $instanceId @@ -144,6 +145,8 @@ public function getSharpSingleForm(string $entityClassNameOrKey) { $entityKey = $this->resolveEntityKey($entityClassNameOrKey); + $this->setGlobalFilterUrlDefault(); + return $this ->get( route( @@ -160,6 +163,8 @@ public function updateSharpForm(string $entityClassNameOrKey, $instanceId, array { $entityKey = $this->resolveEntityKey($entityClassNameOrKey); + $this->setGlobalFilterUrlDefault(); + return $this ->post( route( @@ -177,6 +182,8 @@ public function updateSharpSingleForm(string $entityClassNameOrKey, array $data) { $entityKey = $this->resolveEntityKey($entityClassNameOrKey); + $this->setGlobalFilterUrlDefault(); + return $this ->post( route( @@ -193,6 +200,8 @@ public function getSharpShow(string $entityClassNameOrKey, $instanceId) { $entityKey = $this->resolveEntityKey($entityClassNameOrKey); + $this->setGlobalFilterUrlDefault(); + return $this ->get( route( @@ -210,6 +219,8 @@ public function storeSharpForm(string $entityClassNameOrKey, array $data) { $entityKey = $this->resolveEntityKey($entityClassNameOrKey); + $this->setGlobalFilterUrlDefault(); + return $this ->post( route( @@ -236,6 +247,8 @@ public function callSharpInstanceCommandFromList( ? class_basename($commandKeyOrClassName) : $commandKeyOrClassName; + $this->setGlobalFilterUrlDefault(); + return $this ->withHeader( SharpBreadcrumb::CURRENT_PAGE_URL_HEADER, @@ -265,6 +278,8 @@ public function callSharpInstanceCommandFromShow( ? class_basename($commandKeyOrClassName) : $commandKeyOrClassName; + $this->setGlobalFilterUrlDefault(); + return $this ->withHeader( SharpBreadcrumb::CURRENT_PAGE_URL_HEADER, @@ -293,6 +308,8 @@ public function callSharpEntityCommandFromList( ? class_basename($commandKeyOrClassName) : $commandKeyOrClassName; + $this->setGlobalFilterUrlDefault(); + return $this ->withHeader( SharpBreadcrumb::CURRENT_PAGE_URL_HEADER, diff --git a/tests/Unit/Utils/Testing/SharpLegacyAssertionsTest.php b/tests/Unit/Utils/Testing/SharpLegacyAssertionsTest.php index 551deb40a..6f4a5ae17 100644 --- a/tests/Unit/Utils/Testing/SharpLegacyAssertionsTest.php +++ b/tests/Unit/Utils/Testing/SharpLegacyAssertionsTest.php @@ -203,7 +203,7 @@ $this->assertEquals( route('code16.sharp.form.edit', [ - 'globalFilter' => 'root', + 'globalFilter' => 'two', 'parentUri' => 's-list/leaves', 'entityKey' => 'leaves', 'instanceId' => 6,