3.6 - Refactoring and Redundant Test Coverage

This commit is contained in:
Adam Wathan
2016-11-15 13:22:44 -05:00
parent 2e92881fb6
commit 9fe42a1aaa
3 changed files with 31 additions and 1 deletions

25
tests/unit/TicketTest.php Normal file
View File

@@ -0,0 +1,25 @@
<?php
use App\Concert;
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_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->release();
$this->assertNull($ticket->fresh()->order_id);
}
}