public function testPatchClinics() { $clinicObject = factory(Clinic::class)->create(); $clinicData = ['data' => ['type' => 'clinics', 'attributes' => $clinicObject->toArray()]]; $clinicData['data']['attributes']['display'] = 'This is the new title'; $clinicData = json_encode($clinicData); $response = $this->callPatch(self::API_URL . $clinicObject->id, $clinicData); $this->assertEquals(Response::HTTP_OK, $response->getStatusCode()); $this->assertNotNull($clinic = json_decode($response->getContent())->data); $this->assertNotEmpty($clinic->id); // test to make sure the user was created $updatedClinic = Clinic::findOrFail($clinic->id); $this->assertEquals('This is the new title', $updatedClinic->display); }
public function destroy(Clinic $clinics) { $clinics->delete(); return response()->json('', Response::HTTP_NO_CONTENT); }