/
githubmirror
/
magento2
Обзор
Документация
Войти
/
githubmirror
/
magento2
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
2.4-develop
dev/tests/integration/testsuite/Magento/Translation/Model/Js/DataProviderTest.php
74 строки
2 KB
Alexandra Zota
ACP2E-4019: CE copyright updates for 2.4.9-beta1
22 окт 2025, 10:44
22 окт 2025, 10:44
264bea2
Код
Авторство
О чём код?
<?php /** * Copyright 2020 Adobe * All Rights Reserved. */ declare(strict_types=1); namespace Magento\Translation\Model\Js; use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\TranslateInterface; use Magento\TestFramework\Helper\Bootstrap; use Magento\Translation\Model\ResourceModel\StringUtils; use PHPUnit\Framework\TestCase; /** * Integration tests for \Magento\Translation\Model\Js\DataProvider class. */ class DataProviderTest extends TestCase { /** * @var StringUtils */ private $stringUtils; /** * @var TranslateInterface */ private $translate; /** * @var DataProviderInterface */ private $translationDataProvider; /** * @inheritdoc */ protected function setUp(): void { $objectManager = Bootstrap::getObjectManager(); $this->stringUtils = $objectManager->get(StringUtils::class); $this->translate = $objectManager->get(TranslateInterface::class); $this->translationDataProvider = $objectManager->get(DataProviderInterface::class); } /** * Test translation data. * * @magentoAppArea frontend * @magentoConfigFixture default_store dev/translate_inline/active 1 */ public function testGetData() { $expectedDictionary = ['Proceed to Checkout' => 'Proceed to Checkout - Translated']; $this->stringUtils->saveTranslate('Proceed to Checkout', 'Proceed to Checkout - Translated'); $this->translate->setLocale('en_US')->loadData('frontend', true); $dictionary = $this->translationDataProvider->getData('Magento/luma'); $this->assertEquals($expectedDictionary, $dictionary); } /** * @inheritdoc */ protected function tearDown(): void { try { $this->stringUtils->deleteTranslate('Proceed to Checkout'); } catch (NoSuchEntityException $exception) { // translate already deleted } } }