33namespace Rappasoft \LaravelLivewireTables \Tests \Traits \Core ;
44
55use PHPUnit \Framework \Attributes \DataProvider ;
6+ use PHPUnit \Framework \Attributes \Depends ;
67use Rappasoft \LaravelLivewireTables \Tests \TestCase ;
8+ use Rappasoft \LaravelLivewireTables \Tests \Http \Livewire \PetsTable ;
79
810final class CustomAttributesTest extends TestCase
911{
12+
1013 public function test_can_get_custom_attribute_defaults_false_standard_mode (): void
1114 {
15+ $ mock = new class extends PetsTable
16+ {
17+ public ?array $ testAttributesArray ;
18+
19+ public function configure (): void
20+ {
21+ $ this ->setDataTableFingerprint ('test ' );
22+ }
23+ };
24+
25+ $ mock ->configure ();
26+ $ mock ->boot ();
27+
28+
1229 $ this ->assertSame ([
13- 'default ' => false ,
14- 'default-colors ' => true ,
15- 'default-styling ' => true ,
16- ], $ this -> basicTable -> getCustomAttributes ('bulkActionsButtonAttributes ' , false , true ));
30+ 'default ' => false ,
31+ 'default-colors ' => false ,
32+ 'default-styling ' => false
33+ ], $ mock -> getCustomAttributes ('testAttributesArray ' , false , true ));
1734 }
1835
1936 public function test_can_get_custom_attribute_defaults_false_classic_mode (): void
2037 {
38+ $ mock = new class extends PetsTable
39+ {
40+ public ?array $ testAttributesArray ;
41+
42+ public function configure (): void
43+ {
44+ $ this ->setDataTableFingerprint ('test ' );
45+ }
46+ };
47+
48+ $ mock ->configure ();
49+ $ mock ->boot ();
50+
2151 $ this ->assertSame ([
22- 'default-colors ' => true ,
23- 'default-styling ' => true ,
24- ], $ this -> basicTable -> getCustomAttributes ('bulkActionsButtonAttributes ' , false , false ));
52+ 'default-colors ' => false ,
53+ 'default-styling ' => false
54+ ], $ mock -> getCustomAttributes ('testAttributesArray ' , false , false ));
2555 }
2656
2757 public function test_can_get_custom_attribute_defaults_true_standard_mode (): void
2858 {
59+ $ mock = new class extends PetsTable
60+ {
61+ public ?array $ testAttributesArray ;
62+
63+ public function configure (): void
64+ {
65+ $ this ->setDataTableFingerprint ('test ' );
66+ }
67+ };
68+
69+ $ mock ->configure ();
70+ $ mock ->boot ();
71+
2972 $ this ->assertSame ([
30- 'default ' => true ,
31- 'default-colors ' => true ,
32- 'default-styling ' => true ,
33- ], $ this -> basicTable -> getCustomAttributes ('bulkActionsButtonAttributes ' , true , true ));
73+ 'default ' => true ,
74+ 'default-colors ' => true ,
75+ 'default-styling ' => true
76+ ], $ mock -> getCustomAttributes ('testAttributesArray ' , true , true ));
3477 }
3578
3679 public function test_can_get_custom_attribute_defaults_true_classic_mode (): void
3780 {
81+ $ mock = new class extends PetsTable
82+ {
83+ public ?array $ testAttributesArray ;
84+
85+ public function configure (): void
86+ {
87+ $ this ->setDataTableFingerprint ('test ' );
88+ }
89+ };
90+
91+ $ mock ->configure ();
92+ $ mock ->boot ();
93+
3894 $ this ->assertSame ([
39- 'default-colors ' => true ,
40- 'default-styling ' => true ,
41- ], $ this -> basicTable -> getCustomAttributes ('bulkActionsButtonAttributes ' , true , false ));
95+ 'default-colors ' => true ,
96+ 'default-styling ' => true
97+ ], $ mock -> getCustomAttributes ('testAttributesArray ' , true , false ));
4298 }
43- }
99+
100+
101+ }
0 commit comments