diff --git a/tests/Unit/Traits/Helpers/QueryStringHelpersTest.php b/tests/Unit/Traits/Helpers/QueryStringHelpersTest.php new file mode 100644 index 000000000..15ae787c4 --- /dev/null +++ b/tests/Unit/Traits/Helpers/QueryStringHelpersTest.php @@ -0,0 +1,71 @@ +setQueryStringDisabled(); + } + + public function getCurrentQueryStringBinding(): array + { + return $this->queryStringWithQueryString(); + } + }; + + $testTableQueryString->mountManagesFilters(); + $testTableQueryString->configure(); + $testTableQueryString->boot(); + $testTableQueryString->bootedComponentUtilities(); + $testTableQueryString->bootedManagesFilters(); + $testTableQueryString->bootedWithColumns(); + $testTableQueryString->bootedWithColumnSelect(); + $testTableQueryString->bootedWithSecondaryHeader(); + $testTableQueryString->booted(); + + $this->assertSame([], $testTableQueryString->getCurrentQueryStringBinding()); + + } + + public function test_check_querystring_returns_default_if_enabled(): void + { + + $testTableQueryString = new class extends PetsTable + { + public function configure(): void + { + parent::configure(); + $this->setQueryStringEnabled(); + } + + public function getCurrentQueryStringBinding(): array + { + return $this->queryStringWithQueryString(); + } + }; + + $testTableQueryString->mountManagesFilters(); + $testTableQueryString->configure(); + $testTableQueryString->boot(); + $testTableQueryString->bootedComponentUtilities(); + $testTableQueryString->bootedManagesFilters(); + $testTableQueryString->bootedWithColumns(); + $testTableQueryString->bootedWithColumnSelect(); + $testTableQueryString->bootedWithSecondaryHeader(); + $testTableQueryString->booted(); + + $this->assertSame(['table' => ['except' => null, 'history' => false, 'keep' => false, 'as' => 'table']], $testTableQueryString->getCurrentQueryStringBinding()); + + } +}