/
githubmirror
/
magento2
Обзор
Документация
Войти
/
githubmirror
/
magento2
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
2.4-develop
setup/src/Magento/Setup/Test/Unit/Model/DictionaryTest.php
60 строк
2 KB
Alexandra Zota
ACP2E-4019: CE copyright updates for 2.4.9-beta1
22 окт 2025, 11:23
22 окт 2025, 11:23
6c2f6e6
Код
Авторство
О чём код?
<?php /** * Copyright 2017 Adobe * All Rights Reserved. */ declare(strict_types=1); namespace Magento\Setup\Test\Unit\Model; use Magento\Setup\Model\Dictionary; use PHPUnit\Framework\TestCase; class DictionaryTest extends TestCase { /** * @var array */ private $dictionary = [ 'lorem', 'ipsum', 'dolor', 'sit', 'amet', 'consectetur', 'adipiscing', 'elit', 'sed', 'do', 'eiusmod', 'tempor', 'incididunt', 'ut', 'labore', 'et', 'dolore', 'magna', 'aliqua' ]; public function testDictionaryFileNotFoundException() { $this->expectException('Magento\Setup\Exception'); $this->expectExceptionMessage('Description file some-wrong-file.csv not found or is not readable'); $dictionary = new Dictionary('some-wrong-file.csv'); $dictionary->getRandWord(); } public function testDictionaryFileIsEmptyException() { $this->expectException('Magento\Setup\Exception'); $this->expectExceptionMessageMatches('/Dictionary file .*empty-dictionary\.csv is empty/'); $filePath = __DIR__ . '/_files/empty-dictionary.csv'; file_put_contents($filePath, ''); try { $dictionary = new Dictionary($filePath); $dictionary->getRandWord(); } finally { unlink($filePath); } } public function testGetRandWord() { $filePath = __DIR__ . '/_files/valid-dictionary.csv'; file_put_contents($filePath, implode(PHP_EOL, $this->dictionary)); $dictionary = new Dictionary($filePath); $this->assertContains($dictionary->getRandWord(), $this->dictionary); $this->assertContains($dictionary->getRandWord(), $this->dictionary); $this->assertContains($dictionary->getRandWord(), $this->dictionary); unlink($filePath); } }