87 - Feature Test and JSON Updates

This commit is contained in:
Adam Wathan
2017-03-31 16:20:22 -04:00
parent e0bfaceb20
commit e1867deb43
3 changed files with 20 additions and 8 deletions

View File

@@ -3,6 +3,7 @@
use App\Concert;
use App\Billing\PaymentGateway;
use App\Billing\FakePaymentGateway;
use App\Facades\OrderConfirmationNumber;
use App\OrderConfirmationNumberGenerator;
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
@@ -52,10 +53,7 @@ class PurchaseTicketsTest extends TestCase
{
$this->disableExceptionHandling();
$orderConfirmationNumberGenerator = Mockery::mock(OrderConfirmationNumberGenerator::class, [
'generate' => 'ORDERCONFIRMATION1234',
]);
$this->app->instance(OrderConfirmationNumberGenerator::class, $orderConfirmationNumberGenerator);
OrderConfirmationNumber::shouldReceive('generate')->andReturn('ORDERCONFIRMATION1234');
$concert = factory(Concert::class)->states('published')->create(['ticket_price' => 3250])->addTickets(3);
@@ -70,8 +68,12 @@ class PurchaseTicketsTest extends TestCase
$this->seeJsonSubset([
'confirmation_number' => 'ORDERCONFIRMATION1234',
'email' => 'john@example.com',
'ticket_quantity' => 3,
'amount' => 9750,
'tickets' => [
['code' => 'TICKETCODE1'],
['code' => 'TICKETCODE2'],
['code' => 'TICKETCODE3'],
]
]);
$this->assertEquals(9750, $this->paymentGateway->totalCharges());