ltsecurityinc安防产品在线商城代码

This commit is contained in:
2026-09-14 17:47:10 +08:00
parent 57d8444c15
commit 6a3c9c5bd8
14539 changed files with 1775310 additions and 0 deletions
@@ -0,0 +1,126 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Framework\Translate;
class InlineTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Translate\Inline
*/
protected $_model;
/**
* @var string
*/
protected $_storeId = 'default';
/**
* @var \Magento\Framework\Translate\Inline\StateInterface
*/
protected $state;
public static function setUpBeforeClass(): void
{
\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(\Magento\Framework\App\State::class)
->setAreaCode('frontend');
\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
\Magento\Framework\View\DesignInterface::class
)->setDesignTheme(
'Magento/blank'
);
}
protected function setUp(): void
{
$this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
\Magento\Framework\Translate\Inline::class
);
$this->state = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
\Magento\Framework\Translate\Inline\StateInterface::class
);
/* Called getConfig as workaround for setConfig bug */
\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
\Magento\Store\Model\StoreManagerInterface::class
)->getStore(
$this->_storeId
)->getConfig(
'dev/translate_inline/active'
);
\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
\Magento\Framework\App\Config\MutableScopeConfigInterface::class
)->setValue(
'dev/translate_inline/active',
true,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
$this->_storeId
);
}
public function testIsAllowed()
{
$this->assertTrue($this->_model->isAllowed());
$this->assertTrue($this->_model->isAllowed($this->_storeId));
$this->assertTrue(
$this->_model->isAllowed(
\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
\Magento\Store\Model\StoreManagerInterface::class
)->getStore(
$this->_storeId
)
)
);
$this->state->suspend();
$this->assertFalse($this->_model->isAllowed());
$this->assertFalse($this->_model->isAllowed($this->_storeId));
$this->assertFalse(
$this->_model->isAllowed(
\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
\Magento\Store\Model\StoreManagerInterface::class
)->getStore(
$this->_storeId
)
)
);
}
/**
* @param string $originalText
* @param string $expectedText
* @dataProvider processResponseBodyDataProvider
*/
public function testProcessResponseBody($originalText, $expectedText)
{
$actualText = $originalText;
$this->_model->processResponseBody($actualText, false);
$this->markTestSkipped('Bug MAGE-2494');
$expected = new \DOMDocument();
$expected->preserveWhiteSpace = false;
$expected->loadHTML($expectedText);
$actual = new \DOMDocument();
$actual->preserveWhiteSpace = false;
$actual->loadHTML($actualText);
$this->assertEquals($expected, $actual);
}
/**
* @return array
*/
public function processResponseBodyDataProvider()
{
$originalText = file_get_contents(__DIR__ . '/_files/_inline_page_original.html');
$expectedText = file_get_contents(__DIR__ . '/_files/_inline_page_expected.html');
return [
'plain text' => ['text with no translations and tags', 'text with no translations and tags'],
'html string' => [$originalText, $expectedText],
'html array' => [[$originalText], [$expectedText]]
];
}
}
@@ -0,0 +1,36 @@
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>shown_0</title><span class="translate-inline-title" data-translate="[{&quot;shown&quot;:&quot;shown_0&quot;,&quot;translated&quot;:&quot;translated_0&quot;,&quot;original&quot;:&quot;original_0&quot;,&quot;location&quot;:&quot;Page title&quot;,&quot;scope&quot;:&quot;scope_0&quot;}]">TITLE</span>
</head>
<body>
<div data-translate="[{&quot;shown&quot;:&quot;shown_1&quot;,&quot;translated&quot;:&quot;translated_1&quot;,&quot;original&quot;:&quot;original_1&quot;,&quot;location&quot;:&quot;Tag attribute (ALT, TITLE, etc.)&quot;,&quot;scope&quot;:&quot;scope_1&quot;}]"title="some_title_shown_1_in_div">
some_text_<span data-translate="[{&quot;shown&quot;:&quot;shown_2&quot;,&quot;translated&quot;:&quot;translated_2&quot;,&quot;original&quot;:&quot;original_2&quot;,&quot;location&quot;:&quot;Text&quot;,&quot;scope&quot;:&quot;scope_2&quot;}]">shown_2</span>_in_div
</div>
<script type="text/javascript" src="http://localhost/static/frontend/Magento/luma/en_US/prototype/window.js"></script>
<link rel="stylesheet" type="text/css" href="http://localhost/static/frontend/Magento/luma/en_US/prototype/windows/themes/default.css"/>
<link rel="stylesheet" type="text/css" href="http://localhost/media/theme/static/frontend/{{design_package}}/default/en_US/Magento_Theme/prototype/magento.css"/>
<script type="text/javascript" src="http://localhost/static/frontend/Magento/luma/en_US/mage/edit-trigger.js"></script>
<script type="text/javascript" src="http://localhost/static/frontend/Magento/luma/en_US/mage/translate-inline.js"></script>
<link rel="stylesheet" type="text/css" href="http://localhost/static/frontend/Magento/luma/en_US/mage/translate-inline.css"/>
<script type="text/javascript">
(function($){
$(document).ready(function() {
$(this).translateInline({
ajaxUrl: 'http://localhost/index.php/translation/ajax/index/',
area: 'frontend',
editTrigger: {img: 'http://localhost/media/theme/static/frontend/{{design_package}}/default/en_US/Magento_Theme/fam_book_open.png'}
});
});
})(jQuery);
</script>
</body>
</html>
@@ -0,0 +1,18 @@
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>{{{shown_0}}{{translated_0}}{{original_0}}{{scope_0}}}</title>
</head>
<body>
<div title="some_title_{{{shown_1}}{{translated_1}}{{original_1}}{{scope_1}}}_in_div">
some_text_{{{shown_2}}{{translated_2}}{{original_2}}{{scope_2}}}_in_div
</div>
</body>
</html>
@@ -0,0 +1,15 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
?>
<?php return [
'Original value for Magento_Store module' => 'Translated value for Magento_Store module',
'Magento_Store::Text with different translation on different modules' => 'Text translation by Magento_Store module',
'Some non-translated value for Magento_Catalog' => 'Translation for some value for Magento_Catalog',
'Another non-translated value for Magento_Catalog' => 'Translation for another value for Magento_Catalog',
'Magento_Catalog::Text with different translation on different modules' =>
'Text translation by Magento_Catalog module',
'Design value to translate' => 'Design translated value',
];