create([ 'product_price' => 150.50, ]); $product->refresh(); $this->assertEquals(150.50, $product->product_price); } public function test_installation_price_accessor(): void { $product = Product::factory()->create([ 'installation_price' => 200.00, ]); $product->refresh(); $this->assertEquals(200.00, $product->installation_price); } public function test_total_price_accessor(): void { $product = Product::factory()->create([ 'total_price' => 300.00, ]); $product->refresh(); $this->assertEquals(300.00, $product->total_price); } public function test_price_txt_contains_ruble_sign(): void { $product = Product::factory()->create([ 'product_price' => 500.00, ]); $product->refresh(); $this->assertStringContainsString('₽', $product->product_price_txt); } public function test_soft_deletes(): void { $product = Product::factory()->create(); $product->delete(); $this->assertTrue($product->trashed()); } public function test_has_relations_false_when_no_relations(): void { $product = Product::factory()->create(); $this->assertFalse($product->hasRelations()); } public function test_has_many_maf_orders(): void { $product = Product::factory()->create(); MafOrder::factory()->forProduct($product)->create(); $this->assertGreaterThan(0, $product->maf_orders()->withoutGlobalScopes()->count()); } public function test_relations_exist(): void { $product = Product::factory()->create(); $this->assertInstanceOf(BelongsToMany::class, $product->orders()); $this->assertInstanceOf(BelongsTo::class, $product->certificate()); $this->assertInstanceOf(HasMany::class, $product->maf_orders()); } }