Example #1
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());
 }
Example #2
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());
 }
Example #3
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);
 }
Example #4
0
 /**
  * @group Product
  *
  * @return void
  */
 public function testCreateProductUrlCreatesAndReturnsCorrectUrl()
 {
     $urlString = '/someUrl';
     $locale = $this->localeFacade->createLocale('ABCDE');
     $productAbstract = new ProductAbstractTransfer();
     $productAbstract->setSku('AnProductAbstractSku');
     $productAbstract->setAttributes([]);
     $productAbstract->addLocalizedAttributes($this->createLocalizedAttributesTransfer());
     $idProductAbstract = $this->productFacade->createProductAbstract($productAbstract);
     $url = $this->productFacade->createProductUrl('AnProductAbstractSku', $urlString, $locale);
     $this->assertTrue($this->urlFacade->hasUrl($urlString));
     $this->assertEquals($urlString, $url->getUrl());
     $this->assertEquals($idProductAbstract, $url->getFkProductAbstract());
     $this->assertEquals($idProductAbstract, $url->getResourceId());
     $this->assertEquals('product_abstract', $url->getResourceType());
     $this->assertEquals($locale->getIdLocale(), $url->getFkLocale());
 }
 /**
  * @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);
 }