@@ -29,23 +29,32 @@ public function testProcessFileContent($pathConfig)
29
29
$ imageContent = $ this ->objectManager ->create (
30
30
\Magento \Framework \Api \Data \ImageContentInterface::class
31
31
);
32
+ $ fileExpectedParams = [
33
+ 'type ' => 'image/png ' ,
34
+ 'title ' => 'my_file ' ,
35
+ 'size ' => 212 ,
36
+ 'width ' => 10 ,
37
+ 'height ' => 10 ,
38
+ ];
32
39
$ imageContent ->setName ('my_file ' );
33
40
$ imageContent ->setType ('image/png ' );
34
41
$ imageContent ->setBase64EncodedData ($ this ->getImageContent ());
35
42
$ result = $ model ->processFileContent ($ imageContent );
36
43
37
- $ this ->assertArrayHasKey ('fullpath ' , $ result );
38
- $ this ->assertFileExists ($ result ['fullpath ' ]);
39
-
40
44
/** @var $filesystem \Magento\Framework\Filesystem */
41
45
$ filesystem = $ this ->objectManager ->get (\Magento \Framework \Filesystem::class);
46
+ $ directory = $ filesystem ->getDirectoryRead (DirectoryList::MEDIA );
47
+ $ this ->assertArrayHasKey ('fullpath ' , $ result );
48
+ $ this ->assertEmpty (array_diff_assoc ($ fileExpectedParams , $ result ), 'Some file parameters are not correct ' );
49
+ $ this ->assertTrue ($ directory ->isExist ($ result ['fullpath ' ]));
50
+
42
51
$ this ->assertArrayHasKey ('quote_path ' , $ result );
43
- $ filePath = $ filesystem -> getDirectoryRead (DirectoryList:: MEDIA ) ->getAbsolutePath ($ result ['quote_path ' ]);
44
- $ this ->assertFileExists ( $ filePath );
52
+ $ filePath = $ directory ->getAbsolutePath ($ result ['quote_path ' ]);
53
+ $ this ->assertTrue ( $ directory -> isExist ( $ filePath) );
45
54
46
55
$ this ->assertArrayHasKey ('order_path ' , $ result );
47
- $ filePath = $ filesystem -> getDirectoryRead (DirectoryList:: MEDIA ) ->getAbsolutePath ($ result ['order_path ' ]);
48
- $ this ->assertFileExists ( $ filePath );
56
+ $ filePath = $ directory ->getAbsolutePath ($ result ['order_path ' ]);
57
+ $ this ->assertTrue ( $ directory -> isExist ( $ filePath) );
49
58
}
50
59
51
60
public function pathConfigDataProvider ()
0 commit comments