on-internet
← Community

Laravel assertDatabaseHas in phpunit test is not working

Stack Overflow ·

I have the following code: /** @test */ public function it_updates_customer_status_to_deactivated_for_admin_users() { $this->hubAdminUser = factory(User::class)->state('admin')->create(); $this->customer = Customer::first(); $this->customer->status_id = 2; //active $this->customer->save(); // this will update status_id to 3 $this->actingAs($this->hubAdminUser) ->patch(route('hub.customer.updateStatus', $this->customer)) ->assertRedirect(); $this->assertDatabaseHas('tenants', [ 'id' => $this->customer->id, 'status_id' => 3, //deactivated ]); } The ->patch(route('hub.customer.updateStatus', $thi

Comments

Sign in or sign up to comment and upvote.

No comments yet.