From 148ccb26f6733c76713ff8b53a21c144c71b5f7d Mon Sep 17 00:00:00 2001 From: Adam Wathan Date: Sat, 11 Feb 2017 11:22:50 -0500 Subject: [PATCH] 74 - Deciding What to Test in a View --- resources/views/orders/show.blade.php | 24 +++++++++++++++--------- tests/features/ViewOrderTest.php | 24 +++++++++++++++++++++++- 2 files changed, 38 insertions(+), 10 deletions(-) diff --git a/resources/views/orders/show.blade.php b/resources/views/orders/show.blade.php index 0636508..ad74432 100644 --- a/resources/views/orders/show.blade.php +++ b/resources/views/orders/show.blade.php @@ -7,7 +7,7 @@

@@ -23,8 +23,8 @@

-

No Warning

-

with Cruel Hand and Backtrack

+

{{ $ticket->concert->title }}

+

{{ $ticket->concert->subtitle }}

General Admission @@ -39,8 +39,12 @@ @icon('calendar', 'text-brand-muted')
-

Sunday, October 16, 2011

-

Doors at 8:00PM

+

+ {{ $ticket->concert->date->format('l, F j, Y') }} +

+

+ Doors at {{ $ticket->concert->date->format('g:ia') }} +

@@ -50,10 +54,12 @@ @icon('location', 'text-brand-muted')
-

Music Hall of Williamsburg

+

{{ $ticket->concert->venue }}

-

123 Main St. W

-

Brooklyn, New York 14259

+

{{ $ticket->concert->venue_address }}

+

+ {{ $ticket->concert->city }}, {{ $ticket->concert->state }} {{ $ticket->concert->zip }} +

@@ -62,7 +68,7 @@

{{ $ticket->code }}

-

adam.wathan@example.com

+

{{ $order->email }}

@endforeach diff --git a/tests/features/ViewOrderTest.php b/tests/features/ViewOrderTest.php index 7476043..b31cf69 100644 --- a/tests/features/ViewOrderTest.php +++ b/tests/features/ViewOrderTest.php @@ -3,6 +3,7 @@ use App\Order; use App\Ticket; use App\Concert; +use Carbon\Carbon; use Illuminate\Foundation\Testing\WithoutMiddleware; use Illuminate\Foundation\Testing\DatabaseMigrations; use Illuminate\Foundation\Testing\DatabaseTransactions; @@ -16,11 +17,22 @@ class ViewOrderTest extends TestCase { $this->disableExceptionHandling(); - $concert = factory(Concert::class)->create(); + $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, @@ -48,5 +60,15 @@ class ViewOrderTest extends TestCase $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('Sunday, March 12, 2017'); + $response->assertSee('Doors at 8:00pm'); } }