19
19
20
20
/**
21
21
* Test for CreateDirectoriesByPathsInterface
22
+ *
23
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
22
24
*/
23
25
class CreateByPathsTest extends \PHPUnit \Framework \TestCase
24
26
{
@@ -38,6 +40,9 @@ class CreateByPathsTest extends \PHPUnit\Framework\TestCase
38
40
/**
39
41
* Absolute path to the media directory
40
42
*/
43
+ /**
44
+ * @var \Magento\Framework\Filesystem\Directory\ReadInterface
45
+ */
41
46
private $ mediaDirectoryPath ;
42
47
43
48
/**
@@ -106,9 +111,9 @@ protected function tearDown(): void
106
111
public function testCreateDirectory (): void
107
112
{
108
113
$ this ->createByPaths ->execute ([self ::TEST_DIRECTORY_NAME ]);
109
- $ this ->assertFileExists ($ this ->mediaDirectoryPath . self ::TEST_DIRECTORY_NAME );
114
+ $ this ->assertTrue ($ this ->mediaDirectory -> isExist ( $ this -> mediaDirectoryPath . self ::TEST_DIRECTORY_NAME ) );
110
115
$ this ->deleteByPaths ->execute ([self ::TEST_DIRECTORY_NAME ]);
111
- $ this ->assertFileDoesNotExist ($ this ->mediaDirectoryPath . self ::TEST_DIRECTORY_NAME );
116
+ $ this ->assertFalse ($ this ->mediaDirectory -> isExist ( $ this -> mediaDirectoryPath . self ::TEST_DIRECTORY_NAME ) );
112
117
}
113
118
114
119
/**
@@ -152,11 +157,11 @@ public function testCreateChildDirectoryTheSameNameAsParentDirectory(): void
152
157
$ childPath = $ dir . '/testCreateDirectory ' ;
153
158
154
159
$ this ->createByPaths ->execute ([$ dir ]);
155
- $ this ->assertFileExists ($ this ->mediaDirectoryPath . $ dir );
160
+ $ this ->assertTrue ($ this ->mediaDirectory -> isExist ( $ this -> mediaDirectoryPath . $ dir) );
156
161
$ this ->createByPaths ->execute ([$ childPath ]);
157
- $ this ->assertFileExists ($ this ->mediaDirectoryPath . $ childPath );
162
+ $ this ->assertTrue ($ this ->mediaDirectory -> isExist ( $ this -> mediaDirectoryPath . $ childPath) );
158
163
$ this ->deleteByPaths ->execute ([$ dir ]);
159
- $ this ->assertFileDoesNotExist ($ this ->mediaDirectoryPath . $ dir );
164
+ $ this ->assertFalse ($ this ->mediaDirectory -> isExist ( $ this -> mediaDirectoryPath . $ dir) );
160
165
}
161
166
162
167
/**
@@ -167,7 +172,7 @@ public function testCreateDirectoryThatAlreadyExist(): void
167
172
$ this ->expectException (CouldNotSaveException::class);
168
173
169
174
$ this ->createByPaths ->execute ([self ::TEST_DIRECTORY_NAME ]);
170
- $ this ->assertFileExists ($ this ->mediaDirectoryPath . self ::TEST_DIRECTORY_NAME );
175
+ $ this ->assertTrue ($ this ->mediaDirectory -> isExist ( $ this -> mediaDirectoryPath . self ::TEST_DIRECTORY_NAME ) );
171
176
$ this ->createByPaths ->execute ([self ::TEST_DIRECTORY_NAME ]);
172
177
}
173
178
0 commit comments