File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
app/code/Magento/Theme/Test/Unit/Model/Design/Backend Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -282,4 +282,35 @@ public function testBeforeSaveWithExistingFile()
282
282
$ this ->fileBackend ->getValue ()
283
283
);
284
284
}
285
+
286
+ /**
287
+ * Test for getRelativeMediaPath method.
288
+ *
289
+ * @param string $path
290
+ * @param string $filename
291
+ * @dataProvider getRelativeMediaPathDataProvider
292
+ */
293
+ public function testGetRelativeMediaPath (string $ path , string $ filename )
294
+ {
295
+ $ reflection = new \ReflectionClass ($ this ->fileBackend );
296
+ $ method = $ reflection ->getMethod ('getRelativeMediaPath ' );
297
+ $ method ->setAccessible (true );
298
+ $ this ->assertEquals (
299
+ $ filename ,
300
+ $ method ->invoke ($ this ->fileBackend , $ path . $ filename )
301
+ );
302
+ }
303
+
304
+ /**
305
+ * Data provider for testGetRelativeMediaPath.
306
+ *
307
+ * @return array
308
+ */
309
+ public function getRelativeMediaPathDataProvider (): array
310
+ {
311
+ return [
312
+ 'Normal path ' => ['pub/media/ ' , 'filename.jpg ' ],
313
+ 'Complex path ' => ['somepath/pub/media/ ' , 'filename.jpg ' ],
314
+ ];
315
+ }
285
316
}
You can’t perform that action at this time.
0 commit comments