user = factory(User::class)->create(); $this->rate = factory(Rate::class)->create(); $this->user->attachRole(Role::Where('name','admin')->first()); } public function testStore(){ $response = $this->actingAs($this->user) ->postJson('/api/update-rate/',[ 'x1_cash' => '1.2', 'x1_cheque' => '1.2', 'x1_ba' => '1.2', 'x2_cash' => '1.2', 'x2_cheque' => '1.2', 'x2_ba' => '1.2' ]) ->assertStatus(201); } public function testUpdate(){ $response = $this->actingAs($this->user) ->json('PUT','/api/update-rate/' . $this->rate->id,[ 'x1_cash' => '1.2', 'x1_cheque' => '1.2', 'x1_ba' => '1.2', 'x2_cash' => '1.2', 'x2_cheque' => '1.2', 'x2_ba' => '1.2' ]) ->assertStatus(200); } }