17
17
use Magento \Framework \Exception \ConfigurationMismatchException ;
18
18
use Magento \Deploy \Model \DeploymentConfig \Hash ;
19
19
use Magento \Config \App \Config \Type \System ;
20
+ use Magento \Framework \App \Config ;
20
21
use PHPUnit_Framework_MockObject_MockObject as Mock ;
21
22
22
23
/**
@@ -56,6 +57,11 @@ class ProcessorFacadeTest extends \PHPUnit_Framework_TestCase
56
57
*/
57
58
private $ hashMock ;
58
59
60
+ /**
61
+ * @var Config|Mock
62
+ */
63
+ private $ configMock ;
64
+
59
65
/**
60
66
* @inheritdoc
61
67
*/
@@ -79,12 +85,16 @@ protected function setUp()
79
85
$ this ->hashMock = $ this ->getMockBuilder (Hash::class)
80
86
->disableOriginalConstructor ()
81
87
->getMock ();
88
+ $ this ->configMock = $ this ->getMockBuilder (Config::class)
89
+ ->disableOriginalConstructor ()
90
+ ->getMock ();
82
91
83
92
$ this ->model = new ProcessorFacade (
84
93
$ this ->scopeValidatorMock ,
85
94
$ this ->pathValidatorMock ,
86
95
$ this ->configSetProcessorFactoryMock ,
87
- $ this ->hashMock
96
+ $ this ->hashMock ,
97
+ $ this ->configMock
88
98
);
89
99
}
90
100
@@ -106,6 +116,8 @@ public function testProcess()
106
116
$ this ->hashMock ->expects ($ this ->once ())
107
117
->method ('regenerate ' )
108
118
->with (System::CONFIG_TYPE );
119
+ $ this ->configMock ->expects ($ this ->once ())
120
+ ->method ('clean ' );
109
121
110
122
$ this ->assertSame (
111
123
'Value was saved. ' ,
@@ -156,6 +168,8 @@ public function testProcessWithConfigurationMismatchException()
156
168
->willThrowException (new ConfigurationMismatchException (__ ('Some error ' )));
157
169
$ this ->processorMock ->expects ($ this ->never ())
158
170
->method ('process ' );
171
+ $ this ->configMock ->expects ($ this ->never ())
172
+ ->method ('clean ' );
159
173
160
174
$ this ->model ->process ('test/test/test ' , 'test ' , ScopeConfigInterface::SCOPE_TYPE_DEFAULT , null , false );
161
175
}
@@ -180,6 +194,8 @@ public function testProcessWithCouldNotSaveException()
180
194
->method ('process ' )
181
195
->with ('test/test/test ' , 'test ' , ScopeConfigInterface::SCOPE_TYPE_DEFAULT , null )
182
196
->willThrowException (new CouldNotSaveException (__ ('Some error ' )));
197
+ $ this ->configMock ->expects ($ this ->never ())
198
+ ->method ('clean ' );
183
199
184
200
$ this ->model ->process ('test/test/test ' , 'test ' , ScopeConfigInterface::SCOPE_TYPE_DEFAULT , null , false );
185
201
}
@@ -196,6 +212,8 @@ public function testExecuteLock()
196
212
$ this ->processorMock ->expects ($ this ->once ())
197
213
->method ('process ' )
198
214
->with ('test/test/test ' , 'test ' , ScopeConfigInterface::SCOPE_TYPE_DEFAULT , null );
215
+ $ this ->configMock ->expects ($ this ->once ())
216
+ ->method ('clean ' );
199
217
200
218
$ this ->assertSame (
201
219
'Value was saved and locked. ' ,
0 commit comments