コード例 #1
0
 /**
  * @magentoDataFixture Magento/Translation/_files/db_translate.php
  * @magentoDataFixture Magento/Backend/controllers/_files/cache/all_types_enabled.php
  * @covers \Magento\Translation\Model\Resource\Translate::getStoreId
  * @covers \Magento\Translation\Model\Resource\String::getStoreId
  */
 public function testLoadDataCaching()
 {
     /** @var \Magento\Translation\Model\Resource\String $translateString */
     $translateString = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Translation\\Model\\Resource\\String');
     $translateString->saveTranslate('Fixture String', 'New Db Translation');
     $this->_model->loadData(\Magento\Framework\App\Area::AREA_FRONTEND);
     $this->assertEquals('Fixture Db Translation', __('Fixture String'), 'Translation is expected to be cached');
     $this->_model->loadData(\Magento\Framework\App\Area::AREA_FRONTEND, true);
     $this->assertEquals('New Db Translation', __('Fixture String'), 'Forced load should not use cache');
 }
コード例 #2
0
 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));
 }