@@ -43,14 +43,15 @@ public function setUp(): void
4343 parent ::setUp ();
4444 $ this ->Incidents = TableRegistry::getTableLocator ()->get ('Incidents ' );
4545 //$Session = new SessionComponent(new ComponentRegistry());
46- $ this ->session (['Developer.id ' => 1 ]);
46+ $ this ->session (['Developer.id ' => 1 , ' read_only ' => false ]);
4747 $ this ->Reports = TableRegistry::getTableLocator ()->get ('Reports ' );
4848 $ this ->setupTransports ();
4949 }
5050
5151 public function testView (): void
5252 {
5353 $ this ->get ('/incidents/view/1 ' );
54+ $ this ->assertResponseCode (200 );
5455
5556 $ this ->assertNotEmpty ($ this ->viewVariable ('incident ' ));
5657 $ this ->assertIsArray (
@@ -64,7 +65,7 @@ public function testView(): void
6465 public function testJson (): void
6566 {
6667 $ this ->get ('/incidents/json/1 ' );
67- $ this ->assertSame (200 , $ this -> _response -> getStatusCode (), ' The reponse code should be 200 ! ' );
68+ $ this ->assertResponseCode (200 );
6869 $ incident = json_decode ($ this ->_response ->getBody (), true );
6970 $ this ->assertNotNull ($ incident , 'The incident should be an array ! ' );
7071
@@ -111,7 +112,7 @@ public function testCreate(): void
111112 $ this ->configRequest (['input ' => $ bugReport ]);
112113 $ this ->post ('/incidents/create ' );
113114
114- $ this ->assertSame (200 , $ this -> _response -> getStatusCode (), ' The reponse code should be 200 ! ' );
115+ $ this ->assertResponseCode (200 );
115116 $ incident = json_decode ($ this ->_response ->getBody (), true );
116117 $ this ->assertNotNull ($ incident , 'The incident should be an array ! ' );
117118
@@ -140,7 +141,7 @@ public function testCreate(): void
140141 //Configure::write('test_transport_email', null);
141142
142143 $ this ->post ('/incidents/create ' );
143- $ this ->assertSame (200 , $ this -> _response -> getStatusCode (), ' The reponse code should be 200 ! ' );
144+ $ this ->assertResponseCode (200 );
144145 $ result = json_decode ($ this ->_response ->getBody (), true );
145146 $ this ->assertNotNull ($ result );
146147 $ this ->assertSame (true , $ result ['success ' ]);
@@ -171,7 +172,7 @@ public function testCreateInvalidEmptyReport(): void
171172 {
172173 $ this ->configRequest (['input ' => '' ]);
173174 $ this ->post ('/incidents/create ' );
174- $ this ->assertSame (200 , $ this -> _response -> getStatusCode (), ' The reponse code should be 200 ! ' );
175+ $ this ->assertResponseCode (200 );
175176 $ result = json_decode ($ this ->_response ->getBody (), true );
176177 $ this ->assertNotNull ($ result );
177178 $ this ->assertSame (false , $ result ['success ' ]);
@@ -186,7 +187,7 @@ public function testCreateInvalidReport(): void
186187 $ bugReportDecoded = json_decode ($ bugReport , true );
187188 $ this ->configRequest (['input ' => $ bugReport ]);
188189 $ this ->post ('/incidents/create ' );
189- $ this ->assertSame (200 , $ this -> _response -> getStatusCode (), ' The reponse code should be 200 ! ' );
190+ $ this ->assertResponseCode (200 );
190191 $ result = json_decode ($ this ->_response ->getBody (), true );
191192 $ this ->assertNotNull ($ result );
192193 $ this ->assertSame (true , $ result ['success ' ]);
0 commit comments