mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-01-31 03:46:38 +00:00
51 - Green with Feature Envy
This commit is contained in:
@@ -9,6 +9,8 @@ use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
|
||||
class ReservationTest extends TestCase
|
||||
{
|
||||
use DatabaseMigrations;
|
||||
|
||||
/** @test */
|
||||
function calculating_the_total_cost()
|
||||
{
|
||||
@@ -62,4 +64,18 @@ class ReservationTest extends TestCase
|
||||
$ticket->shouldHaveReceived('release');
|
||||
}
|
||||
}
|
||||
|
||||
/** @test */
|
||||
function completing_a_reservation()
|
||||
{
|
||||
$concert = factory(Concert::class)->create(['ticket_price' => 1200]);
|
||||
$tickets = factory(Ticket::class, 3)->create(['concert_id' => $concert->id]);
|
||||
$reservation = new Reservation($tickets, 'john@example.com');
|
||||
|
||||
$order = $reservation->complete();
|
||||
|
||||
$this->assertEquals('john@example.com', $order->email);
|
||||
$this->assertEquals(3, $order->ticketQuantity());
|
||||
$this->assertEquals(3600, $order->amount);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user