@@ -66,6 +66,7 @@ public function testLogin(): void
6666 $ this ->session ([]);
6767
6868 $ this ->get ('developers/login ' );
69+ $ this ->assertResponseCode (302 );
6970 $ this ->assertRedirectContains ('https://github.com/login/oauth/authorize ' );
7071 $ this ->assertRedirectContains ('developers%2Fcallback ' );
7172 }
@@ -97,6 +98,7 @@ public function testCallback(): void
9798 $ this ->newClientResponse (200 , [], $ emptyAccessTokenResponse ),
9899 );
99100 $ this ->get ('developers/callback/?code=123123123 ' );
101+ $ this ->assertResponseCode (302 );
100102 $ this ->assertRedirect (['controller ' => '' , 'action ' => 'index ' ]);
101103
102104 // Data for 1.2
@@ -120,6 +122,7 @@ public function testCallback(): void
120122 );
121123
122124 $ this ->get ('developers/callback/?code=123123123 ' );
125+ $ this ->assertResponseCode (302 );
123126 $ this ->assertRedirect (['controller ' => '' , 'action ' => 'index ' ]);
124127
125128 // Data for 2.
@@ -142,6 +145,7 @@ public function testCallback(): void
142145 ]
143146 );
144147 $ this ->get ('developers/callback/?code=123123123 ' );
148+ $ this ->assertResponseCode (302 );
145149 $ this ->assertRedirect (['controller ' => '' , 'action ' => 'index ' ]);
146150
147151 // Data for 3.
@@ -161,6 +165,7 @@ public function testCallback(): void
161165
162166 // Case 3. Successful response code (new user), check whether session variables are init
163167 $ this ->get ('developers/callback/?code=123123123 ' );
168+ $ this ->assertResponseCode (302 );
164169 $ this ->assertSession (3 , 'Developer.id ' );
165170 $ this ->assertSession (true , 'read_only ' );
166171 $ this ->assertSession ('abc ' , 'access_token ' );
@@ -188,6 +193,7 @@ public function testCallback(): void
188193 $ this ->session (['last_page ' => null ]);
189194
190195 $ this ->get ('developers/callback/?code=123123123 ' );
196+ $ this ->assertResponseCode (302 );
191197 $ this ->assertSession (3 , 'Developer.id ' );
192198 $ this ->assertSession (false , 'read_only ' );
193199 $ this ->assertSession ('abc ' , 'access_token ' );
@@ -201,9 +207,10 @@ public function testCallback(): void
201207 */
202208 public function testLogout (): void
203209 {
204- $ this ->session (['Developer.id ' => 1 ]);
210+ $ this ->session (['Developer.id ' => 1 , ' read_only ' => false ]);
205211
206212 $ this ->get ('developers/logout ' );
213+ $ this ->assertResponseCode (302 );
207214 $ this ->assertSession (null , 'Developer.id ' );
208215 $ this ->assertRedirect (['controller ' => '' , 'action ' => 'index ' ]);
209216 }
0 commit comments