/** * @return void */ public function testSaveAndTouchTranslationDoesATouchForCreation() { $keyId = $this->glossaryFacade->createKey('SomeNonExistentKey3'); $localeId = $this->localeFacade->createLocale('ab_ef')->getIdLocale(); $specificTranslationQuery = $this->glossaryQueryContainer->queryTranslationByIds($keyId, $localeId); $touchQuery = $this->touchQueryContainer->queryTouchListByItemType('translation'); $transferTranslation = new TranslationTransfer(); $transferTranslation->setFkGlossaryKey($keyId); $transferTranslation->setFkLocale($localeId); $transferTranslation->setValue('some Value'); $transferTranslation->setIsActive(true); $this->assertEquals(0, $specificTranslationQuery->count()); $touchCountBeforeCreation = $touchQuery->count(); $transferTranslation = $this->glossaryFacade->saveAndTouchTranslation($transferTranslation); $touchCountAfterCreation = $touchQuery->count(); $this->assertEquals(1, $specificTranslationQuery->count()); $this->assertNotNull($transferTranslation->getIdGlossaryTranslation()); $this->assertTrue($touchCountAfterCreation > $touchCountBeforeCreation); }
/** * @param \Generated\Shared\Transfer\LocaleTransfer $locale * @param string $idGlossaryKey * @param string $value * @param bool $isActive * * @return \Generated\Shared\Transfer\TranslationTransfer */ protected function createTranslationTransfer(LocaleTransfer $locale, $idGlossaryKey, $value, $isActive = true) { $translationTransfer = new TranslationTransfer(); $translationTransfer->setValue($value); $translationTransfer->setFkGlossaryKey($idGlossaryKey); $translationTransfer->setFkLocale($locale->getIdLocale()); $translationTransfer->setIsActive($isActive); return $translationTransfer; }