From c7837af96a4296ed160cae73c5e61526839116e1 Mon Sep 17 00:00:00 2001 From: Adam Wathan Date: Wed, 9 Nov 2016 13:33:02 -0500 Subject: [PATCH] (add disableExceptionHandling helper, clean up comments) --- tests/TestCase.php | 14 ++++++++++++++ tests/features/PurchaseTicketsTest.php | 6 +----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/tests/TestCase.php b/tests/TestCase.php index 8208edc..7ca3900 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -1,5 +1,8 @@ app->instance(ExceptionHandler::class, new class extends Handler { + public function __construct() {} + public function report(Exception $e) {} + public function render($request, Exception $e) { + throw $e; + } + }); + } } diff --git a/tests/features/PurchaseTicketsTest.php b/tests/features/PurchaseTicketsTest.php index ef564a6..9390670 100644 --- a/tests/features/PurchaseTicketsTest.php +++ b/tests/features/PurchaseTicketsTest.php @@ -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());