public function testPatchScholarships() { $user = factory(User::class)->create(); $scholarshipObject = factory(Scholarship::class)->create(['updated_by' => $user->id]); $scholarshipData = ['data' => ['type' => 'scholarships', 'attributes' => $scholarshipObject->toArray(), 'relationships' => ['updated_by' => ['data' => ['type' => 'users', 'id' => $user->id]]]]]; $scholarshipData['data']['attributes']['name'] = 'John Doe Dude'; $scholarshipData = json_encode($scholarshipData); $response = $this->callPatch(self::API_URL . $scholarshipObject->id, $scholarshipData); $this->assertEquals(Response::HTTP_OK, $response->getStatusCode()); $this->assertNotNull($scholarship = json_decode($response->getContent())->data); $this->assertNotEmpty($scholarship->id); // test to make sure the user was created $updatedScholarship = Scholarship::findOrFail($scholarship->id); $this->assertEquals('John Doe Dude', $updatedScholarship->name); }
public function destroy(Scholarship $scholarships) { $scholarships->delete(); return response()->json('', Response::HTTP_NO_CONTENT); }