示例#1
0
 /**
  * @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);
 }
示例#2
0
 /**
  * @param \Generated\Shared\Transfer\TranslationTransfer $transferTranslation
  *
  * @return \Orm\Zed\Glossary\Persistence\SpyGlossaryTranslation
  */
 protected function getTranslationFromTransfer(TranslationTransfer $transferTranslation)
 {
     $translation = $this->getTranslationEntityById($transferTranslation->getIdGlossaryTranslation());
     $translation->fromArray($transferTranslation->toArray());
     return $translation;
 }