24 private $mediaDirectory;
29 private $fullDirectoryPath;
34 private $dirName=
'NewDirectory';
44 private $imagesHelper;
49 protected function setUp()
55 $this->mediaDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::MEDIA);
56 $this->fullDirectoryPath = $this->imagesHelper->getStorageRoot();
67 $this->model->getRequest()->setMethod(
'POST')
68 ->setPostValue(
'name', $this->dirName);
69 $this->model->getStorage()->getSession()->setCurrentPath($this->fullDirectoryPath);
70 $this->model->execute();
73 $this->mediaDirectory->isExist(
74 $this->mediaDirectory->getRelativePath(
75 $this->fullDirectoryPath . DIRECTORY_SEPARATOR . $this->dirName
88 $linkedDirectoryPath = $this->filesystem->getDirectoryRead(DirectoryList::PUB)
89 ->getAbsolutePath() .
'linked_media';
90 $this->model->getRequest()->setMethod(
'POST')
91 ->setPostValue(
'name', $this->dirName);
92 $this->model->getStorage()
94 ->setCurrentPath($this->fullDirectoryPath . DIRECTORY_SEPARATOR .
'wysiwyg');
95 $this->model->execute();
97 $this->assertTrue(
is_dir($linkedDirectoryPath . DIRECTORY_SEPARATOR . $this->dirName));
109 $this->model->getRequest()->setMethod(
'POST')
110 ->setPostValue(
'name', $this->dirName);
111 $this->model->getStorage()->getSession()->setCurrentPath($this->fullDirectoryPath .
$dirPath);
112 $this->model->execute();
114 $this->assertFileNotExists(
115 $this->fullDirectoryPath .
$dirPath . $this->dirName
122 public static function tearDownAfterClass()
125 ->get(\
Magento\Framework\Filesystem::class);
127 $directory = $filesystem->getDirectoryWrite(DirectoryList::MEDIA);
128 if ($directory->isExist(
'wysiwyg')) {
129 $directory->delete(
'wysiwyg');
testExecuteWithWrongPath()
testExecuteWithLinkedMedia()
static getObjectManager()