@@ -76,7 +76,7 @@ public function testProcessCustomerAddressValue()
76
76
$ this ->mediaDirectory ->delete ('customer_address ' );
77
77
$ this ->mediaDirectory ->create ($ this ->mediaDirectory ->getRelativePath ('customer_address/tmp/ ' ));
78
78
$ 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 );
80
80
81
81
$ imageFile = [
82
82
'name ' => $ this ->fileName ,
@@ -106,7 +106,7 @@ public function testProcessCustomerAddressValue()
106
106
$ processCustomerAddressValueMethod ->setAccessible (true );
107
107
$ actual = $ processCustomerAddressValueMethod ->invoke ($ image , $ imageFile );
108
108
$ this ->assertEquals ($ this ->expectedFileName , $ actual );
109
- $ this ->assertFileExists ( $ expectedPath );
109
+ $ this ->assertTrue ( $ this -> mediaDirectory -> isExist ( $ expectedPath) );
110
110
$ this ->assertFileDoesNotExist ($ tmpFilePath );
111
111
}
112
112
@@ -122,7 +122,7 @@ public function testProcessCustomerValue()
122
122
$ this ->mediaDirectory ->delete ('customer ' );
123
123
$ this ->mediaDirectory ->create ($ this ->mediaDirectory ->getRelativePath ('customer/tmp/ ' ));
124
124
$ 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 );
126
126
127
127
$ imageFile = [
128
128
'name ' => $ this ->fileName ,
@@ -170,7 +170,7 @@ public function testProcessCustomerInvalidValue()
170
170
$ this ->mediaDirectory ->delete ('customer ' );
171
171
$ this ->mediaDirectory ->create ($ this ->mediaDirectory ->getRelativePath ('customer/tmp/ ' ));
172
172
$ 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 );
174
174
175
175
$ imageFile = [
176
176
'name ' => $ this ->fileName ,
@@ -214,4 +214,16 @@ public static function tearDownAfterClass(): void
214
214
$ mediaDirectory ->delete ('customer ' );
215
215
$ mediaDirectory ->delete ('customer_address ' );
216
216
}
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
+ }
217
229
}
0 commit comments