public function test_join_inventory_scope() { $foo = Factory::create(new Product()); $bar = Factory::create(new Product()); Factory::create(new Inventory(), ['product_id' => $bar->id, 'quantity' => 5]); $this->assertEquals(0, Product::joinInventory()->find($foo->id)->inventory); $this->assertEquals(5, Product::joinInventory()->find($bar->id)->inventory); }