@@ -76,7 +76,7 @@ public function testProcessCustomerAddressValue()
7676 $ this ->mediaDirectory ->delete ('customer_address ' );
7777 $ this ->mediaDirectory ->create ($ this ->mediaDirectory ->getRelativePath ('customer_address/tmp/ ' ));
7878 $ tmpFilePath = $ this ->mediaDirectory ->getAbsolutePath ('customer_address/tmp/ ' . $ this ->fileName );
79- copy ($ this ->imageFixtureDir . DIRECTORY_SEPARATOR . $ this ->fileName , $ tmpFilePath );
79+ $ this -> copyFile ($ this ->imageFixtureDir . DIRECTORY_SEPARATOR . $ this ->fileName , $ tmpFilePath );
8080
8181 $ imageFile = [
8282 'name ' => $ this ->fileName ,
@@ -106,7 +106,7 @@ public function testProcessCustomerAddressValue()
106106 $ processCustomerAddressValueMethod ->setAccessible (true );
107107 $ actual = $ processCustomerAddressValueMethod ->invoke ($ image , $ imageFile );
108108 $ this ->assertEquals ($ this ->expectedFileName , $ actual );
109- $ this ->assertFileExists ( $ expectedPath );
109+ $ this ->assertTrue ( $ this -> mediaDirectory -> isExist ( $ expectedPath) );
110110 $ this ->assertFileDoesNotExist ($ tmpFilePath );
111111 }
112112
@@ -122,7 +122,7 @@ public function testProcessCustomerValue()
122122 $ this ->mediaDirectory ->delete ('customer ' );
123123 $ this ->mediaDirectory ->create ($ this ->mediaDirectory ->getRelativePath ('customer/tmp/ ' ));
124124 $ tmpFilePath = $ this ->mediaDirectory ->getAbsolutePath ('customer/tmp/ ' . $ this ->fileName );
125- copy ($ this ->imageFixtureDir . DIRECTORY_SEPARATOR . $ this ->fileName , $ tmpFilePath );
125+ $ this -> copyFile ($ this ->imageFixtureDir . DIRECTORY_SEPARATOR . $ this ->fileName , $ tmpFilePath );
126126
127127 $ imageFile = [
128128 'name ' => $ this ->fileName ,
@@ -170,7 +170,7 @@ public function testProcessCustomerInvalidValue()
170170 $ this ->mediaDirectory ->delete ('customer ' );
171171 $ this ->mediaDirectory ->create ($ this ->mediaDirectory ->getRelativePath ('customer/tmp/ ' ));
172172 $ tmpFilePath = $ this ->mediaDirectory ->getAbsolutePath ('customer/tmp/ ' . $ this ->fileName );
173- copy ($ this ->imageFixtureDir . DIRECTORY_SEPARATOR . $ this ->fileName , $ tmpFilePath );
173+ $ this -> copyFile ($ this ->imageFixtureDir . DIRECTORY_SEPARATOR . $ this ->fileName , $ tmpFilePath );
174174
175175 $ imageFile = [
176176 'name ' => $ this ->fileName ,
@@ -214,4 +214,16 @@ public static function tearDownAfterClass(): void
214214 $ mediaDirectory ->delete ('customer ' );
215215 $ mediaDirectory ->delete ('customer_address ' );
216216 }
217+
218+ /**
219+ * @param string $source
220+ * @param string $destination
221+ * @throws FileSystemException
222+ */
223+ private function copyFile (string $ source , string $ destination )
224+ {
225+ $ driver = $ this ->mediaDirectory ->getDriver ();
226+ $ driver ->createDirectory (dirname ($ destination ));
227+ $ driver ->filePutContents ($ destination , file_get_contents ($ source ));
228+ }
217229}
0 commit comments