コード例 #1
0
 public function testRemoveIngredient()
 {
     $productService = new ProductService($this->entityManager);
     $product = new Product();
     $product->setProductname("Paine");
     $product->setPrice(4.3);
     $product->setAdition(10);
     $product->setPieces(100);
     $ingredient = new Ingredient();
     $ingredient->setIngredientname("Faina");
     $producer = new Producer();
     $producer->setProducername("Velpitar");
     $productService->insertProduct($product);
     $productService->addIngredient($product->getId(), $ingredient);
     $aux = $productService->getProductById(1);
     $ingredients = $aux->getIdingredient();
     $this->assertCount(1, $ingredients);
     $productService->removeIngredient($product, $ingredient);
     $aux = $productService->getProductById(1);
     $ingredients = $aux->getIdingredient();
     $this->assertCount(0, $ingredients);
 }
コード例 #2
0
 public function convertToIngredient()
 {
     $ingredient = new Ingredient();
     $ingredient->setIngredientname($this->ingredientName);
     return $ingredient;
 }