disableExceptionHandling(); $concert = factory(Concert::class)->create(); $order = factory(Order::class)->create([ 'confirmation_number' => 'ORDERCONFIRMATION1234' ]); $ticket = factory(Ticket::class)->create([ 'concert_id' => $concert->id, 'order_id' => $order->id, ]); // Visit the order confirmation page $response = $this->get("/orders/ORDERCONFIRMATION1234"); $response->assertStatus(200); // Assert we see the correct order details $response->assertViewHas('order', function ($viewOrder) use ($order) { return $order->id === $viewOrder->id; }); } }