22
33namespace Tests \Permissions ;
44
5- use BookStack \Activity \ActivityType ;
65use BookStack \Activity \Models \Comment ;
76use BookStack \Entities \Models \Book ;
87use BookStack \Entities \Models \Bookshelf ;
98use BookStack \Entities \Models \Chapter ;
109use BookStack \Entities \Models \Entity ;
1110use BookStack \Entities \Models \Page ;
1211use BookStack \Uploads \Image ;
13- use BookStack \Users \Models \Role ;
1412use BookStack \Users \Models \User ;
1513use Illuminate \Testing \TestResponse ;
1614use Tests \TestCase ;
@@ -152,10 +150,14 @@ public function test_restrictions_manage_own_permission()
152150 /**
153151 * Check a standard entity access permission.
154152 */
155- private function checkAccessPermission (string $ permission , array $ accessUrls = [], array $ visibles = [])
156- {
153+ private function checkAccessPermission (
154+ string $ permission ,
155+ array $ accessUrls = [],
156+ array $ visibles = [],
157+ string $ expectedRedirectUri = '/ ' ,
158+ ) {
157159 foreach ($ accessUrls as $ url ) {
158- $ this ->actingAs ($ this ->user )->get ($ url )->assertRedirect (' / ' );
160+ $ this ->actingAs ($ this ->user )->get ($ url )->assertRedirect ($ expectedRedirectUri );
159161 }
160162
161163 foreach ($ visibles as $ url => $ text ) {
@@ -535,11 +537,11 @@ public function test_page_edit_own_permission()
535537 $ ownPage ->getUrl () . '/edit ' ,
536538 ], [
537539 $ ownPage ->getUrl () => 'Edit ' ,
538- ]);
540+ ], $ ownPage -> getUrl () );
539541
540542 $ resp = $ this ->get ($ otherPage ->getUrl ());
541543 $ this ->withHtml ($ resp )->assertElementNotContains ('.action-buttons ' , 'Edit ' );
542- $ this ->get ($ otherPage ->getUrl () . '/edit ' )->assertRedirect (' / ' );
544+ $ this ->get ($ otherPage ->getUrl () . '/edit ' )->assertRedirect ($ otherPage -> getUrl () );
543545 }
544546
545547 public function test_page_edit_all_permission ()
@@ -550,7 +552,7 @@ public function test_page_edit_all_permission()
550552 $ otherPage ->getUrl ('/edit ' ),
551553 ], [
552554 $ otherPage ->getUrl () => 'Edit ' ,
553- ]);
555+ ], $ otherPage -> getUrl () );
554556 }
555557
556558 public function test_page_delete_own_permission ()
0 commit comments