function testEditProperty() { // Given $this->startSession(); $userData = ['name' => 'Captain Kirk', 'email' => '*****@*****.**', 'password' => 'strongpassword', 'country_code' => '1', 'phone_number' => '5558180101']; $newUser = new User($userData); $newUser->save(); $this->be($newUser); $propertyData = ['description' => 'Some description', 'image_url' => 'http://www.someimage.com']; $newProperty = new VacationProperty($propertyData); $newUser->properties()->save($newProperty); $this->assertCount(1, VacationProperty::all()); // When $response = $this->call('POST', route('property-edit-action', ['id' => $newProperty->id]), ['description' => 'edited description', 'image_url' => 'http://www.modified.net', '_token' => csrf_token()]); // Then $this->assertCount(1, VacationProperty::all()); $property = VacationProperty::first(); $this->assertEquals($property->description, 'edited description'); $this->assertEquals($property->image_url, 'http://www.modified.net'); $this->assertRedirectedToRoute('property-show', ['id' => $property->id]); }