/** * @covers Catalog\Entity\CategoryEntity::removeProduct */ public function testRemoveProducts() { $product = new ProductEntity(); $product->setName('Test Product'); $product->setSku('TST456'); $product->setPrice(20.0); $product->setQty(10); $product->setDescription('Test Product Description'); $this->category->addProduct($product); $this->category->removeProduct($product); $this->assertEquals(array(), $this->category->getProducts()); }
public function testEntryActionRedirectsAfterValidPost() { $controller = $this->controller; $productService = $this->getMock('\\Catalog\\Service\\ProductService'); $controller->setService($productService); $productEntity = new ProductEntity(); $productEntity->setName('UnitTest Product'); $productEntity->setPrice(100.0); $productEntity->setSku('UTST001'); $productEntity->setQty(5); $productEntity->setDescription('UnitTest Random description'); $productService->expects($this->once())->method('save')->will($this->returnValue($productEntity)); $postData = array('id' => '', 'name' => 'Test Product', 'price' => '100.00', 'sku' => 'UTST001', 'qty' => 5, 'description' => 'Random description'); $this->dispatch('/catalog/product/add', 'POST', $postData); $this->assertResponseStatusCode(302); $this->assertRedirectTo('/catalog/product'); }
/** * {@inheritDoc} */ public function setDescription($description) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'setDescription', array($description)); return parent::setDescription($description); }