Exemplo n.º 1
0
 /**
  * @group Product
  *
  * @return void
  */
 public function testGetProductConcrete()
 {
     $localeName = Store::getInstance()->getCurrentLocale();
     $localeTransfer = $this->localeFacade->getLocale($localeName);
     $taxRateEntity = new SpyTaxRate();
     $taxRateEntity->setRate(self::TAX_RATE_PERCENTAGE)->setName(self::TAX_RATE_NAME);
     $taxSetEntity = new SpyTaxSet();
     $taxSetEntity->addSpyTaxRate($taxRateEntity)->setName(self::TAX_SET_NAME);
     $productAbstractEntity = new SpyProductAbstract();
     $productAbstractEntity->setSpyTaxSet($taxSetEntity)->setAttributes('')->setSku(self::SKU_PRODUCT_ABSTRACT);
     $localizedAttributesEntity = new SpyProductLocalizedAttributes();
     $localizedAttributesEntity->setName(self::PRODUCT_CONCRETE_NAME)->setAttributes('')->setFkLocale($localeTransfer->getIdLocale());
     $productConcreteEntity = new SpyProduct();
     $productConcreteEntity->setSpyProductAbstract($productAbstractEntity)->setAttributes('')->addSpyProductLocalizedAttributes($localizedAttributesEntity)->setSku(self::SKU_PRODUCT_CONCRETE)->save();
     $productConcreteTransfer = $this->productFacade->getProductConcrete($productConcreteEntity->getSku());
     $this->assertEquals(self::PRODUCT_CONCRETE_NAME, $productConcreteTransfer->getName());
     $this->assertEquals(self::SKU_PRODUCT_CONCRETE, $productConcreteTransfer->getSku());
     $this->assertEquals(self::SKU_PRODUCT_ABSTRACT, $productConcreteTransfer->getProductAbstractSku());
     $this->assertEquals($productConcreteEntity->getIdProduct(), $productConcreteTransfer->getIdProductConcrete());
     $this->assertEquals($productAbstractEntity->getIdProductAbstract(), $productConcreteTransfer->getIdProductAbstract());
 }
Exemplo n.º 2
0
 /**
  * @return void
  */
 public function testCalculateStock()
 {
     $this->setTestData();
     $stock = $this->stockFacade->calculateStockForProduct($this->productEntity->getSku());
     $this->assertEquals(30, $stock);
 }