Skip to content

Commit 1d4fb71

Browse files
committed
#AC-10721::Investigate the league/flysystem Composer dependencies upgrading to latest version- fixes for mftf and unit case
1 parent bfa3d56 commit 1d4fb71

File tree

7 files changed

+36
-13
lines changed

7 files changed

+36
-13
lines changed

app/code/Magento/AwsS3/Driver/AwsS3.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,29 @@ public function isExists($path): bool
154154
}
155155
}
156156

157+
/**
158+
* @inheritDoc
159+
*/
160+
public function isDirectoryExists($path): bool
161+
{
162+
if ($path === '/') {
163+
return true;
164+
}
165+
166+
$path = $this->normalizeRelativePath($path, true);
167+
168+
if (!$path) {
169+
return true;
170+
}
171+
172+
try {
173+
return $this->adapter->directoryExists($path);
174+
} catch (FlysystemFilesystemException $e) {
175+
$this->logger->error($e->getMessage());
176+
return false;
177+
}
178+
}
179+
157180
/**
158181
* @inheritDoc
159182
*/

app/code/Magento/AwsS3/Test/Mftf/Helper/S3FileAssertions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public function assertGlobbedFileExists($path, $pattern, $message = ''): void
199199
*/
200200
public function assertDirectoryExists($path, $message = ''): void
201201
{
202-
$this->assertTrue($this->driver->isDirectory($path), "Failed asserting $path exists. " . $message);
202+
$this->assertTrue($this->driver->isDirectoryExists($path), "Failed asserting $path exists. " . $message);
203203
}
204204

205205
/**

app/code/Magento/AwsS3/Test/Mftf/Test/AdminAwsS3MediaGalleryDeleteFolderTest.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616
<description value="Verify that when a user deletes a folder in Media Gallery that the directory gets
1717
deleted in S3 and in the local file system."/>
1818
<severity value="CRITICAL"/>
19-
<skip>
20-
<issueId value="Skipping the test to check build time." />
21-
</skip>
2219
<group value="remote_storage_aws_s3_media_gallery_ui"/>
2320
</annotations>
2421

app/code/Magento/AwsS3/Test/Mftf/Test/AdminAwsS3MediaGalleryDeleteImageTest.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616
<description value="Verify that when a user deletes an image in Media Gallery that the image gets deleted
1717
in S3 and in the local file system."/>
1818
<severity value="CRITICAL"/>
19-
<skip>
20-
<issueId value="Skipping the test to check build time." />
21-
</skip>
2219
<group value="remote_storage_aws_s3_media_gallery_ui"/>
2320
</annotations>
2421

app/code/Magento/AwsS3/Test/Unit/Driver/AwsS3Test.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -432,15 +432,15 @@ public function testSearchDirectory(): void
432432
$expression = '/*';
433433
$path = 'path';
434434
$subPaths = [
435-
new \League\Flysystem\DirectoryAttributes('path/1'),
436-
new \League\Flysystem\DirectoryAttributes('path/2')
435+
new \League\Flysystem\DirectoryAttributes('path/1/'),
436+
new \League\Flysystem\DirectoryAttributes('path/2/')
437437
];
438-
$expectedResult = [self::URL . 'path/1', self::URL . 'path/2'];
438+
$expectedResult = [self::URL . 'path/1/', self::URL . 'path/2/'];
439439
$this->metadataProviderMock->expects(self::any())->method('getMetadata')
440440
->willReturnMap([
441441
['path', ['type' => AwsS3::TYPE_DIR]],
442-
['path/1', ['type' => AwsS3::TYPE_FILE]],
443-
['path/2', ['type' => AwsS3::TYPE_FILE]],
442+
['path/1', ['type' => AwsS3::TYPE_DIR]],
443+
['path/2', ['type' => AwsS3::TYPE_DIR]],
444444
]);
445445
$this->adapterMock->expects(self::atLeastOnce())->method('listContents')
446446
->willReturn(new \ArrayIterator($subPaths));

app/code/Magento/RemoteStorage/Driver/Adapter/Cache/Generic.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public function storeDirNotExists(string $path): void
118118
];
119119
$this->cacheData[$path] = $object;
120120
$this->cacheAdapter->save(
121-
$this->serializer->serialize([$path => $object]),
121+
$this->serializer->serialize([$path => $this->cacheData[$path]]),
122122
$this->prefix . $path,
123123
[self::CACHE_TAG]
124124
);

lib/internal/Magento/Framework/Filesystem/ExtendedDriverInterface.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,10 @@ interface ExtendedDriverInterface extends DriverInterface
4747
* @deprecated Method will be moved to DriverInterface
4848
*/
4949
public function getMetadata(string $path): array;
50+
51+
/**
52+
* @param $path
53+
* @return bool
54+
*/
55+
public function isDirectoryExists($path): bool;
5056
}

0 commit comments

Comments
 (0)