mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-01-26 03:04:05 +00:00
3.1 - Outlining the First Test Case
This commit is contained in:
@@ -79,6 +79,25 @@ class PurchaseTicketsTest extends TestCase
|
||||
$this->assertNull($order);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
function cannot_purchase_more_tickets_than_remain()
|
||||
{
|
||||
$concert = factory(Concert::class)->states('published')->create();
|
||||
$concert->addTickets(50);
|
||||
|
||||
$this->orderTickets($concert, [
|
||||
'email' => 'john@example.com',
|
||||
'ticket_quantity' => 51,
|
||||
'payment_token' => $this->paymentGateway->getValidTestToken(),
|
||||
]);
|
||||
|
||||
$this->assertResponseStatus(422);
|
||||
$order = $concert->orders()->where('email', 'john@example.com')->first();
|
||||
$this->assertNull($order);
|
||||
$this->assertEquals(0, $this->paymentGateway->totalCharges());
|
||||
$this->assertEquals(50, $concert->ticketsRemaining());
|
||||
}
|
||||
|
||||
/** @test */
|
||||
function email_is_required_to_purchase_tickets()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user