public function testUpdateAndGetTranslations() { $translations = ['phrase1' => 'translated1', 'phrase2' => 'translated2']; $this->eventManagerMock->expects($this->once())->method('dispatch'); $this->translateResourceMock->expects($this->once())->method('getTranslationArray')->willReturn($translations); $this->localeResolverMock->expects($this->once())->method('getLocale')->willReturn('en_US'); $this->fileManagerMock->expects($this->once())->method('updateTranslationFileContent'); $this->assertEquals($translations, $this->model->updateAndGetTranslations()); }
public function testLoadDataNoTheme() { $forceReload = true; $this->expectsSetConfig(null, null); $this->moduleList->expects($this->once())->method('getNames')->will($this->returnValue([])); $this->appState->expects($this->once())->method('getAreaCode')->will($this->returnValue('frontend')); $this->packDictionary->expects($this->once())->method('getDictionary')->will($this->returnValue([])); $this->resource->expects($this->any())->method('getTranslationArray')->will($this->returnValue([])); $this->assertEquals($this->translate, $this->translate->loadData(null, $forceReload)); }