You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

24 lines
608 B

<?php
namespace Tests\Unit\Integration;
use App\Unit;
use App\Product;
use Tests\TestCase;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Foundation\Testing\RefreshDatabase;
class UnitTest extends TestCase
{
use RefreshDatabase;
/** @test */
public function a_unit_has_many_products_relation()
{
$unit = factory(Unit::class)->create();
$product = factory(Product::class)->create(['unit_id' => $unit->id]);
$this->assertInstanceOf(Collection::class, $unit->products);
$this->assertInstanceOf(Product::class, $unit->products->first());
}
}