1- <?php
2-
3- namespace Rappasoft \LaravelLivewireTables \Tests \Unit \Traits \Helpers ;
4-
5- use Rappasoft \LaravelLivewireTables \Tests \Http \Livewire \PetsTable ;
6- use Rappasoft \LaravelLivewireTables \Tests \TestCase ;
7-
8- final class QueryStringHelpersTest extends TestCase
9- {
10- public function test_check_querystring_returns_empty_if_disabled (): void
11- {
12-
13- $ testTableQueryString = new class extends PetsTable
14- {
15- public function configure (): void
16- {
17- parent ::configure ();
18- $ this ->setQueryStringDisabled ();
19- }
20-
21- public function getCurrentQueryStringBinding (): array
22- {
23- return $ this ->queryStringWithQueryString ();
24- }
25- };
26-
27- $ testTableQueryString ->mountManagesFilters ();
28- $ testTableQueryString ->configure ();
29- $ testTableQueryString ->boot ();
30- $ testTableQueryString ->bootedComponentUtilities ();
31- $ testTableQueryString ->bootedManagesFilters ();
32- $ testTableQueryString ->bootedWithColumns ();
33- $ testTableQueryString ->bootedWithColumnSelect ();
34- $ testTableQueryString ->bootedWithSecondaryHeader ();
35- $ testTableQueryString ->booted ();
36-
37- $ this ->assertSame ([], $ testTableQueryString ->getCurrentQueryStringBinding ());
38-
39-
40- }
41-
42- public function test_check_querystring_returns_default_if_enabled (): void
43- {
44-
45- $ testTableQueryString = new class extends PetsTable
46- {
47- public function configure (): void
48- {
49- parent ::configure ();
50- $ this ->setQueryStringEnabled ();
51- }
52-
53- public function getCurrentQueryStringBinding (): array
54- {
55- return $ this ->queryStringWithQueryString ();
56- }
57- };
58-
59- $ testTableQueryString ->mountManagesFilters ();
60- $ testTableQueryString ->configure ();
61- $ testTableQueryString ->boot ();
62- $ testTableQueryString ->bootedComponentUtilities ();
63- $ testTableQueryString ->bootedManagesFilters ();
64- $ testTableQueryString ->bootedWithColumns ();
65- $ testTableQueryString ->bootedWithColumnSelect ();
66- $ testTableQueryString ->bootedWithSecondaryHeader ();
67- $ testTableQueryString ->booted ();
68-
69- $ this ->assertSame (['table ' => ['except ' => null , 'history ' => false , 'keep ' => false , 'as ' => 'table ' ]], $ testTableQueryString ->getCurrentQueryStringBinding ());
70-
71-
72- }
73-
74-
75- }
1+ <?php
2+
3+ namespace Rappasoft \LaravelLivewireTables \Tests \Unit \Traits \Helpers ;
4+
5+ use Rappasoft \LaravelLivewireTables \Tests \Http \Livewire \PetsTable ;
6+ use Rappasoft \LaravelLivewireTables \Tests \TestCase ;
7+
8+ final class QueryStringHelpersTest extends TestCase
9+ {
10+ public function test_check_querystring_returns_empty_if_disabled (): void
11+ {
12+
13+ $ testTableQueryString = new class extends PetsTable
14+ {
15+ public function configure (): void
16+ {
17+ parent ::configure ();
18+ $ this ->setQueryStringDisabled ();
19+ }
20+
21+ public function getCurrentQueryStringBinding (): array
22+ {
23+ return $ this ->queryStringWithQueryString ();
24+ }
25+ };
26+
27+ $ testTableQueryString ->mountManagesFilters ();
28+ $ testTableQueryString ->configure ();
29+ $ testTableQueryString ->boot ();
30+ $ testTableQueryString ->bootedComponentUtilities ();
31+ $ testTableQueryString ->bootedManagesFilters ();
32+ $ testTableQueryString ->bootedWithColumns ();
33+ $ testTableQueryString ->bootedWithColumnSelect ();
34+ $ testTableQueryString ->bootedWithSecondaryHeader ();
35+ $ testTableQueryString ->booted ();
36+
37+ $ this ->assertSame ([], $ testTableQueryString ->getCurrentQueryStringBinding ());
38+
39+ }
40+
41+ public function test_check_querystring_returns_default_if_enabled (): void
42+ {
43+
44+ $ testTableQueryString = new class extends PetsTable
45+ {
46+ public function configure (): void
47+ {
48+ parent ::configure ();
49+ $ this ->setQueryStringEnabled ();
50+ }
51+
52+ public function getCurrentQueryStringBinding (): array
53+ {
54+ return $ this ->queryStringWithQueryString ();
55+ }
56+ };
57+
58+ $ testTableQueryString ->mountManagesFilters ();
59+ $ testTableQueryString ->configure ();
60+ $ testTableQueryString ->boot ();
61+ $ testTableQueryString ->bootedComponentUtilities ();
62+ $ testTableQueryString ->bootedManagesFilters ();
63+ $ testTableQueryString ->bootedWithColumns ();
64+ $ testTableQueryString ->bootedWithColumnSelect ();
65+ $ testTableQueryString ->bootedWithSecondaryHeader ();
66+ $ testTableQueryString ->booted ();
67+
68+ $ this ->assertSame (['table ' => ['except ' => null , 'history ' => false , 'keep ' => false , 'as ' => 'table ' ]], $ testTableQueryString ->getCurrentQueryStringBinding ());
69+
70+ }
71+ }
0 commit comments