@@ -94,7 +94,7 @@ protected function setUp()
94
94
$ themeList ->expects ($ this ->any ())
95
95
->method ('getThemeByFullPath ' )
96
96
->with ('frontend/magento_theme ' )
97
- ->will ($ this ->returnValue ( $ this -> theme ) );
97
+ ->willReturn ($ this ->theme );
98
98
99
99
$ this ->initFilesystem ();
100
100
@@ -104,32 +104,36 @@ protected function setUp()
104
104
}
105
105
106
106
/**
107
- * @param $origFile
108
- * @param $origPath
109
- * @param $origContent
110
- * @param $isMaterialization
107
+ * @param string $origFile
108
+ * @param string $origPath
109
+ * @param string $origContent
110
+ * @param bool $isMaterialization
111
+ * @param bool $isExist
111
112
*
112
113
* @dataProvider getFileDataProvider
113
114
*/
114
- public function testGetFile ($ origFile , $ origPath , $ origContent , $ isMaterialization )
115
+ public function testGetFile ($ origFile , $ origPath , $ origContent , $ isMaterialization, $ isExist )
115
116
{
116
117
$ filePath = 'some/file.ext ' ;
117
118
$ this ->viewFileResolution ->expects ($ this ->once ())
118
119
->method ('getFile ' )
119
120
->with ('frontend ' , $ this ->theme , 'en_US ' , $ filePath , 'Magento_Module ' )
120
- ->will ( $ this -> returnValue ( $ origFile) );
121
+ ->willReturn ( $ origFile );
121
122
$ this ->rootDirRead ->expects ($ this ->once ())
122
123
->method ('getRelativePath ' )
123
124
->with ($ origFile )
124
- ->will ( $ this -> returnValue ( $ origPath) );
125
+ ->willReturn ( $ origPath );
125
126
$ this ->rootDirRead ->expects ($ this ->once ())
126
127
->method ('readFile ' )
127
128
->with ($ origPath )
128
- ->will ( $ this -> returnValue ( $ origContent) );
129
+ ->willReturn ( $ origContent );
129
130
$ this ->preProcessorPool ->expects ($ this ->once ())
130
131
->method ('process ' )
131
132
->with ($ this ->chain );
132
- if ($ isMaterialization ) {
133
+ $ this ->staticDirRead ->expects ($ this ->any ())
134
+ ->method ('isExist ' )
135
+ ->willReturn ($ isExist );
136
+ if ($ isMaterialization || !$ isExist ) {
133
137
$ this ->chain
134
138
->expects ($ this ->once ())
135
139
->method ('isChanged ' )
@@ -147,13 +151,13 @@ public function testGetFile($origFile, $origPath, $origContent, $isMaterializati
147
151
->with ('view_preprocessed/source/some/file.ext ' , 'processed ' );
148
152
$ this ->varDir ->expects ($ this ->once ())
149
153
->method ('getAbsolutePath ' )
150
- ->with ('view_preprocessed/source/some/file.ext ' )->will ( $ this -> returnValue ( 'result ' ) );
154
+ ->with ('view_preprocessed/source/some/file.ext ' )->willReturn ( 'result ' );
151
155
} else {
152
156
$ this ->varDir ->expects ($ this ->never ())->method ('writeFile ' );
153
157
$ this ->rootDirRead ->expects ($ this ->once ())
154
158
->method ('getAbsolutePath ' )
155
159
->with ('source/some/file.ext ' )
156
- ->will ( $ this -> returnValue ( 'result ' ) );
160
+ ->willReturn ( 'result ' );
157
161
}
158
162
$ this ->assertSame ('result ' , $ this ->object ->getFile ($ this ->getAsset ()));
159
163
}
@@ -197,10 +201,10 @@ public function chainTestCallback(Chain $chain)
197
201
public function getFileDataProvider ()
198
202
{
199
203
return [
200
- ['/root/some/file.ext ' , 'source/some/file.ext ' , 'processed ' , false ],
201
- ['/root/some/file.ext ' , 'source/some/file.ext ' , 'not_processed ' , true ],
202
- ['/root/some/file.ext2 ' , 'source/some/file.ext2 ' , 'processed ' , true ],
203
- ['/root/some/file.ext2 ' , 'source/some/file.ext2 ' , 'not_processed ' , true ],
204
+ ['/root/some/file.ext ' , 'source/some/file.ext ' , 'processed ' , false , true ],
205
+ ['/root/some/file.ext ' , 'source/some/file.ext ' , 'not_processed ' , true , false ],
206
+ ['/root/some/file.ext2 ' , 'source/some/file.ext2 ' , 'processed ' , true , true ],
207
+ ['/root/some/file.ext2 ' , 'source/some/file.ext2 ' , 'not_processed ' , true , false ],
204
208
];
205
209
}
206
210
@@ -219,11 +223,11 @@ protected function initFilesystem()
219
223
220
224
$ this ->filesystem ->expects ($ this ->any ())
221
225
->method ('getDirectoryRead ' )
222
- ->will ( $ this -> returnValueMap ( $ readDirMap) );
226
+ ->willReturnMap ( $ readDirMap );
223
227
$ this ->filesystem ->expects ($ this ->any ())
224
228
->method ('getDirectoryWrite ' )
225
229
->with (DirectoryList::VAR_DIR )
226
- ->will ($ this ->returnValue ( $ this -> varDir ) );
230
+ ->willReturn ($ this ->varDir );
227
231
}
228
232
229
233
/**
@@ -252,19 +256,19 @@ protected function getAsset($isFallback = true)
252
256
$ asset = $ this ->getMock ('Magento\Framework\View\Asset\File ' , [], [], '' , false );
253
257
$ asset ->expects ($ this ->any ())
254
258
->method ('getContext ' )
255
- ->will ( $ this -> returnValue ( $ context) );
259
+ ->willReturn ( $ context );
256
260
$ asset ->expects ($ this ->any ())
257
261
->method ('getFilePath ' )
258
- ->will ( $ this -> returnValue ( 'some/file.ext ' ) );
262
+ ->willReturn ( 'some/file.ext ' );
259
263
$ asset ->expects ($ this ->any ())
260
264
->method ('getPath ' )
261
- ->will ( $ this -> returnValue ( 'some/file.ext ' ) );
265
+ ->willReturn ( 'some/file.ext ' );
262
266
$ asset ->expects ($ this ->any ())
263
267
->method ('getModule ' )
264
- ->will ( $ this -> returnValue ( 'Magento_Module ' ) );
268
+ ->willReturn ( 'Magento_Module ' );
265
269
$ asset ->expects ($ this ->any ())
266
270
->method ('getContentType ' )
267
- ->will ( $ this -> returnValue ( 'ext ' ) );
271
+ ->willReturn ( 'ext ' );
268
272
269
273
return $ asset ;
270
274
}
0 commit comments