2323});
2424
2525it ('can set and get cluster in plugin ' , function () {
26- $ plugin = new ActivityLogPlugin () ;
26+ $ plugin = new ActivityLogPlugin ;
2727 $ plugin ->cluster ('System ' );
2828
2929 expect ($ plugin ->getCluster ())->toBe ('System ' );
3030});
3131
3232it ('resolves subject title using helper ' , function () {
33- $ user = new class extends Model {
33+ $ user = new class extends Model
34+ {
3435 protected $ guarded = [];
3536 };
3637 $ user ->setAttribute ('name ' , 'Test User ' );
3738 $ user ->setAttribute ('id ' , 1 );
38-
39+
3940 // mimic accessors? No, just attributes.
4041 // getAttribute checks attributes array.
41-
42+
4243 expect (ActivityLogTitle::get ($ user ))->toBe ('Test User ' );
4344
44- $ post = new class extends Model {
45+ $ post = new class extends Model
46+ {
4547 protected $ guarded = [];
4648 };
4749 $ post ->setAttribute ('title ' , 'Test Post ' );
4850 $ post ->setAttribute ('id ' , 2 );
49-
51+
5052 expect (ActivityLogTitle::get ($ post ))->toBe ('Test Post ' );
5153
5254 expect (ActivityLogTitle::get ($ post ))->toBe ('Test Post ' );
5355
54- $ unknown = new class extends Model {
56+ $ unknown = new class extends Model
57+ {
5558 // Mocking getKey explicitly as anonymous class table might issue
56- public function getKey () { return 3 ; }
57- public function getTable () { return 'unknowns ' ; }
59+ public function getKey ()
60+ {
61+ return 3 ;
62+ }
63+
64+ public function getTable ()
65+ {
66+ return 'unknowns ' ;
67+ }
5868 };
5969 $ unknown ->setAttribute ('id ' , 3 );
6070
@@ -67,17 +77,17 @@ public function getTable() { return 'unknowns'; }
6777 // but we can verify the action exists on the table if we render it.
6878 // However, recreating table in test is complex.
6979 // We trust standard Filament testing for actions.
70-
80+
7181 // We can test if the Filter query works
7282 $ query = Activity::query ();
7383 $ filter = function ($ data , $ query ) {
74- $ query ->when (
84+ $ query ->when (
7585 $ data ['value ' ] ?? null ,
7686 fn ($ q , $ uuid ) => $ q ->where ('batch_uuid ' , $ uuid )
7787 );
7888 };
79-
89+
8090 $ filter (['value ' => 'test-uuid ' ], $ query );
81-
91+
8292 expect ($ query ->toSql ())->toContain ('batch_uuid ' );
8393});
0 commit comments