mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-01-26 11:14:06 +00:00
36 lines
833 B
PHP
36 lines
833 B
PHP
<?php
|
|
|
|
use App\Ticket;
|
|
use App\Concert;
|
|
use Carbon\Carbon;
|
|
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
|
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
|
|
|
class TicketTest extends TestCase
|
|
{
|
|
use DatabaseMigrations;
|
|
|
|
/** @test */
|
|
function a_ticket_can_be_reserved()
|
|
{
|
|
$ticket = factory(Ticket::class)->create();
|
|
$this->assertNull($ticket->reserved_at);
|
|
|
|
$ticket->reserve();
|
|
|
|
$this->assertNotNull($ticket->fresh()->reserved_at);
|
|
}
|
|
|
|
/** @test */
|
|
function a_ticket_can_be_released()
|
|
{
|
|
$ticket = factory(Ticket::class)->states('reserved')->create();
|
|
$this->assertNotNull($ticket->reserved_at);
|
|
|
|
$ticket->release();
|
|
|
|
$this->assertNull($ticket->fresh()->reserved_at);
|
|
}
|
|
}
|