@@ -223,7 +223,7 @@ public function testSuccessfullyStoreEductionMe()
223223 'end_year ' => 2014
224224 ];
225225
226- $ this ->json ('post ' , '/api/users/me/education ' , $ postData ,
226+ $ this ->json ('post ' , '/api/users/me/educations ' , $ postData ,
227227 [
228228 'Authorization ' => 'Bearer ' . $ token ,
229229 'X-VMS-API-Key ' => $ this ->apiKey
@@ -253,12 +253,14 @@ public function testSuccessfullyUpdateEducationMe()
253253 'end_year ' => 2014
254254 ];
255255
256- $ this ->json ('put ' , '/api/users/me/education ' , $ putData ,
256+ $ this ->json ('put ' , '/api/users/me/educations ' , $ putData ,
257257 [
258258 'Authorization ' => 'Bearer ' . $ token ,
259259 'X-VMS-API-Key ' => $ this ->apiKey
260260 ])
261261 ->assertResponseStatus (204 );
262+
263+ $ this ->seeInDatabase ('educations ' , ['id ' => $ education ->id , 'degree ' => 4 ]);
262264 }
263265
264266 public function testUpdateEducationMeAccessDeniedException ()
@@ -297,7 +299,7 @@ public function testUpdateEducationMeAccessDeniedException()
297299 'end_year ' => '2013 '
298300 ];
299301
300- $ this ->json ('put ' , '/api/users/me/education ' , $ putData ,
302+ $ this ->json ('put ' , '/api/users/me/educations ' , $ putData ,
301303 [
302304 'Authorization ' => 'Bearer ' . $ token ,
303305 'X-VMS-API-Key ' => $ this ->apiKey
@@ -309,7 +311,29 @@ public function testUpdateEducationMeAccessDeniedException()
309311 ]]
310312 ])
311313 ->assertResponseStatus (403 );
314+ }
315+
316+ public function testSuccessfullyDeleteEducationMe ()
317+ {
318+ $ this ->factoryModel ();
319+
320+ $ volunteer = factory (App \Volunteer::class)->create ();
321+ $ volunteer ->is_actived = true ;
322+
323+ $ education = factory (App \Education::class)->make ();
324+ $ volunteer ->educations ()->save ($ education );
312325
326+ $ token = JWTAuth::fromUser ($ volunteer );
327+
328+ $ this ->json ('delete ' ,
329+ '/api/users/me/educations/ ' . $ education ->id
330+ ,[]
331+ ,[
332+ 'Authorization ' => 'Bearer ' . $ token ,
333+ 'X-VMS-API-Key ' => $ this ->apiKey
334+ ])
335+ ->assertResponseStatus (204 );
336+ $ this ->notSeeInDatabase ('educations ' , ['id ' => $ education ->id ]);
313337 }
314338
315339 protected function factoryModel ()
@@ -354,6 +378,6 @@ protected function factoryModel()
354378 $ city ->country ()->associate ($ country );
355379 $ city ->save ();
356380 }
357- }
381+ }
358382 }
359383}
0 commit comments