public function testGameDelete() { GameScore::create(['username' => 'AAA', 'score' => 1000000, 'game' => $this->game->id]); GameScore::create(['username' => 'AAA', 'score' => 2000000, 'game' => $this->gameTwo->id]); $this->json('DELETE', 'game-scores/1'); $this->assertResponseStatus(204); $this->assertEquals(1, GameScore::count()); }
/** * Run the database seeds. * * @return void */ public function run() { GameScore::truncate(); $gameScores = [['username' => 'AAA', 'score' => 1000, 'game' => 1], ['username' => 'CDC', 'score' => 1500, 'game' => 1], ['username' => 'RFT', 'score' => 2000, 'game' => 1]]; foreach ($gameScores as $gameScore) { GameScore::create($gameScore); } }
public function delete(JsonResponse $res, $id) { $this->gameScore->destroy($id); return new JsonResponse(null, 204); }