|
|
@ -2,11 +2,15 @@ |
|
|
|
|
|
|
|
|
namespace Tests\Unit\Integration; |
|
|
namespace Tests\Unit\Integration; |
|
|
|
|
|
|
|
|
|
|
|
use App\Unit; |
|
|
use App\Product; |
|
|
use App\Product; |
|
|
use Tests\TestCase; |
|
|
use Tests\TestCase; |
|
|
|
|
|
use Illuminate\Foundation\Testing\RefreshDatabase; |
|
|
|
|
|
|
|
|
class ProductTest extends TestCase |
|
|
class ProductTest extends TestCase |
|
|
{ |
|
|
{ |
|
|
|
|
|
use RefreshDatabase; |
|
|
|
|
|
|
|
|
/** @test */ |
|
|
/** @test */ |
|
|
public function it_has_get_price_method() |
|
|
public function it_has_get_price_method() |
|
|
{ |
|
|
{ |
|
|
@ -41,4 +45,13 @@ class ProductTest extends TestCase |
|
|
$product = new Product(['cash_price' => 2000, 'credit_price' => null]); |
|
|
$product = new Product(['cash_price' => 2000, 'credit_price' => null]); |
|
|
$this->assertEquals(2000, $product->getPrice('credit')); |
|
|
$this->assertEquals(2000, $product->getPrice('credit')); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** @test */ |
|
|
|
|
|
public function a_product_has_belongs_to_unit_relation() |
|
|
|
|
|
{ |
|
|
|
|
|
$product = factory(Product::class)->make(); |
|
|
|
|
|
|
|
|
|
|
|
$this->assertInstanceOf(Unit::class, $product->unit); |
|
|
|
|
|
$this->assertEquals($product->unit_id, $product->unit->id); |
|
|
|
|
|
} |
|
|
} |
|
|
} |