11
11
use Magento \Config \Console \Command \ConfigSet \ProcessorFacadeFactory ;
12
12
use Magento \Config \Console \Command \ConfigSetCommand ;
13
13
use Magento \Config \Console \Command \EmulatedAdminhtmlAreaProcessor ;
14
+ use Magento \Config \Console \Command \LocaleEmulatorInterface ;
14
15
use Magento \Deploy \Model \DeploymentConfig \ChangeDetector ;
15
16
use Magento \Framework \App \DeploymentConfig ;
16
17
use Magento \Framework \Console \Cli ;
17
18
use Magento \Framework \Exception \ValidatorException ;
19
+ use PHPUnit \Framework \MockObject \MockObject ;
18
20
use PHPUnit \Framework \MockObject \MockObject as Mock ;
19
21
use PHPUnit \Framework \TestCase ;
20
22
use Symfony \Component \Console \Tester \CommandTester ;
@@ -56,6 +58,11 @@ class ConfigSetCommandTest extends TestCase
56
58
*/
57
59
private $ processorFacadeMock ;
58
60
61
+ /**
62
+ * @var LocaleEmulatorInterface|MockObject
63
+ */
64
+ private $ localeEmulatorMock ;
65
+
59
66
/**
60
67
* @inheritdoc
61
68
*/
@@ -76,12 +83,15 @@ protected function setUp(): void
76
83
$ this ->deploymentConfigMock = $ this ->getMockBuilder (DeploymentConfig::class)
77
84
->disableOriginalConstructor ()
78
85
->getMock ();
86
+ $ this ->localeEmulatorMock = $ this ->getMockBuilder (LocaleEmulatorInterface::class)
87
+ ->getMockForAbstractClass ();
79
88
80
89
$ this ->command = new ConfigSetCommand (
81
90
$ this ->emulatedAreProcessorMock ,
82
91
$ this ->changeDetectorMock ,
83
92
$ this ->processorFacadeFactoryMock ,
84
- $ this ->deploymentConfigMock
93
+ $ this ->deploymentConfigMock ,
94
+ $ this ->localeEmulatorMock
85
95
);
86
96
}
87
97
@@ -175,6 +185,12 @@ public function testExecuteWithException()
175
185
->method ('process ' )
176
186
->willThrowException (new ValidatorException (__ ('The "test/test/test" path does not exists ' )));
177
187
188
+ $ this ->localeEmulatorMock ->expects ($ this ->once ())
189
+ ->method ('emulate ' )
190
+ ->willReturnCallback (function ($ function ) {
191
+ return $ function ();
192
+ });
193
+
178
194
$ tester = new CommandTester ($ this ->command );
179
195
$ tester ->execute ([
180
196
ConfigSetCommand::ARG_PATH => 'test/test/test ' ,
0 commit comments