mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-01-26 11:14:06 +00:00
2.4 - Faking the Payment Gateway
This commit is contained in:
@@ -1,14 +1,22 @@
|
||||
<?php
|
||||
|
||||
use App\Concert;
|
||||
use App\Billing\PaymentGateway;
|
||||
use App\Billing\FakePaymentGateway;
|
||||
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
|
||||
class PurchaseTicketsTest extends TestCase
|
||||
{
|
||||
use DatabaseMigrations;
|
||||
|
||||
/** @test */
|
||||
function customer_can_purchase_concert_tickets()
|
||||
{
|
||||
$paymentGateway = new FakePaymentGateway;
|
||||
$this->app->instance(PaymentGateway::class, $paymentGateway);
|
||||
|
||||
// Arrange
|
||||
// Create a concert
|
||||
$concert = factory(Concert::class)->create(['ticket_price' => 3250]);
|
||||
@@ -22,6 +30,8 @@ class PurchaseTicketsTest extends TestCase
|
||||
]);
|
||||
|
||||
// Assert
|
||||
$this->assertResponseStatus(201);
|
||||
|
||||
// Make sure the customer was charged the correct amount
|
||||
$this->assertEquals(9750, $paymentGateway->totalCharges());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user