/** * @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()); }
/** * @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); }
/** * @dataProvider queryTouchEntriesByItemTypeAndItemIdsDataProvider * * @param array $itemsIds * @param int $expectedCount * * @return void */ public function testQueryTouchEntriesByItemTypeAndItemIds(array $itemsIds, $expectedCount) { $touchQueryContainer = new TouchQueryContainer(); $touchQuery = $touchQueryContainer->queryTouchEntriesByItemTypeAndItemIds(self::ITEM_TYPE, $itemsIds); $this->assertCount($expectedCount, $touchQuery); }