@@ -26,8 +26,8 @@ abstract class TestCase extends Orchestra
2626 */
2727 public function tearDown (): void
2828 {
29- User::truncate ();
30- Admin::truncate ();
29+ User::query ()-> truncate ();
30+ Admin::query ()-> truncate ();
3131 $ this ->app [Role::class]::truncate ();
3232 $ this ->app [Permission::class]::truncate ();
3333 }
@@ -53,12 +53,12 @@ public function setUp(): void
5353 $ this ->reloadPermissions ();
5454
5555 $ this ->testUser = User::first ();
56- $ this ->testUserRole = \ app (\ config ('permission.models.role ' ))->where ('name ' , 'testRole ' )->first ();
57- $ this ->testUserPermission = \ app (\ config ('permission.models.permission ' ))->where ('name ' , 'edit-articles ' )->first ();
56+ $ this ->testUserRole = app (config ('permission.models.role ' ))->where ('name ' , 'testRole ' )->first ();
57+ $ this ->testUserPermission = app (config ('permission.models.permission ' ))->where ('name ' , 'edit-articles ' )->first ();
5858
5959 $ this ->testAdmin = Admin::first ();
60- $ this ->testAdminRole = \ app (\ config ('permission.models.role ' ))->where ('name ' , 'testAdminRole ' )->first ();
61- $ this ->testAdminPermission = \ app (\ config ('permission.models.permission ' ))->where ('name ' , 'admin-permission ' )->first ();
60+ $ this ->testAdminRole = app (config ('permission.models.role ' ))->where ('name ' , 'testAdminRole ' )->first ();
61+ $ this ->testAdminPermission = app (config ('permission.models.permission ' ))->where ('name ' , 'admin-permission ' )->first ();
6262
6363 $ this ->clearLogTestHandler ();
6464
@@ -70,7 +70,8 @@ public function setUp(): void
7070 *
7171 * @return array
7272 */
73- protected function getPackageProviders ($ app ): array {
73+ protected function getPackageProviders ($ app ): array
74+ {
7475 return [
7576 PermissionServiceProvider::class,
7677 MongodbServiceProvider::class,
@@ -110,11 +111,11 @@ protected function getEnvironmentSetUp($app)
110111 *
111112 * @return bool
112113 */
113- protected function reloadPermissions ()
114+ protected function reloadPermissions (): bool
114115 {
115- \ app (PermissionRegistrar::class)->forgetCachedPermissions ();
116+ app (PermissionRegistrar::class)->forgetCachedPermissions ();
116117
117- return \ app (PermissionRegistrar::class)->registerPermissions ();
118+ return app (PermissionRegistrar::class)->registerPermissions ();
118119 }
119120
120121 /**
@@ -135,7 +136,7 @@ public function refreshTestAdmin()
135136
136137 protected function clearLogTestHandler ()
137138 {
138- \ collect ($ this ->app ['log ' ]->getLogger ()->getHandlers ())->filter (function ($ handler ) {
139+ collect ($ this ->app ['log ' ]->getLogger ()->getHandlers ())->filter (function ($ handler ) {
139140 return $ handler instanceof TestHandler;
140141 })->first ()->clear ();
141142 }
@@ -156,21 +157,23 @@ protected function assertLogged($message, $level)
156157 *
157158 * @return bool
158159 */
159- protected function hasLog ($ message , $ level ): bool {
160- return \collect ($ this ->app ['log ' ]->getLogger ()->getHandlers ())->filter (function ($ handler ) use (
161- $ message ,
162- $ level
163- ) {
160+ protected function hasLog ($ message , $ level ): bool
161+ {
162+ return collect ($ this ->app ['log ' ]->getLogger ()->getHandlers ())->filter (function ($ handler ) use (
163+ $ message ,
164+ $ level
165+ ) {
164166 return $ handler instanceof TestHandler && $ handler ->hasRecordThatContains ($ message , $ level );
165167 })->count () > 0 ;
166168 }
167169
168170 /**
169171 * @param $message
172+ * @param $level
170173 */
171174 protected function assertLogMessage ($ message , $ level )
172175 {
173- if (\ config ('permission.log_registration_exception ' )) {
176+ if (config ('permission.log_registration_exception ' )) {
174177 $ this ->assertLogged ($ message , $ level );
175178 } else {
176179 $ this ->assertNotLogged ($ message , $ level );
@@ -179,10 +182,11 @@ protected function assertLogMessage($message, $level)
179182
180183 /**
181184 * @param $message
185+ * @param $role_permission
182186 */
183187 protected function assertShowPermission ($ message , $ role_permission )
184188 {
185- if (\ config ('permission.display_permission_in_exception ' )) {
189+ if (config ('permission.display_permission_in_exception ' )) {
186190 $ this ->assertContains ($ role_permission , $ message );
187191 } else {
188192 $ this ->assertStringNotContainsString ($ role_permission , $ message );
0 commit comments