/
githubmirror
/
magento2
Обзор
Документация
Войти
/
githubmirror
/
magento2
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
2.4-develop
setup/src/Magento/Setup/Test/Unit/Fixtures/ConfigsApplyFixtureTest.php
108 строк
3 KB
Manish Ranjan
AC-16248: PHPUnit 12 Upgrade | Unit test fix
13 янв 2026, 17:31
13 янв 2026, 17:31
58f9738
Код
Авторство
О чём код?
<?php /** * Copyright 2015 Adobe * All Rights Reserved. */ declare(strict_types=1); namespace Magento\Setup\Test\Unit\Fixtures; use Magento\Config\App\Config\Type\System; use Magento\Framework\App\Cache; use Magento\Framework\App\CacheInterface; use Magento\Framework\App\Config; use Magento\Framework\App\Config\ValueInterface; use Magento\Framework\ObjectManager\ObjectManager; use Magento\Setup\Fixtures\ConfigsApplyFixture; use Magento\Setup\Fixtures\FixtureModel; use PHPUnit\Framework\MockObject\MockObject; use Magento\Framework\TestFramework\Unit\Helper\MockCreationTrait; use PHPUnit\Framework\TestCase; class ConfigsApplyFixtureTest extends TestCase { use MockCreationTrait; /** * @var MockObject|FixtureModel */ private $fixtureModelMock; /** * @var ConfigsApplyFixture */ private $model; protected function setUp(): void { $this->fixtureModelMock = $this->createMock(FixtureModel::class); $this->model = new ConfigsApplyFixture($this->fixtureModelMock); } public function testExecute() { $cacheMock = $this->createMock(Cache::class); $valueMock = $this->createMock(Config::class); $configMock = $this->createMock(System::class); $objectManagerMock = $this->createMock(ObjectManager::class); $objectManagerMock ->method('get') ->willReturnMap([ [CacheInterface::class, $cacheMock], [System::class, $configMock] ]); $this->fixtureModelMock ->expects($this->once()) ->method('getValue') ->willReturn(['config' => $valueMock]); $this->fixtureModelMock ->method('getObjectManager') ->willReturn($objectManagerMock); $cacheMock->method('clean'); $configMock->method('clean'); $this->model->execute(); } public function testNoFixtureConfigValue() { $configMock = $this->createPartialMockWithReflection( ValueInterface::class, ['save', 'isValueChanged', 'getOldValue', 'getFieldsetDataValue', 'setScope', 'setPath', 'setValue', 'getScope', 'getPath', 'getValue', 'getId', 'setId'] ); $configMock->expects($this->never())->method('save'); $objectManagerMock = $this->createMock(ObjectManager::class); $objectManagerMock->expects($this->never()) ->method('create') ->willReturn($configMock); $this->fixtureModelMock ->expects($this->never()) ->method('getObjectManager') ->willReturn($objectManagerMock); $this->fixtureModelMock ->expects($this->once()) ->method('getValue') ->willReturn(false); $this->model->execute(); } public function testGetActionTitle() { $this->assertSame('Config Changes', $this->model->getActionTitle()); } public function testIntroduceParamLabels() { $this->assertSame([], $this->model->introduceParamLabels()); } }