Files
ticketbeast/tests/features/ViewOrderTest.php
2017-02-10 17:58:33 -05:00

39 lines
1.1 KiB
PHP

<?php
use App\Order;
use App\Ticket;
use App\Concert;
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class ViewOrderTest extends TestCase
{
use DatabaseMigrations;
/** @test */
function user_can_view_their_order_confirmation()
{
$this->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;
});
}
}