/
githubmirror
/
magento2
Обзор
Документация
Войти
/
githubmirror
/
magento2
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
2.4-develop
dev/tests/integration/testsuite/Magento/Setup/Console/Command/I18nPackCommandTest.php
98 строк
3 KB
Alexandra Zota
ACP2E-4019: CE copyright updates for 2.4.9-beta1
22 окт 2025, 10:44
22 окт 2025, 10:44
264bea2
Код
Авторство
О чём код?
<?php /** * Copyright 2015 Adobe * All Rights Reserved. */ namespace Magento\Setup\Console\Command; use Symfony\Component\Console\Tester\CommandTester; /** * @magentoComponentsDir Magento/Setup/Console/Command/_files/root/app/code */ class I18nPackCommandTest extends \PHPUnit\Framework\TestCase { /** * @var I18nCollectPhrasesCommand */ private $command; /** * @var CommandTester */ private $tester; protected function setUp(): void { $this->command = new I18nPackCommand(); $this->tester = new CommandTester($this->command); } protected function tearDown(): void { $this->removeCsv('A'); $this->removeCsv('B'); $this->removeCsv('C'); $this->removeCsv('D'); } private function removeCsv($module) { if (file_exists(__DIR__ . "/_files/root/app/code/Magento/{$module}/i18n")) { $helper = new \Magento\Framework\Backup\Filesystem\Helper(); $helper->rm(__DIR__ . "/_files/root/app/code/Magento/{$module}/i18n", [], true); } } public function testExecute() { $this->tester->execute( [ 'source' => BP . '/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/i18n.csv', 'locale' => 'de_DE', '--allow-duplicates' => true, ] ); $this->assertEquals('Successfully saved de_DE language package.' . PHP_EOL, $this->tester->getDisplay()); $basePath = BP . '/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/root/app/code'; $this->assertFileExists($basePath . '/Magento/A/i18n/de_DE.csv'); $this->assertFileExists($basePath . '/Magento/B/i18n/de_DE.csv'); $this->assertFileExists($basePath . '/Magento/C/i18n/de_DE.csv'); $this->assertFileExists($basePath . '/Magento/D/i18n/de_DE.csv'); } /** */ public function testExecuteNonExistingPath() { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('Cannot open dictionary file:'); $nonExistPath = BP . '/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/non_exist.csv'; $this->tester->execute( [ 'source' => $nonExistPath, 'locale' => 'de_DE', '--allow-duplicates' => true, ] ); } /** */ public function testExecuteInvalidMode() { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('Possible values for \'mode\' option are \'replace\' and \'merge\''); $this->tester->execute( [ 'source' => BP . '/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/i18n.csv', 'locale' => 'de_DE', '--allow-duplicates' => true, '--mode' => 'invalid' ] ); } }