user = factory(User::class)->create(); $this->company = $this->user->each(function ($u) { factory(Company::class)->create([ 'user_id' => $u->id, ]); }); } // TODO : those test is wrong, please redo later. // public function testCreate() // { // $response = $this->actingAs($this->company) // ->patchJson('/api/deliveryinfo', [ // 'branch' => 'Test', // 'deli_info' => 'Testing', // 'address' => 'Testing', // 'city' => 'Test', // 'postcode' => '12345', // 'state' => 'Testing', // 'country' => 'Testing', // 'contact_person' => 'Testing', // 'contact_person_no' => '12345' // ]); // $response->assertStatus(201); // } // public function testPUT() // { // $response = $this->actingAs($this->company) // ->patchJson('/api/deliveryinfo', [ // 'branch' => 'Test', // 'deli_info' => 'Testing', // 'address' => 'Testing', // 'city' => 'Test', // 'postcode' => '12345', // 'state' => 'Testing', // 'country' => 'Testing', // 'contact_person' => 'Testing', // 'contact_person_no' => '12345' // ]); // $response->assertStatus(200); // } // public function testDELETE() // { // $response = $this->json('DELETE', '/api/deliveryinfo'); // $response->assertStatus(204); // } }