diff --git a/app/Http/Controllers/OrdersController.php b/app/Http/Controllers/OrdersController.php new file mode 100644 index 0000000..99544a7 --- /dev/null +++ b/app/Http/Controllers/OrdersController.php @@ -0,0 +1,13 @@ +increments('id'); + $table->string('confirmation_number'); $table->integer('amount'); $table->string('email'); $table->timestamps(); diff --git a/routes/web.php b/routes/web.php index a1159b0..6c261db 100644 --- a/routes/web.php +++ b/routes/web.php @@ -18,3 +18,5 @@ Route::get('/mockups/order', function () { Route::get('/concerts/{id}', 'ConcertsController@show'); Route::post('/concerts/{id}/orders', 'ConcertOrdersController@store'); + +Route::get('/orders/{confirmationNumber}', 'OrdersController@show'); diff --git a/tests/features/ViewOrderTest.php b/tests/features/ViewOrderTest.php index 96f5492..cd2f4c4 100644 --- a/tests/features/ViewOrderTest.php +++ b/tests/features/ViewOrderTest.php @@ -14,16 +14,21 @@ class ViewOrderTest extends TestCase /** @test */ function user_can_view_their_order_confirmation() { + $this->disableExceptionHandling(); + $concert = factory(Concert::class)->create(); - $order = factory(Order::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 - $this->get("/orders/{$order->id}"); + $response = $this->get("/orders/ORDERCONFIRMATION1234"); + $response->assertStatus(200); // Assert we see the correct order details } }