public function testPatchPickups() { $location = factory(Location::class)->create(); $pickupObject = factory(Pickup::class)->create(['location_id' => $location->id]); $pickupObject->time = '5-10pm'; $pickupData = json_encode(['data' => ['type' => 'pickups', 'attributes' => $pickupObject->toArray(), 'relationships' => ['location' => ['data' => ['type' => 'locations', 'id' => $location->id]]]]]); $response = $this->callPatch(self::API_URL . $pickupObject->id, $pickupData); $this->assertEquals(Response::HTTP_OK, $response->getStatusCode()); $this->assertNotNull($pickup = json_decode($response->getContent())->data); $this->assertNotEmpty($pickup->id); // test to make sure the user was created $updatedPickup = Pickup::findOrFail($pickup->id); $this->assertEquals('5-10pm', $updatedPickup->time); }
public function destroy(Pickup $pickups) { $pickups->delete(); return response()->json('', Response::HTTP_NO_CONTENT); }