Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions
TranslateTest Class Reference
Inheritance diagram for TranslateTest:

Public Member Functions

 testLoadData ()
 
 testTranslate ($inputText, $expectedTranslation)
 
 translateDataProvider ()
 

Detailed Description

@magentoAppIsolation enabled @magentoCache all disabled @SuppressWarnings(PHPMD.CouplingBetweenObjects)

Definition at line 18 of file TranslateTest.php.

Member Function Documentation

◆ testLoadData()

testLoadData ( )

Definition at line 94 of file TranslateTest.php.

95  {
96  $data = $this->translate->loadData(null, true)->getData();
98  $this->translate->loadData()->getData();
99  $dataCached = $this->translate->loadData()->getData();
100  $this->assertEquals($data, $dataCached);
101  }
jquery extjs ext tree mage adminhtml mage translate
Definition: tree.phtml:41

◆ testTranslate()

testTranslate (   $inputText,
  $expectedTranslation 
)

@magentoCache all disabled @dataProvider translateDataProvider

Parameters
string$inputText
string$expectedTranslation
Returns
void
Exceptions
Exception

Definition at line 112 of file TranslateTest.php.

113  {
114  $this->translate->loadData(\Magento\Framework\App\Area::AREA_FRONTEND);
115  $actualTranslation = new \Magento\Framework\Phrase($inputText);
116  $this->assertEquals($expectedTranslation, $actualTranslation);
117  }
jquery extjs ext tree mage adminhtml mage translate
Definition: tree.phtml:41

◆ translateDataProvider()

translateDataProvider ( )
Returns
array

Definition at line 122 of file TranslateTest.php.

123  {
124  return [
125  ['', ''],
126  [
127  'Theme phrase will be translated',
128  'Theme phrase is translated',
129  ],
130  [
131  'Phrase in Magento_Store module that doesn\'t need translation',
132  'Phrase in Magento_Store module that doesn\'t need translation',
133  ],
134  [
135  'Phrase in Magento_Catalog module that doesn\'t need translation',
136  'Phrase in Magento_Catalog module that doesn\'t need translation',
137  ],
138  [
139  'Magento_Store module phrase will be overridden by theme translation',
140  'Magento_Store module phrase is overridden by theme translation',
141  ],
142  [
143  'Magento_Catalog module phrase will be overridden by theme translation',
144  'Magento_Catalog module phrase is overridden by theme translation',
145  ],
146  ];
147  }

The documentation for this class was generated from the following file: