Skip to content

Commit a3066ae

Browse files
committed
Test Fixes
1 parent 32e129e commit a3066ae

File tree

6 files changed

+32
-15
lines changed

6 files changed

+32
-15
lines changed

phpunit.xml.dist

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
failOnEmptyTestSuite="false"
1010
beStrictAboutOutputDuringTests="true" >
1111
<testsuites>
12-
<testsuite name="Laravel Livewire Tables Unit and Visuals Test Suite">
13-
<directory>tests/Unit</directory>
14-
<directory>tests/Visuals</directory>
15-
</testsuite>
1612
<testsuite name="Laravel Livewire Tables Unit Test Suite">
1713
<directory>tests/Unit</directory>
1814
</testsuite>

tests/Unit/DataTransferObjects/DebuggableDataTest.php

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,13 @@ public function test_check_all_default_dto_elements()
2525

2626
$defaultQuery = 'select "pets"."id" as "id", "pets"."sort" as "sort", "pets"."name" as "name", "pets"."age" as "age", "breed"."name" as "breed.name", "pets"."last_visit" as "last_visit" from "pets" left join "breeds" as "breed" on "pets"."breed_id" = "breed"."id" limit 10 offset 0';
2727
$this->assertSame($debuggableArray['query'], $defaultQuery);
28-
$this->assertSame($debuggableArray['filters'], []);
28+
$this->assertSame($debuggableArray['filters'], ['breed' => [],
29+
'species' => [],
30+
'breed_id_filter' => null,
31+
'pet_name_filter' => null,
32+
'last_visit_date_filter' => null,
33+
'last_visit_datetime_filter' => null,
34+
'breed_select_filter' => null]);
2935
$this->assertSame($debuggableArray['sorts'], []);
3036
$this->assertSame($debuggableArray['search'], '');
3137
$this->assertFalse($debuggableArray['select-all']);
@@ -36,12 +42,24 @@ public function test_check_dto_returns_filters_correctly()
3642
{
3743
$debuggableDTO = new DebuggableData($this->basicTable);
3844
$debuggableArray = $debuggableDTO->toArray();
39-
$this->assertSame($debuggableArray['filters'], []);
45+
$this->assertSame($debuggableArray['filters'], ['breed' => [],
46+
'species' => [],
47+
'breed_id_filter' => null,
48+
'pet_name_filter' => null,
49+
'last_visit_date_filter' => null,
50+
'last_visit_datetime_filter' => null,
51+
'breed_select_filter' => null]);
4052

4153
$this->basicTable->setFilter('breed', ['1']);
4254
$debuggableDTO = new DebuggableData($this->basicTable);
4355
$debuggableArray = $debuggableDTO->toArray();
44-
$this->assertSame($debuggableArray['filters'], ['breed' => ['1']]);
56+
$this->assertSame($debuggableArray['filters'], ['breed' => ["1"],
57+
'species' => [],
58+
'breed_id_filter' => null,
59+
'pet_name_filter' => null,
60+
'last_visit_date_filter' => null,
61+
'last_visit_datetime_filter' => null,
62+
'breed_select_filter' => null]);
4563

4664
}
4765
}

tests/Unit/Traits/Helpers/ColumnSelectHelpersTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,11 @@ public function configure(): void
157157
$this->enableColumnSelectEvent();
158158
}
159159
};
160+
$testTable->mountManagesFilters();
160161
$testTable->configure();
161162
$testTable->boot();
162163
$testTable->bootedComponentUtilities();
163-
$testTable->bootedWithData();
164+
$testTable->bootedManagesFilters();
164165
$testTable->bootedWithColumns();
165166
$testTable->bootedWithColumnSelect();
166167
$testTable->bootedWithSecondaryHeader();
@@ -187,10 +188,11 @@ public function configure(): void
187188
$this->disableColumnSelectEvent();
188189
}
189190
};
191+
$testTable->mountManagesFilters();
190192
$testTable->configure();
191193
$testTable->boot();
194+
$testTable->bootedManagesFilters();
192195
$testTable->bootedComponentUtilities();
193-
$testTable->bootedWithData();
194196
$testTable->bootedWithColumns();
195197
$testTable->bootedWithColumnSelect();
196198
$testTable->bootedWithSecondaryHeader();

tests/Unit/Traits/WithCustomisationsTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ public function configure(): void
9696
$temp->boot();
9797
$temp->bootedComponentUtilities();
9898
$temp->bootedManagesFilters();
99-
$temp->bootedWithData();
10099
$temp->bootedWithColumns();
101100
$temp->bootedWithColumnSelect();
102101
$temp->bootedWithSecondaryHeader();
@@ -130,7 +129,6 @@ public function configure(): void
130129

131130
$temp->boot();
132131
$temp->bootedComponentUtilities();
133-
$temp->bootedWithData();
134132
$temp->bootedWithColumns();
135133
$temp->bootedWithColumnSelect();
136134
$temp->bootedWithSecondaryHeader();

tests/Unit/Traits/WithMountTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ public function test_mounttable_gets_correct_first_item(): void
3131
$table2 = new PetsTableMount;
3232
$table2->boot();
3333
$table2->mount(202);
34+
$table2->mountManagesFilters();
3435
$table2->bootedComponentUtilities();
35-
$table2->bootedWithData();
36+
$table2->bootedManagesFilters();
3637
$table2->bootedWithColumns();
3738
$table2->bootedWithColumnSelect();
3839
$table2->bootedWithSecondaryHeader();
@@ -47,8 +48,9 @@ public function test_mounttable_gets_correct_first_item(): void
4748
$table3 = new PetsTableMount;
4849
$table3->boot();
4950
$table3->mount();
51+
$table3->mountManagesFilters();
52+
$table3->bootedManagesFilters();
5053
$table3->bootedComponentUtilities();
51-
$table3->bootedWithData();
5254
$table3->bootedWithColumns();
5355
$table3->bootedWithColumnSelect();
5456
$table3->bootedWithSecondaryHeader();

tests/Unit/Traits/WithSearchTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function configure(): void
5353
$testTableDefault->configure();
5454
$testTableDefault->boot();
5555
$testTableDefault->bootedComponentUtilities();
56-
$testTableDefault->bootedWithData();
56+
$testTableDefault->bootedManagesFilters();
5757
$testTableDefault->bootedWithColumns();
5858
$testTableDefault->bootedWithColumnSelect();
5959
$testTableDefault->bootedWithSecondaryHeader();
@@ -90,10 +90,11 @@ public function configure(): void
9090
}
9191
};
9292

93+
$testTableTrimSearch->mountManagesFilters();
9394
$testTableTrimSearch->configure();
9495
$testTableTrimSearch->boot();
9596
$testTableTrimSearch->bootedComponentUtilities();
96-
$testTableTrimSearch->bootedWithData();
97+
$testTableTrimSearch->bootedManagesFilters();
9798
$testTableTrimSearch->bootedWithColumns();
9899
$testTableTrimSearch->bootedWithColumnSelect();
99100
$testTableTrimSearch->bootedWithSecondaryHeader();

0 commit comments

Comments
 (0)