create([ 'status' => ProductionOrderStatus::InTransit, 'execution_type' => ProductionOrderExecutionType::DeliveryAndInstallation, ]); ProductionOrderItem::factory()->count(2)->for($order)->create(); ProductionOrderDelivery::factory()->count(2)->for($order)->create(); ProductionOrderInstallation::factory()->count(2)->for($order)->create(); $order->load(['items', 'deliveries', 'installations']); $this->assertCount(2, $order->items); $this->assertCount(2, $order->deliveries); $this->assertCount(2, $order->installations); $this->assertSame(ProductionOrderStatus::InTransit, $order->status); $this->assertSame('В пути', $order->statusLabel()); $this->assertSame('Доставка + Монтаж', $order->executionTypeLabel()); } }