/** @test */ public function update_property_2() { $property = Property::find($this->getTestPropertyId(true)); $this->call('PUT', '/update/' . $property->getAttribute('id'), ['describe' => str_random()]); $this->assertResponseOk(); $this->seeJson(); $this->assertNotEquals($property, Property::find($property->getAttribute('id'))); }
/** @test */ public function update_repair() { $property = Property::find($this->getTestPropertyId(true)); factory(Repair::class, 5)->make(['status' => Category::getCategories('repair.status', 'processing', true)])->each(function (Repair $repair) use($property) { $property->repairs()->save($repair); }); $property->load(['repairs']); $this->call('PUT', '/', ['repair_list' => $property->getRelation('repairs')->pluck('id')]); $this->assertResponseOk(); $this->seeJson(); $this->assertSame(Category::getCategories('property.status', 'normal', true), Property::find($this->getTestPropertyId(true))->getAttribute('status')); foreach (Property::with(['repairs'])->find($this->getTestPropertyId(true))->getRelation('repairs') as $repair) { $this->assertSame(Category::getCategories('repair.status', 'finished', true), $repair->getAttribute('status')); } }