create(); $this->assertInstanceOf(Product::class, $sku->product); } public function test_belongs_to_order(): void { $order = Order::factory()->create(); $sku = ProductSKU::factory()->forOrder($order)->create(); $this->assertNotNull($sku->order_id); $this->assertInstanceOf(Order::class, $sku->order); } public function test_belongs_to_maf_order(): void { $mafOrder = MafOrder::factory()->create(); $sku = ProductSKU::factory()->withMafOrder($mafOrder)->create(); $this->assertNotNull($sku->maf_order_id); $this->assertInstanceOf(MafOrder::class, $sku->maf_order); } public function test_soft_deletes(): void { $sku = ProductSKU::factory()->create(); $sku->delete(); $this->assertTrue($sku->trashed()); } public function test_year_set_on_create(): void { $sku = ProductSKU::factory()->create(); $this->assertEquals((int) date('Y'), $sku->year); } public function test_relations_exist(): void { $sku = ProductSKU::factory()->create(); $this->assertInstanceOf(BelongsTo::class, $sku->product()); $this->assertInstanceOf(BelongsTo::class, $sku->order()); $this->assertInstanceOf(BelongsTo::class, $sku->passport()); $this->assertInstanceOf(BelongsTo::class, $sku->maf_order()); } }