46 - A Change in Behavior

This commit is contained in:
Adam Wathan
2016-12-09 16:29:27 -05:00
parent de24da27ea
commit 7069917a18
4 changed files with 12 additions and 7 deletions

View File

@@ -2,6 +2,7 @@
use App\Ticket;
use App\Concert;
use Carbon\Carbon;
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
@@ -24,14 +25,11 @@ class TicketTest extends TestCase
/** @test */
function a_ticket_can_be_released()
{
$concert = factory(Concert::class)->create();
$concert->addTickets(1);
$order = $concert->orderTickets('jane@example.com', 1);
$ticket = $order->tickets()->first();
$this->assertEquals($order->id, $ticket->order_id);
$ticket = factory(Ticket::class)->states('reserved')->create();
$this->assertNotNull($ticket->reserved_at);
$ticket->release();
$this->assertNull($ticket->fresh()->order_id);
$this->assertNull($ticket->fresh()->reserved_at);
}
}