mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-02-01 19:47:29 +00:00
100 - Namespacing Our Test Suite
This commit is contained in:
71
tests/Feature/ViewOrderTest.php
Normal file
71
tests/Feature/ViewOrderTest.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Order;
|
||||
use App\Ticket;
|
||||
use App\Concert;
|
||||
use Carbon\Carbon;
|
||||
use Tests\TestCase;
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
|
||||
class ViewOrderTest extends TestCase
|
||||
{
|
||||
use DatabaseMigrations;
|
||||
|
||||
/** @test */
|
||||
function user_can_view_their_order_confirmation()
|
||||
{
|
||||
$this->disableExceptionHandling();
|
||||
|
||||
$concert = factory(Concert::class)->create([
|
||||
'title' => 'The Red Chord',
|
||||
'subtitle' => 'with Animosity and Lethargy',
|
||||
'date' => Carbon::parse('March 12, 2017 8:00pm'),
|
||||
'ticket_price' => 4250,
|
||||
'venue' => 'The Mosh Pit',
|
||||
'venue_address' => '123 Example Lane',
|
||||
'city' => 'Laraville',
|
||||
'state' => 'ON',
|
||||
'zip' => '17916',
|
||||
]);
|
||||
$order = factory(Order::class)->create([
|
||||
'confirmation_number' => 'ORDERCONFIRMATION1234',
|
||||
'card_last_four' => '1881',
|
||||
'amount' => 8500,
|
||||
'email' => 'john@example.com',
|
||||
]);
|
||||
$ticketA = factory(Ticket::class)->create([
|
||||
'concert_id' => $concert->id,
|
||||
'order_id' => $order->id,
|
||||
'code' => 'TICKETCODE123'
|
||||
]);
|
||||
$ticketB = factory(Ticket::class)->create([
|
||||
'concert_id' => $concert->id,
|
||||
'order_id' => $order->id,
|
||||
'code' => 'TICKETCODE456'
|
||||
]);
|
||||
|
||||
$response = $this->get("/orders/ORDERCONFIRMATION1234");
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
$response->assertViewHas('order', function ($viewOrder) use ($order) {
|
||||
return $order->id === $viewOrder->id;
|
||||
});
|
||||
|
||||
$response->assertSee('ORDERCONFIRMATION1234');
|
||||
$response->assertSee('$85.00');
|
||||
$response->assertSee('**** **** **** 1881');
|
||||
$response->assertSee('TICKETCODE123');
|
||||
$response->assertSee('TICKETCODE456');
|
||||
$response->assertSee('The Red Chord');
|
||||
$response->assertSee('with Animosity and Lethargy');
|
||||
$response->assertSee('The Mosh Pit');
|
||||
$response->assertSee('123 Example Lane');
|
||||
$response->assertSee('Laraville, ON');
|
||||
$response->assertSee('17916');
|
||||
$response->assertSee('john@example.com');
|
||||
$response->assertSee('2017-03-12 20:00');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user