mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-02-02 10:47:54 +00:00
5.4 - Extracting a Named Constructor
This commit is contained in:
@@ -10,6 +10,20 @@ class OrderTest extends TestCase
|
||||
{
|
||||
use DatabaseMigrations;
|
||||
|
||||
/** @test */
|
||||
function creating_an_order_from_tickets_and_email()
|
||||
{
|
||||
$concert = factory(Concert::class)->create(['ticket_price' => 1200])->addTickets(5);
|
||||
$this->assertEquals(5, $concert->ticketsRemaining());
|
||||
|
||||
$order = Order::forTickets($concert->findTickets(3), 'john@example.com');
|
||||
|
||||
$this->assertEquals('john@example.com', $order->email);
|
||||
$this->assertEquals(3, $order->ticketQuantity());
|
||||
$this->assertEquals(3600, $order->amount);
|
||||
$this->assertEquals(2, $concert->ticketsRemaining());
|
||||
}
|
||||
|
||||
/** @test */
|
||||
function converting_to_an_array()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user