74 - Deciding What to Test in a View

This commit is contained in:
Adam Wathan
2017-02-11 11:22:50 -05:00
parent 7ce74a6a03
commit 148ccb26f6
2 changed files with 38 additions and 10 deletions

View File

@@ -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');
}
}