/**
  * @return void
  */
 public function testPluginExpandsCartItemWithExpectedProductData()
 {
     $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();
     $changeTransfer = new CartChangeTransfer();
     $itemTransfer = new ItemTransfer();
     $itemTransfer->setSku(self::SKU_PRODUCT_CONCRETE);
     $changeTransfer->addItem($itemTransfer);
     $this->productCartConnectorFacade->expandItems($changeTransfer);
     $expandedItemTransfer = $changeTransfer->getItems()[0];
     $this->assertEquals(self::SKU_PRODUCT_ABSTRACT, $expandedItemTransfer->getAbstractSku());
     $this->assertEquals(self::SKU_PRODUCT_CONCRETE, $expandedItemTransfer->getSku());
     $this->assertEquals($productAbstractEntity->getIdProductAbstract(), $expandedItemTransfer->getIdProductAbstract());
     $this->assertEquals($productConcreteEntity->getIdProduct(), $expandedItemTransfer->getId());
 }
示例#2
0
 /**
  * @return void
  */
 protected function setUp()
 {
     parent::setUp();
     $this->localeFacade = new LocaleFacade();
     $this->localeQueryContainer = new LocaleQueryContainer();
     $this->availableLocales = Store::getInstance()->getLocales();
     $this->localeNames = $this->localeFacade->getAvailableLocales();
 }
示例#3
0
 /**
  * @group Locale
  *
  * @return void
  */
 public function testDeleteLocaleDeletesSoftly()
 {
     $localeQuery = $this->localeQueryContainer->queryLocaleByName('ab_xy');
     $this->localeFacade->createLocale('ab_xy');
     $this->assertTrue($localeQuery->findOne()->getIsActive());
     $this->localeFacade->deleteLocale('ab_xy');
     $this->assertFalse($localeQuery->findOne()->getIsActive());
 }
示例#4
0
 /**
  * @return void
  */
 private function runInstaller()
 {
     $messenger = $this->getMessenger();
     $localeFacade = new LocaleFacade();
     $localeFacade->install($messenger);
     $countryFacade = new CountryFacade();
     $countryFacade->install($messenger);
 }
示例#5
0
 /**
  * @return \Generated\Shared\Transfer\LocalizedAttributesTransfer
  */
 protected function createLocalizedAttributesTransfer()
 {
     $localeName = Store::getInstance()->getCurrentLocale();
     $localeTransfer = $this->localeFacade->getLocale($localeName);
     $localizedAttributesTransfer = new LocalizedAttributesTransfer();
     $localizedAttributesTransfer->setLocale($localeTransfer)->setName('Foo');
     return $localizedAttributesTransfer;
 }
示例#6
0
 /**
  * @return void
  */
 public function testTouchUrlActive()
 {
     $locale = $this->localeFacade->createLocale('ABCDE');
     $redirect = $this->urlFacade->createRedirect('/ARedirectUrl');
     $idUrl = $this->urlFacade->createUrl('/aPageUrl', $locale, 'redirect', $redirect->getIdUrlRedirect())->getIdUrl();
     $touchQuery = $this->touchQueryContainer->queryTouchEntry('url', $idUrl);
     $touchQuery->setQueryKey('count');
     $this->assertEquals(0, $touchQuery->count());
     $touchQuery->setQueryKey(TouchQueryContainer::TOUCH_ENTRY_QUERY_KEY);
     $this->urlFacade->touchUrlActive($idUrl);
     $touchQuery->setQueryKey('count');
     $this->assertEquals(1, $touchQuery->count());
 }
示例#7
0
 /**
  * @return void
  */
 public function testTouchTranslationForKeyAndCustomLocale()
 {
     $keyId = $this->glossaryFacade->createKey('SomeNonExistentKey7');
     $localeTransfer = $this->localeFacade->createLocale('ab_fg');
     $transferTranslation = $this->glossaryFacade->createTranslation('SomeNonExistentKey7', $localeTransfer, 'some value', true);
     $specificTranslationQuery = $this->glossaryQueryContainer->queryTranslationByIds($keyId, $localeTransfer->getIdLocale());
     $touchQuery = $this->touchQueryContainer->queryTouchListByItemType('translation');
     $this->assertEquals(1, $specificTranslationQuery->count());
     $touchCountBeforeCreation = $touchQuery->count();
     $transferTranslation->setValue('setSomeOtherTranslation');
     $this->glossaryFacade->saveTranslation($transferTranslation);
     $this->glossaryFacade->touchTranslationForKeyId($keyId, $localeTransfer);
     $touchCountAfterCreation = $touchQuery->count();
     $this->assertEquals('setSomeOtherTranslation', $specificTranslationQuery->findOne()->getValue());
     $this->assertTrue($touchCountAfterCreation > $touchCountBeforeCreation);
 }
 /**
  * @group ProductCategory
  *
  * @return void
  */
 public function testDeleteCategoryWithParentsDeletesAllItsNodes()
 {
     $parentCategoryName1 = 'AParent';
     $parentCategoryName2 = 'BParent';
     $parentCategoryName3 = 'CParent';
     $childCategoryName = 'Child';
     $localeName = 'ABCDE';
     $locale = $this->localeFacade->createLocale($localeName);
     // Prepare category tree: 3 root "parent" categories, 1 child that belongs to 2 parents.
     list($parentCategoryId1, $parentNodeId1) = $this->createDummyRootCategoryWithNode($parentCategoryName1, $locale);
     list($parentCategoryId2, $parentNodeId2) = $this->createDummyRootCategoryWithNode($parentCategoryName2, $locale);
     $childCategory = new CategoryTransfer();
     $childCategory->setName($childCategoryName);
     $childCategory->setCategoryKey(strtolower($childCategoryName));
     $idChildCategory = $this->categoryFacade->createCategory($childCategory, $locale);
     $childNode1 = new NodeTransfer();
     $childNode1->setFkCategory($idChildCategory);
     $childNode1->setFkParentCategoryNode($parentNodeId1);
     $childNode2 = new NodeTransfer();
     $childNode2->setFkCategory($idChildCategory);
     $childNode2->setFkParentCategoryNode($parentNodeId2);
     $this->categoryFacade->createCategoryNode($childNode1, $locale, false);
     $childNodeId2 = $this->categoryFacade->createCategoryNode($childNode2, $locale, false);
     list($parentCategoryId3, $parentNodeId3) = $this->createDummyRootCategoryWithNode($parentCategoryName3, $locale);
     $this->assertNotEquals($parentCategoryId3, $parentNodeId3);
     // Test that removing child category will also remove it's nodes from other parents
     $this->productCategoryFacade->deleteCategory($childNodeId2, $parentNodeId2, true, $locale);
     $parent1Children = $this->categoryFacade->getChildren($parentNodeId1, $locale);
     $parent2Children = $this->categoryFacade->getChildren($parentNodeId2, $locale);
     $this->assertEquals($parent1Children->count(), 0);
     $this->assertEquals($parent2Children->count(), 0);
     // Test removing of a category for which nodeId != categoryId works as well
     $this->productCategoryFacade->deleteCategory($parentNodeId3, 0, true, $locale);
     $result = $this->categoryFacade->getAllNodesByIdCategory($parentCategoryId3);
     $this->assertEmpty($result);
 }
 /**
  * @param string $localeName
  *
  * @return \Generated\Shared\Transfer\LocaleTransfer
  */
 public function getLocale($localeName)
 {
     return $this->localeFacade->getLocale($localeName);
 }
示例#10
0
 /**
  * @return array
  */
 public function getAvailableLocales()
 {
     return $this->localeFacade->getAvailableLocales();
 }