public function convertToProducer() { $producer = new Producer(); $producer->setProducername($this->producerName); $producer->setAdress($this->adress); $producer->setEmail($this->email); $producer->setUrl($this->url); $producer->setPhone($this->phone); $producer->setId($this->id); return $producer; }
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); }