/** @test */ public function it_updates_a_contact() { $data = ['email' => '*****@*****.**', 'relations' => ['sync' => ['tags' => [4, 5, 6]], 'attach' => ['forms' => [2]]]]; $contactToUpdate = \SevenShores\Kraken\Contact::find(1); $contactToUpdate->detach('forms', [2]); $response = $this->call('PUT', 'api/contacts/1', [], [], [], $this->headers, json_encode($data)); $content = json_decode($response->getContent()); $updatedContact = \SevenShores\Kraken\Contact::find(1); $this->assertEquals(200, $response->getStatusCode()); $this->assertEquals($data['email'], $content->email); $this->assertEquals($data['email'], $updatedContact->email); $this->assertEquals(3, $updatedContact->tags->count()); $this->assertEquals(2, $updatedContact->forms->where('id', 2)->first()->id); }