@@ -63,7 +63,7 @@ protected function setup(): void
63
63
$ this ->mediaDirectory = $ this ->objectManager ->get (Filesystem::class)
64
64
->getDirectoryWrite (DirectoryList::MEDIA );
65
65
$ this ->mediaDirectory ->create (self ::TEST_DIR );
66
- $ this ->driver = $ this ->objectManager -> get (DriverInterface::class );
66
+ $ this ->driver = $ this ->mediaDirectory -> getDriver ( );
67
67
$ this ->renditionSizeConfig = $ this ->objectManager ->get (Config::class);
68
68
$ config = $ this ->objectManager ->get (ScopeConfigInterface::class);
69
69
$ this ->origConfigValue = $ config ->getValue (
@@ -114,10 +114,9 @@ public static function tearDownAfterClass(): void
114
114
public function testExecute (string $ path , string $ renditionPath ): void
115
115
{
116
116
$ this ->copyImage ($ path );
117
- $ this ->generateRenditions ->execute ([self ::TEST_DIR . '/ ' . $ path ]);
118
- $ expectedRenditionPath = $ this ->mediaDirectory ->getAbsolutePath ($ renditionPath );
119
- list ($ imageWidth , $ imageHeight ) = getimagesize ($ expectedRenditionPath );
120
- $ this ->assertFileExists ($ expectedRenditionPath );
117
+ $ this ->generateRenditions ->execute ([self ::TEST_DIR . $ path ]);
118
+ list ($ imageWidth , $ imageHeight ) = getimagesizefromstring ($ this ->mediaDirectory ->readFile ($ renditionPath ));
119
+ $ this ->assertTrue ($ this ->mediaDirectory ->isExist ($ renditionPath ));
121
120
$ this ->assertLessThanOrEqual (
122
121
$ this ->renditionSizeConfig ->getWidth (),
123
122
$ imageWidth ,
@@ -136,11 +135,11 @@ public function testExecute(string $path, string $renditionPath): void
136
135
*/
137
136
private function copyImage (string $ path ): void
138
137
{
139
- $ imagePath = realpath (__DIR__ . '/../../_files ' . $ path );
140
- $ modifiableFilePath = $ this ->mediaDirectory ->getAbsolutePath (self ::TEST_DIR . $ path );
141
- $ this ->driver ->copy (
142
- $ imagePath ,
143
- $ modifiableFilePath
138
+ $ imagePath = realpath (__DIR__ . '/../../_files/ ' . $ path );
139
+ $ modifiableFilePath = $ this ->mediaDirectory ->getAbsolutePath (self ::TEST_DIR . $ path );
140
+ $ this ->driver ->filePutContents (
141
+ $ modifiableFilePath ,
142
+ file_get_contents ( $ imagePath )
144
143
);
145
144
}
146
145
0 commit comments