69 - Sketching Out Order Confirmations

This commit is contained in:
Adam Wathan
2017-02-10 12:48:19 -05:00
parent 825a3da157
commit b3ff9e8624
2 changed files with 36 additions and 0 deletions

View File

@@ -66,3 +66,10 @@ $factory->state(App\Ticket::class, 'reserved', function ($faker) {
'reserved_at' => Carbon::now(),
];
});
$factory->define(App\Order::class, function (Faker\Generator $faker) {
return [
'amount' => 5250,
'email' => 'somebody@example.com',
];
});

View File

@@ -0,0 +1,29 @@
<?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()
{
$concert = factory(Concert::class)->create();
$order = factory(Order::class)->create();
$ticket = factory(Ticket::class)->create([
'concert_id' => $concert->id,
'order_id' => $order->id,
]);
// Visit the order confirmation page
$this->get("/orders/{$order->id}");
// Assert we see the correct order details
}
}