clarg18's avatar

Get more infomation on test failure

Hello,

I would like to know why this test failed:

/** @test */
public function purchaseOrderAddedViaStoreMethod()
{
    $this->withoutExceptionHandling();
    $this->actingAs(factory(User::class)->create());
    factory(Supplier::class)->create();
    factory(Staff::class)->create();

    $response = $this->post('/po', $this->data());
    $this->assertCount(1, PurchaseOrder::all());
}

But all I get is:

  1. Tests\Feature\PurchaseOrderTest::purchaseOrderAddedViaStoreMethod Failed asserting that actual size 0 matches expected size 1.

Is there a way to know more about why this failed?

0 likes
1 reply
mabdullahsari's avatar
Level 16

No in this case (well at least an answer that literally tells you what's wrong), because no exception is being thrown. The code in itself is working, but according to your test it is not. So, by checking your implementation you have to figure out why it is not carrying out the actions you were expecting.

Please or to participate in this conversation.