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,116 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Setup\Module\I18n\Dictionary;
use Magento\Framework\Component\ComponentRegistrar;
use Magento\Setup\Module\I18n\Dictionary\Generator;
use Magento\Setup\Module\I18n\ServiceLocator;
class GeneratorTest extends \PHPUnit\Framework\TestCase
{
/**
* @var string
*/
protected $testDir;
/**
* @var string
*/
protected $expectedDir;
/**
* @var string
*/
protected $source;
/**
* @var string
*/
protected $outputFileName;
/**
* @var \Magento\Setup\Module\I18n\Dictionary\Generator
*/
protected $generator;
/**
* @var array
*/
protected $backupRegistrar;
protected function setUp(): void
{
$reflection = new \ReflectionClass(\Magento\Framework\Component\ComponentRegistrar::class);
$paths = $reflection->getProperty('paths');
$paths->setAccessible(true);
$this->backupRegistrar = $paths->getValue();
$paths->setValue(['module' => [], 'theme' => []]);
$paths->setAccessible(false);
$this->testDir = realpath(__DIR__ . '/_files');
$this->expectedDir = $this->testDir . '/expected';
$this->source = $this->testDir . '/source';
$this->outputFileName = $this->testDir . '/translate.csv';
// Register the test modules
ComponentRegistrar::register(
ComponentRegistrar::MODULE,
'Magento_FirstModule',
$this->source . '/app/code/Magento/FirstModule'
);
ComponentRegistrar::register(
ComponentRegistrar::MODULE,
'Magento_SecondModule',
$this->source . '/app/code/Magento/SecondModule'
);
// Register the test theme
ComponentRegistrar::register(
ComponentRegistrar::THEME,
'adminhtml/default/backend',
$this->source . '/app/design/adminhtml/default/backend'
);
$this->generator = ServiceLocator::getDictionaryGenerator();
}
protected function tearDown(): void
{
if (file_exists($this->outputFileName)) {
unlink($this->outputFileName);
}
$property = new \ReflectionProperty(\Magento\Setup\Module\I18n\ServiceLocator::class, '_dictionaryGenerator');
$property->setAccessible(true);
$property->setValue(null);
$property->setAccessible(false);
$reflection = new \ReflectionClass(\Magento\Framework\Component\ComponentRegistrar::class);
$paths = $reflection->getProperty('paths');
$paths->setAccessible(true);
$paths->setValue($this->backupRegistrar);
$paths->setAccessible(false);
}
public function testGenerationWithoutContext()
{
$this->generator->generate($this->source, $this->outputFileName);
$this->assertFileEquals($this->expectedDir . '/without_context.csv', $this->outputFileName);
}
public function testGenerationWithContext()
{
$this->generator->generate($this->source, $this->outputFileName, true);
$expected = explode(PHP_EOL, file_get_contents($this->expectedDir . '/with_context.csv'));
$output = file_get_contents($this->outputFileName);
foreach ($expected as $line) {
if ($line) {
$this->assertStringContainsString($line, $output);
}
}
}
}
@@ -0,0 +1,12 @@
Helper,Helper,module,Magento_FirstModule
Model,Model,module,Magento_FirstModule
"Module template","Module template",module,Magento_FirstModule
Model,Model,module,Magento_SecondModule
"Theme template","Theme template",theme,adminhtml/default/backend
"Module js","Module js",module,Magento_FirstModule
"Lib js","Lib js",lib,lib/web/mage/file.js
"Lib js","Lib js",lib,lib/web/varien/file.js
"Module layout label","Module layout label",module,Magento_FirstModule
"Module layout title","Module layout title",module,Magento_FirstModule
"Theme layout label","Theme layout label",theme,adminhtml/default/backend
"Theme layout title","Theme layout title",theme,adminhtml/default/backend
1 Helper Helper module Magento_FirstModule
2 Model Model module Magento_FirstModule
3 Module template Module template module Magento_FirstModule
4 Model Model module Magento_SecondModule
5 Theme template Theme template theme adminhtml/default/backend
6 Module js Module js module Magento_FirstModule
7 Lib js Lib js lib lib/web/mage/file.js
8 Lib js Lib js lib lib/web/varien/file.js
9 Module layout label Module layout label module Magento_FirstModule
10 Module layout title Module layout title module Magento_FirstModule
11 Theme layout label Theme layout label theme adminhtml/default/backend
12 Theme layout title Theme layout title theme adminhtml/default/backend
@@ -0,0 +1,13 @@
Helper,Helper
Model,Model
"Module template","Module template"
"Theme template","Theme template"
"Model unused","Model unused"
"Theme template unused","Theme template unused"
"Module js","Module js"
"Lib js","Lib js"
"Lib js unused","Lib js unused"
"Module layout label","Module layout label"
"Module layout title","Module layout title"
"Theme layout label","Theme layout label"
"Theme layout title","Theme layout title"
1 Helper Helper
2 Model Model
3 Module template Module template
4 Theme template Theme template
5 Model unused Model unused
6 Theme template unused Theme template unused
7 Module js Module js
8 Lib js Lib js
9 Lib js unused Lib js unused
10 Module layout label Module layout label
11 Module layout title Module layout title
12 Theme layout label Theme layout label
13 Theme layout title Theme layout title
@@ -0,0 +1,17 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\FirstModule\Helper;
class Helper
{
/**
* @return void
*/
public function test()
{
__('Helper');
}
}
@@ -0,0 +1,17 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\FirstModule\Model;
class Model
{
/**
* @return void
*/
public function test()
{
__('Model');
}
}
@@ -0,0 +1,15 @@
<?xml version='1.0' encoding="utf-8" ?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<layout>
<referenceBlock translate="description, label">
<description>Module layout description</description>
<label>Module layout label</label>
<title translate="true">Module layout title</title>
</referenceBlock>
</layout>
@@ -0,0 +1,8 @@
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
(function() {
$.mage.__('Module js');
});
@@ -0,0 +1,7 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
?>
<?php __('Module template');
@@ -0,0 +1,17 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\SecondModule\Model;
class Model
{
/**
* @return void
*/
public function test()
{
__('Model');
}
}
@@ -0,0 +1,15 @@
<?xml version='1.0' encoding="utf-8" ?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<layout>
<referenceBlock translate="description, label">
<description>Theme layout description</description>
<label>Theme layout label</label>
<title translate="true">Theme layout title</title>
</referenceBlock>
</layout>
@@ -0,0 +1,7 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
?>
<?php __('Theme template');
@@ -0,0 +1,8 @@
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
(function() {
$.mage.__('Lib js')
});
@@ -0,0 +1,8 @@
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
(function() {
$.mage.__('Lib js')
});
@@ -0,0 +1,17 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\FirstModule\Model;
class Model
{
/**
* @return void
*/
public function test()
{
__('Model unused');
}
}
@@ -0,0 +1,8 @@
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
(function() {
$.mage.__('Lib js unused')
});
@@ -0,0 +1,7 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
?>
<?php __('Theme template unused');