mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-01-26 11:14:06 +00:00
6.6 - Uh Oh, a Segault
This commit is contained in:
@@ -105,13 +105,31 @@ class PurchaseTicketsTest extends TestCase
|
||||
/** @test */
|
||||
function cannot_purchase_tickets_another_customer_is_already_trying_to_purchase()
|
||||
{
|
||||
$concert = factory(Concert::class)->states('published')->create()->addTickets(3);
|
||||
$concert = factory(Concert::class)->states('published')->create([
|
||||
'ticket_price' => 1200
|
||||
])->addTickets(3);
|
||||
|
||||
$this->paymentGateway->beforeFirstCharge(function ($paymentGateway) use ($concert) {
|
||||
$this->orderTickets($concert, [
|
||||
'email' => 'personB@example.com',
|
||||
'ticket_quantity' => 1,
|
||||
'payment_token' => $this->paymentGateway->getValidTestToken(),
|
||||
]);
|
||||
|
||||
$this->assertResponseStatus(422);
|
||||
$this->assertFalse($concert->hasOrderFor('personB@example.com'));
|
||||
$this->assertEquals(0, $this->paymentGateway->totalCharges());
|
||||
});
|
||||
|
||||
$this->orderTickets($concert, [
|
||||
'email' => 'personA@example.com',
|
||||
'ticket_quantity' => 51,
|
||||
'ticket_quantity' => 3,
|
||||
'payment_token' => $this->paymentGateway->getValidTestToken(),
|
||||
]);
|
||||
|
||||
$this->assertEquals(3600, $this->paymentGateway->totalCharges());
|
||||
$this->assertTrue($concert->hasOrderFor('personA@example.com'));
|
||||
$this->assertEquals(3, $concert->ordersFor('personA@example.com')->first()->ticketQuantity());
|
||||
}
|
||||
|
||||
/** @test */
|
||||
|
||||
Reference in New Issue
Block a user