mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-02-25 16:57:12 +00:00
78 - Updating Our Unit Tests
This commit is contained in:
@@ -46,6 +46,7 @@ class Order extends Model
|
|||||||
public function toArray()
|
public function toArray()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
'confirmation_number' => $this->confirmation_number,
|
||||||
'email' => $this->email,
|
'email' => $this->email,
|
||||||
'ticket_quantity' => $this->ticketQuantity(),
|
'ticket_quantity' => $this->ticketQuantity(),
|
||||||
'amount' => $this->amount,
|
'amount' => $this->amount,
|
||||||
|
|||||||
@@ -54,12 +54,17 @@ class OrderTest extends TestCase
|
|||||||
/** @test */
|
/** @test */
|
||||||
function converting_to_an_array()
|
function converting_to_an_array()
|
||||||
{
|
{
|
||||||
$concert = factory(Concert::class)->create(['ticket_price' => 1200])->addTickets(5);
|
$order = factory(Order::class)->create([
|
||||||
$order = $concert->orderTickets('jane@example.com', 5);
|
'confirmation_number' => 'ORDERCONFIRMATION1234',
|
||||||
|
'email' => 'jane@example.com',
|
||||||
|
'amount' => 6000,
|
||||||
|
]);
|
||||||
|
$order->tickets()->saveMany(factory(Ticket::class)->times(5)->create());
|
||||||
|
|
||||||
$result = $order->toArray();
|
$result = $order->toArray();
|
||||||
|
|
||||||
$this->assertEquals([
|
$this->assertEquals([
|
||||||
|
'confirmation_number' => 'ORDERCONFIRMATION1234',
|
||||||
'email' => 'jane@example.com',
|
'email' => 'jane@example.com',
|
||||||
'ticket_quantity' => 5,
|
'ticket_quantity' => 5,
|
||||||
'amount' => 6000,
|
'amount' => 6000,
|
||||||
|
|||||||
Reference in New Issue
Block a user