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/vendor/magento/framework/Translate/Test/Unit/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/magento/framework/Translate/Test/Unit/AdapterTest.php
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
declare(strict_types=1);

namespace Magento\Framework\Translate\Test\Unit;

use Laminas\I18n\Translator\Translator;
use Magento\Framework\Translate\Adapter;
use PHPUnit\Framework\TestCase;

class AdapterTest extends TestCase
{
    /**
     * Check that translate calls are passed to given translator
     *
     * @param string $strToTranslate
     * @param string $translatedStr
     * @dataProvider translateDataProvider
     */
    public function testTranslate($strToTranslate, $translatedStr)
    {
        $translatorMock = $this->getMockBuilder(Translator::class)
            ->setMethods(['translate'])->getMock();
        $translatorMock->expects(
            $this->once()
        )->method(
            'translate'
        )->with(
            $strToTranslate
        )->willReturn(
            $translatedStr
        );
        $translator = new Adapter();
        $translator->setTranslator($translatorMock);

        $this->assertEquals($translatedStr, $translator->translate($strToTranslate));
    }

    /**
     * @return array
     */
    public function translateDataProvider()
    {
        return [['Translate me!', 'Translated string']];
    }

    /**
     * Test that string is returned in any case
     */
    public function testTranslateNoProxy()
    {
        $translator = new Adapter();
        $this->assertEquals('test string', $translator->translate('test string'));
    }

    /**
     * Test translation with more than one parameter passed
     */
    public function testUnderscoresTranslation()
    {
        $this->markTestSkipped('MAGETWO-1012: i18n Improvements - Localization/Translations');
    }
}

Spamworldpro Mini