18 protected function setUp()
22 ->create(\
Magento\Framework\Translate\Inline::class);
25 [
'translateInline' => $inline]
29 \
Magento\Store\Model\StoreManagerInterface::class
33 'dev/translate_inline/active' 36 \
Magento\Framework\
App\Config\MutableScopeConfigInterface::class
38 'dev/translate_inline/active',
40 \
Magento\Store\Model\ScopeInterface::SCOPE_STORE,
50 $inputArray = [[
'original' => $originalText,
'custom' => $translatedText]];
51 if ($isPerStore !==
null) {
52 $inputArray[0][
'perstore'] = $isPerStore;
54 $this->_inlineParser->processAjaxPost($inputArray);
57 \
Magento\Translation\Model\StringUtils::class
59 $model->load($originalText);
61 $this->assertEquals($translatedText,
$model->getTranslate());
63 }
catch (\Exception $e) {
66 ->get(\Psr\Log\LoggerInterface::class)
77 [
'original text 1',
'translated text 1'],
78 [
'original text 2',
'translated text 2',
true]
84 $isJsonProperty = new \ReflectionProperty(get_class($this->_inlineParser),
'_isJson');
85 $isJsonProperty->setAccessible(
true);
87 $this->assertFalse($isJsonProperty->getValue($this->_inlineParser));
89 $setIsJsonMethod = new \ReflectionMethod($this->_inlineParser,
'setIsJson');
90 $setIsJsonMethod->setAccessible(
true);
91 $setIsJsonMethod->invoke($this->_inlineParser,
true);
93 $this->assertTrue($isJsonProperty->getValue($this->_inlineParser));
processAjaxPostDataProvider()
testProcessAjaxPost($originalText, $translatedText, $isPerStore=null)
static getObjectManager()