/** * Should load the product for the given ID. */ public function testLoadById() { $id = $this->generator()->anyInteger(); $product = $this->makeMock(Product::class); $this->productResource->shouldReceive('where->with->first')->atLeast()->once()->andReturn($product); $loaded = $this->productRepository->loadById($id); $this->assertSame($product, $loaded); }
/** * @param int $productId * * @return Product */ public function loadProductById(int $productId) : Product { return $this->productRepository->loadById($productId); }