Skip to content

Commit e6b0de7

Browse files
authored
Merge pull request #695 from code16/fix-global-filter-triggering-exception
Testing: Fix legacy global filter assertions + exception on setUp
2 parents 6775066 + c45dbec commit e6b0de7

2 files changed

Lines changed: 23 additions & 6 deletions

File tree

src/Utils/Testing/SharpAssertions.php

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ trait SharpAssertions
1818

1919
private BreadcrumbBuilder $breadcrumbBuilder;
2020

21-
public function setUpSharpAssertions(): void
22-
{
23-
$this->setGlobalFilterUrlDefault();
24-
}
25-
2621
public function sharpList(string $entityClassNameOrKey): PendingEntityList
2722
{
2823
$this->setGlobalFilterUrlDefault();
@@ -84,6 +79,8 @@ public function deleteFromSharpShow(string $entityClassNameOrKey, mixed $instanc
8479
{
8580
$entityKey = $this->resolveEntityKey($entityClassNameOrKey);
8681

82+
$this->setGlobalFilterUrlDefault();
83+
8784
return $this
8885
->delete(
8986
route(
@@ -100,6 +97,8 @@ public function deleteFromSharpList(string $entityClassNameOrKey, mixed $instanc
10097
{
10198
$entityKey = $this->resolveEntityKey($entityClassNameOrKey);
10299

100+
$this->setGlobalFilterUrlDefault();
101+
103102
return $this
104103
->withHeader(
105104
SharpBreadcrumb::CURRENT_PAGE_URL_HEADER,
@@ -119,6 +118,8 @@ public function getSharpForm(string $entityClassNameOrKey, mixed $instanceId = n
119118
{
120119
$entityKey = $this->resolveEntityKey($entityClassNameOrKey);
121120

121+
$this->setGlobalFilterUrlDefault();
122+
122123
return $this
123124
->get(
124125
$instanceId
@@ -144,6 +145,8 @@ public function getSharpSingleForm(string $entityClassNameOrKey)
144145
{
145146
$entityKey = $this->resolveEntityKey($entityClassNameOrKey);
146147

148+
$this->setGlobalFilterUrlDefault();
149+
147150
return $this
148151
->get(
149152
route(
@@ -160,6 +163,8 @@ public function updateSharpForm(string $entityClassNameOrKey, $instanceId, array
160163
{
161164
$entityKey = $this->resolveEntityKey($entityClassNameOrKey);
162165

166+
$this->setGlobalFilterUrlDefault();
167+
163168
return $this
164169
->post(
165170
route(
@@ -177,6 +182,8 @@ public function updateSharpSingleForm(string $entityClassNameOrKey, array $data)
177182
{
178183
$entityKey = $this->resolveEntityKey($entityClassNameOrKey);
179184

185+
$this->setGlobalFilterUrlDefault();
186+
180187
return $this
181188
->post(
182189
route(
@@ -193,6 +200,8 @@ public function getSharpShow(string $entityClassNameOrKey, $instanceId)
193200
{
194201
$entityKey = $this->resolveEntityKey($entityClassNameOrKey);
195202

203+
$this->setGlobalFilterUrlDefault();
204+
196205
return $this
197206
->get(
198207
route(
@@ -210,6 +219,8 @@ public function storeSharpForm(string $entityClassNameOrKey, array $data)
210219
{
211220
$entityKey = $this->resolveEntityKey($entityClassNameOrKey);
212221

222+
$this->setGlobalFilterUrlDefault();
223+
213224
return $this
214225
->post(
215226
route(
@@ -236,6 +247,8 @@ public function callSharpInstanceCommandFromList(
236247
? class_basename($commandKeyOrClassName)
237248
: $commandKeyOrClassName;
238249

250+
$this->setGlobalFilterUrlDefault();
251+
239252
return $this
240253
->withHeader(
241254
SharpBreadcrumb::CURRENT_PAGE_URL_HEADER,
@@ -265,6 +278,8 @@ public function callSharpInstanceCommandFromShow(
265278
? class_basename($commandKeyOrClassName)
266279
: $commandKeyOrClassName;
267280

281+
$this->setGlobalFilterUrlDefault();
282+
268283
return $this
269284
->withHeader(
270285
SharpBreadcrumb::CURRENT_PAGE_URL_HEADER,
@@ -293,6 +308,8 @@ public function callSharpEntityCommandFromList(
293308
? class_basename($commandKeyOrClassName)
294309
: $commandKeyOrClassName;
295310

311+
$this->setGlobalFilterUrlDefault();
312+
296313
return $this
297314
->withHeader(
298315
SharpBreadcrumb::CURRENT_PAGE_URL_HEADER,

tests/Unit/Utils/Testing/SharpLegacyAssertionsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@
203203

204204
$this->assertEquals(
205205
route('code16.sharp.form.edit', [
206-
'globalFilter' => 'root',
206+
'globalFilter' => 'two',
207207
'parentUri' => 's-list/leaves',
208208
'entityKey' => 'leaves',
209209
'instanceId' => 6,

0 commit comments

Comments
 (0)