![]() 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/setup/src/Magento/Setup/Test/Unit/Module/I18n/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); namespace Magento\Setup\Test\Unit\Module\I18n; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use Magento\Setup\Module\I18n\Dictionary; use Magento\Setup\Module\I18n\Dictionary\Phrase; use PHPUnit\Framework\TestCase; class DictionaryTest extends TestCase { /** * @var Dictionary */ protected $_dictionary; protected function setUp(): void { $objectManagerHelper = new ObjectManager($this); $this->_dictionary = $objectManagerHelper->getObject(Dictionary::class); } public function testPhraseCollecting() { $phraseFirstMock = $this->createMock(Phrase::class); $phraseSecondMock = $this->createMock(Phrase::class); $this->_dictionary->addPhrase($phraseFirstMock); $this->_dictionary->addPhrase($phraseSecondMock); $this->assertEquals([$phraseFirstMock, $phraseSecondMock], $this->_dictionary->getPhrases()); } public function testGetDuplicates() { $phraseFirstMock = $this->createMock(Phrase::class); $phraseFirstMock->expects($this->once())->method('getKey')->willReturn('key_1'); $phraseSecondMock = $this->createMock(Phrase::class); $phraseSecondMock->expects($this->once())->method('getKey')->willReturn('key_1'); $phraseThirdMock = $this->createMock(Phrase::class); $phraseThirdMock->expects($this->once())->method('getKey')->willReturn('key_3'); $this->_dictionary->addPhrase($phraseFirstMock); $this->_dictionary->addPhrase($phraseSecondMock); $this->_dictionary->addPhrase($phraseThirdMock); $this->assertEquals([[$phraseFirstMock, $phraseSecondMock]], $this->_dictionary->getDuplicates()); } }