@@ -36,7 +36,7 @@ class UpdateHandlerTest extends \PHPUnit\Framework\TestCase
36
36
/**
37
37
* @var WriteInterface
38
38
*/
39
- private $ rootDirectory ;
39
+ private $ mediaDirectory ;
40
40
41
41
/**
42
42
* @var Filesystem
@@ -53,21 +53,21 @@ class UpdateHandlerTest extends \PHPUnit\Framework\TestCase
53
53
*/
54
54
protected function setUp ()
55
55
{
56
- $ this ->fileName = 'test .txt ' ;
56
+ $ this ->fileName = 'image .txt ' ;
57
57
58
58
$ this ->objectManager = Bootstrap::getObjectManager ();
59
59
$ this ->updateHandler = $ this ->objectManager ->create (UpdateHandler::class);
60
60
$ this ->filesystem = $ this ->objectManager ->get (Filesystem::class);
61
- $ this ->rootDirectory = $ this ->filesystem ->getDirectoryWrite (DirectoryList::ROOT );
62
- $ this ->rootDirectory ->writeFile ($ this ->rootDirectory -> getAbsolutePath ($ this ->fileName ), 'Test ' );
61
+ $ this ->mediaDirectory = $ this ->filesystem ->getDirectoryWrite (DirectoryList::MEDIA );
62
+ $ this ->mediaDirectory ->writeFile ($ this ->mediaDirectory -> getRelativePath ($ this ->fileName ), 'Test ' );
63
63
}
64
64
65
65
/**
66
66
* @return void
67
67
*/
68
68
public function testExecuteWithIllegalFilename (): void
69
69
{
70
- $ filePath = str_repeat ('/.. ' , 9 ) . ' / ' . $ this ->fileName ;
70
+ $ filePath = str_repeat ('/.. ' , 2 ) . DIRECTORY_SEPARATOR . $ this ->fileName ;
71
71
72
72
/** @var $product Product */
73
73
$ product = Bootstrap::getObjectManager ()->create (Product::class);
@@ -87,14 +87,14 @@ public function testExecuteWithIllegalFilename(): void
87
87
);
88
88
89
89
$ this ->updateHandler ->execute ($ product );
90
- $ this ->assertFileExists ($ this ->rootDirectory ->getAbsolutePath ($ this ->fileName ));
90
+ $ this ->assertFileExists ($ this ->mediaDirectory ->getAbsolutePath ($ this ->fileName ));
91
91
}
92
92
93
93
/**
94
94
* @return void
95
95
*/
96
96
protected function tearDown (): void
97
97
{
98
- $ this ->rootDirectory ->getDriver ()->deleteFile ($ this ->rootDirectory ->getAbsolutePath ($ this ->fileName ));
98
+ $ this ->mediaDirectory ->getDriver ()->deleteFile ($ this ->mediaDirectory ->getAbsolutePath ($ this ->fileName ));
99
99
}
100
100
}
0 commit comments