File tree Expand file tree Collapse file tree
tests/Feature/Instructors Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ public function viewAny(User $user)
5757
5858 public function refreshProperties (User $ user )
5959 {
60- return ($ user ->role ! == 2 )
60+ return ($ user ->role = == 2 )
6161 ? Response::allow ()
6262 : Response::deny ('You are not allowed to refresh the question properties from the database. ' );
6363
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ public function setup(): void
3030 parent ::setUp ();
3131 $ this ->user = factory (User::class)->create ();
3232 $ this ->user_2 = factory (User::class)->create ();
33+ $ this ->student_user = factory (User::class)->create (['role ' =>3 ]);
3334 $ course = factory (Course::class)->create (['user_id ' => $ this ->user ->id ]);
3435 $ this ->assignment = factory (Assignment::class)->create (['course_id ' => $ course ->id , 'solutions_released ' => 0 ]);
3536 $ this ->question = factory (Question::class)->create (['page_id ' => 1 ]);
@@ -58,7 +59,7 @@ public function setup(): void
5859
5960 public function non_instructor_cannot_refresh_question_properties ()
6061 {
61- $ this ->actingAs ($ this ->user_2 )->patchJson ("/api/questions/ {$ this ->question ->id }/refresh-properties " )
62+ $ this ->actingAs ($ this ->student_user )->patchJson ("/api/questions/ {$ this ->question ->id }/refresh-properties " )
6263 ->assertJson (['message ' => 'You are not allowed to refresh the question properties from the database. ' ]);
6364
6465 }
@@ -67,8 +68,8 @@ public function non_instructor_cannot_refresh_question_properties()
6768
6869 public function instructor_can_refresh_question_properties ()
6970 {
70- $ this ->actingAs ($ this ->user_2 )->patchJson ("/api/questions/ {$ this ->question ->id }/refresh-properties " )
71- ->assertJson (['message ' => 'You are not allowed to refresh the question properties from the database. ' ]);
71+ $ this ->actingAs ($ this ->user )->patchJson ("/api/questions/ {$ this ->question ->id }/refresh-properties " )
72+ ->assertJson (['type ' => 'success ' ]);
7273
7374 }
7475
You can’t perform that action at this time.
0 commit comments