/** * testAddTranslations * * @return void * @access public * @see ____func_see____ * @since 1.0.0 */ public function testAddTranslations() { $entity = new \XLite\Model\Product(); $entity->addTranslations(new \XLite\Model\ProductTranslation(array('name' => 'test'))); $result = array_pop($entity->getTranslations()->toArray()); // Check keys $this->assertEquals('test', $result->getName(), 'Invalid product name'); }
/** * Create product * * @param array $cell Cell * * @return \XLite\Model\Product */ protected function createProduct(array $cell) { $product = new \XLite\Model\Product(); $product->setInventory($product->getInventory()); $product->getInventory()->setProduct($product); \XLite\Core\Database::getEM()->persist($product); return $product; }
protected function saleProduct(XLite\Model\Product $product, $sale, $discountType) { $product->setParticipateSale(true); $product->setSalePriceValue($sale); $product->setDiscountType($discountType); XLite\Core\Database::getEM()->persist($product); }
/** * @return XLite\Model\Product */ protected function getProductWithoutInventory() { $this->productWithoutInventory->getInventory()->setEnabled(false); $this->productWithoutInventory->getInventory()->setAmount(self::DEFAULT_INVENTORY_AMOUNT); return $this->productWithoutInventory; }