mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-01-26 03:04:05 +00:00
70 - Driving out the Endpoint
This commit is contained in:
13
app/Http/Controllers/OrdersController.php
Normal file
13
app/Http/Controllers/OrdersController.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class OrdersController extends Controller
|
||||
{
|
||||
public function show()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ class CreateOrdersTable extends Migration
|
||||
{
|
||||
Schema::create('orders', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('confirmation_number');
|
||||
$table->integer('amount');
|
||||
$table->string('email');
|
||||
$table->timestamps();
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user