Skip to content

Commit c68ab02

Browse files
committed
ACP2E-1999: fix unit tests errors
1 parent 0bb78ca commit c68ab02

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

app/code/Magento/Config/Test/Unit/Console/Command/ConfigSetCommandTest.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111
use Magento\Config\Console\Command\ConfigSet\ProcessorFacadeFactory;
1212
use Magento\Config\Console\Command\ConfigSetCommand;
1313
use Magento\Config\Console\Command\EmulatedAdminhtmlAreaProcessor;
14+
use Magento\Config\Console\Command\LocaleEmulatorInterface;
1415
use Magento\Deploy\Model\DeploymentConfig\ChangeDetector;
1516
use Magento\Framework\App\DeploymentConfig;
1617
use Magento\Framework\Console\Cli;
1718
use Magento\Framework\Exception\ValidatorException;
19+
use PHPUnit\Framework\MockObject\MockObject;
1820
use PHPUnit\Framework\MockObject\MockObject as Mock;
1921
use PHPUnit\Framework\TestCase;
2022
use Symfony\Component\Console\Tester\CommandTester;
@@ -56,6 +58,11 @@ class ConfigSetCommandTest extends TestCase
5658
*/
5759
private $processorFacadeMock;
5860

61+
/**
62+
* @var LocaleEmulatorInterface|MockObject
63+
*/
64+
private $localeEmulatorMock;
65+
5966
/**
6067
* @inheritdoc
6168
*/
@@ -76,12 +83,15 @@ protected function setUp(): void
7683
$this->deploymentConfigMock = $this->getMockBuilder(DeploymentConfig::class)
7784
->disableOriginalConstructor()
7885
->getMock();
86+
$this->localeEmulatorMock = $this->getMockBuilder(LocaleEmulatorInterface::class)
87+
->getMockForAbstractClass();
7988

8089
$this->command = new ConfigSetCommand(
8190
$this->emulatedAreProcessorMock,
8291
$this->changeDetectorMock,
8392
$this->processorFacadeFactoryMock,
84-
$this->deploymentConfigMock
93+
$this->deploymentConfigMock,
94+
$this->localeEmulatorMock
8595
);
8696
}
8797

@@ -175,6 +185,12 @@ public function testExecuteWithException()
175185
->method('process')
176186
->willThrowException(new ValidatorException(__('The "test/test/test" path does not exists')));
177187

188+
$this->localeEmulatorMock->expects($this->once())
189+
->method('emulate')
190+
->willReturnCallback(function ($function) {
191+
return $function();
192+
});
193+
178194
$tester = new CommandTester($this->command);
179195
$tester->execute([
180196
ConfigSetCommand::ARG_PATH => 'test/test/test',

0 commit comments

Comments
 (0)