(add disableExceptionHandling helper, clean up comments)

This commit is contained in:
Adam Wathan
2016-11-09 13:33:02 -05:00
parent 7fee2b89ee
commit c7837af96a
2 changed files with 15 additions and 5 deletions

View File

@@ -14,15 +14,13 @@ class PurchaseTicketsTest extends TestCase
/** @test */
function customer_can_purchase_concert_tickets()
{
// Arrange
$paymentGateway = new FakePaymentGateway;
$this->app->instance(PaymentGateway::class, $paymentGateway);
// Arrange
// Create a concert
$concert = factory(Concert::class)->create(['ticket_price' => 3250]);
// Act
// Purchase concert tickets
$this->json('POST', "/concerts/{$concert->id}/orders", [
'email' => 'john@example.com',
'ticket_quantity' => 3,
@@ -32,10 +30,8 @@ class PurchaseTicketsTest extends TestCase
// Assert
$this->assertResponseStatus(201);
// Make sure the customer was charged the correct amount
$this->assertEquals(9750, $paymentGateway->totalCharges());
// Make sure that an order exists for this customer
$order = $concert->orders()->where('email', 'john@example.com')->first();
$this->assertNotNull($order);
$this->assertEquals(3, $order->tickets()->count());