49 - Moving the Email to the Reservation

This commit is contained in:
Adam Wathan
2016-12-15 11:51:22 -05:00
parent 2ab35a2f14
commit 11c3bfaae7
5 changed files with 28 additions and 12 deletions

View File

@@ -124,9 +124,10 @@ class ConcertTest extends TestCase
$concert = factory(Concert::class)->create()->addTickets(3);
$this->assertEquals(3, $concert->ticketsRemaining());
$reservation = $concert->reserveTickets(2);
$reservation = $concert->reserveTickets(2, 'john@example.com');
$this->assertCount(2, $reservation->tickets());
$this->assertEquals('john@example.com', $reservation->email());
$this->assertEquals(1, $concert->ticketsRemaining());
}
@@ -137,7 +138,7 @@ class ConcertTest extends TestCase
$concert->orderTickets('jane@example.com', 2);
try {
$concert->reserveTickets(2);
$concert->reserveTickets(2, 'john@example.com');
} catch (NotEnoughTicketsException $e) {
$this->assertEquals(1, $concert->ticketsRemaining());
return;
@@ -150,10 +151,10 @@ class ConcertTest extends TestCase
function cannot_reserve_tickets_that_have_already_been_reserved()
{
$concert = factory(Concert::class)->create()->addTickets(3);
$concert->reserveTickets(2);
$concert->reserveTickets(2, 'jane@example.com');
try {
$concert->reserveTickets(2);
$concert->reserveTickets(2, 'john@example.com');
} catch (NotEnoughTicketsException $e) {
$this->assertEquals(1, $concert->ticketsRemaining());
return;