@@ -35,6 +35,9 @@ public function setUp(): void
3535 $ this ->refreshDatabase ();
3636 }
3737
38+ /**
39+ * Make sure the Member doesn't create issue when editing a user
40+ */
3841 public function testEditUser (): void
3942 {
4043 /** @var Member */
@@ -84,7 +87,7 @@ public function testEditUser(): void
8487 }
8588
8689 /**
87- * Test index ( `/users/u/{user_name}`) page.
90+ * Test `/users/u/{user_name}` page.
8891 */
8992 public function testPage (): void
9093 {
@@ -108,6 +111,9 @@ public function testPage(): void
108111 $ this ->assertNotEmpty ((string ) $ response ->getBody ());
109112 }
110113
114+ /**
115+ * Test `/users/u/{user_name}` page forbidden exception
116+ */
111117 public function testPageForForbiddenException (): void
112118 {
113119 /** @var Member */
@@ -122,4 +128,21 @@ public function testPageForForbiddenException(): void
122128 $ this ->assertJsonResponse ('Access Denied ' , $ response , 'title ' );
123129 $ this ->assertResponseStatus (403 , $ response );
124130 }
131+
132+ /**
133+ * Test issue that arose when using the Member model with UserRoleSprunje
134+ */
135+ public function testUserRoleSprunje (): void
136+ {
137+ /** @var Member */
138+ $ user = Member::factory ()->create ();
139+ $ this ->actAsUser ($ user , isMaster: true );
140+
141+ // Create request with method and url and fetch response
142+ $ request = $ this ->createJsonRequest ('GET ' , "/api/users/u/ {$ user ->user_name }/roles " );
143+ $ response = $ this ->handleRequest ($ request );
144+
145+ // Assert status & response is not empty
146+ $ this ->assertResponseStatus (200 , $ response );
147+ }
125148}
0 commit comments