File tree Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,15 @@ public function testToastShouldBePersistent(): void
83
83
self ::assertEquals ('false ' , session ('toast_notification.auto_hide ' ));
84
84
}
85
85
86
+ public function testToastShouldBePersistentAlias (): void
87
+ {
88
+ Toast::info ('Hello Alexandr! ' )
89
+ ->disableAutoHide ();
90
+
91
+ self ::assertEquals ('Hello Alexandr! ' , session ('toast_notification.message ' ));
92
+ self ::assertEquals ('false ' , session ('toast_notification.auto_hide ' ));
93
+ }
94
+
86
95
public function testToastShouldSetDelayAndBePersistent (): void
87
96
{
88
97
Toast::info ('Hello Alexandr! ' )
Original file line number Diff line number Diff line change 6
6
7
7
use Exception ;
8
8
use Orchid \Platform \Dashboard ;
9
+ use Illuminate \Support \Collection ;
9
10
use Orchid \Platform \ItemPermission ;
10
11
use Orchid \Platform \Models \Role ;
11
12
use Orchid \Platform \Models \User ;
@@ -387,4 +388,35 @@ public function testScopeByAnyAccess(): void
387
388
$ this ->assertTrue ($ users ->contains ($ user ));
388
389
$ this ->assertTrue ($ users ->contains ($ userAlt ));
389
390
}
391
+
392
+ public function testCountRoleCorrectPermissionCount (): void
393
+ {
394
+ $ role = $ this ->createRole ();
395
+
396
+ $ this ->assertEquals (2 , $ role ->getCountPermissions ());
397
+ }
398
+
399
+ public function testGetStatusPermissionReturnsAllPermissionsWithCorrectActiveFlags (): void
400
+ {
401
+ $ user = User::factory ()->create ([
402
+ 'permissions ' => [
403
+ 'platform.systems.attachment ' => true ,
404
+ ]
405
+ ]);
406
+
407
+ $ expectedPermissions = \Orchid \Support \Facades \Dashboard::getPermission ()
408
+ ->map
409
+ ->map (function ($ permission ) {
410
+ $ permission ['active ' ] = in_array ($ permission ['slug ' ], [
411
+ 'platform.systems.attachment ' ,
412
+ ]);
413
+
414
+ return $ permission ;
415
+ });
416
+
417
+ $ resultPermissions = $ user ->getStatusPermission ();
418
+
419
+ $ this ->instance (Collection::class, $ resultPermissions );
420
+ $ this ->assertEquals ($ expectedPermissions , $ resultPermissions );
421
+ }
390
422
}
You can’t perform that action at this time.
0 commit comments