Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function execute(array $paths): void
//phpcs:ignore Magento2.Functions.DiscouragedFunction
$name = basename($path);
//phpcs:ignore Magento2.Functions.DiscouragedFunction
$folder = str_replace($name, '', $path);
$folder = substr($path, 0, strrpos($path, $name));

$this->storage->createDirectory(
$name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,24 @@ public function notAllowedPathsProvider(): array
];
}

/**
* Test create child directory with the same name as parent
*/
public function testCreateChildDirectoryTheSameNameAsParentDirectory(): void
{
$dir = self::TEST_DIRECTORY_NAME;
$childPath = $dir . '/' . $dir;

$this->createByPaths->execute([$dir]);
$this->assertFileExists($this->mediaDirectoryPath . $dir);
$this->createByPaths->execute([$childPath]);
$this->assertFileExists($this->mediaDirectoryPath . $childPath);
}

/**
* @throws \Magento\Framework\Exception\FileSystemException
*/
public static function tearDownAfterClass()
protected function tearDown()
{
$filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
->get(\Magento\Framework\Filesystem::class);
Expand Down