Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/old/dev/tests/integration/testsuite/Magento/Translation/Model/Js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/dev/tests/integration/testsuite/Magento/Translation/Model/Js/DataProviderTest.php
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
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
        }
    }
}

Spamworldpro Mini