Skip to content

Commit 5b91354

Browse files
committed
#AC10721-changes in the implementation to remove the extra directoryexist check on mftf tests s3assertion file as it is not required
1 parent 6b6c479 commit 5b91354

File tree

6 files changed

+13
-73
lines changed

6 files changed

+13
-73
lines changed

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

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
use Magento\Framework\Phrase;
2121
use Magento\RemoteStorage\Driver\Adapter\MetadataProviderInterface;
2222
use Magento\RemoteStorage\Driver\DriverException;
23-
use Magento\RemoteStorage\Driver\ExtendedRemoteDriverInterface;
23+
use Magento\RemoteStorage\Driver\RemoteDriverInterface;
2424
use Psr\Log\LoggerInterface;
2525
use Throwable;
2626

@@ -30,7 +30,7 @@
3030
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
3131
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
3232
*/
33-
class AwsS3 implements ExtendedRemoteDriverInterface
33+
class AwsS3 implements RemoteDriverInterface
3434
{
3535
public const TYPE_DIR = 'dir';
3636
public const TYPE_FILE = 'file';
@@ -154,35 +154,6 @@ 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-
$pathStats = $this->stat($path);
173-
174-
if ($pathStats['type'] == self::TYPE_DIR) {
175-
try {
176-
return $this->adapter->directoryExists($path);
177-
} catch (FlysystemFilesystemException $e) {
178-
$this->logger->error($e->getMessage());
179-
return false;
180-
}
181-
}
182-
183-
return false; // Return false if the path is not a directory
184-
}
185-
186157
/**
187158
* @inheritDoc
188159
*/

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@
1616
use Magento\RemoteStorage\Driver\Adapter\MetadataProviderInterfaceFactory;
1717
use Magento\RemoteStorage\Driver\DriverException;
1818
use Magento\RemoteStorage\Driver\DriverFactoryInterface;
19-
use Magento\RemoteStorage\Driver\ExtendedRemoteDriverInterface;
19+
use Magento\RemoteStorage\Driver\RemoteDriverInterface;
2020
use Magento\RemoteStorage\Model\Config;
2121

2222
/**
2323
* Creates a pre-configured instance of AWS S3 driver.
24-
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2524
*/
2625
class AwsS3Factory implements DriverFactoryInterface
2726
{
@@ -91,7 +90,7 @@ public function __construct(
9190
/**
9291
* @inheritDoc
9392
*/
94-
public function create(): ExtendedRemoteDriverInterface
93+
public function create(): RemoteDriverInterface
9594
{
9695
try {
9796
return $this->createConfigured(
@@ -142,7 +141,7 @@ public function createConfigured(
142141
string $prefix,
143142
string $cacheAdapter = '',
144143
array $cacheConfig = []
145-
): ExtendedRemoteDriverInterface {
144+
): RemoteDriverInterface {
146145
$config = $this->prepareConfig($config);
147146
$client = new S3Client($config);
148147
$adapter = new AwsS3V3Adapter($client, $config['bucket'], $prefix);

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

Lines changed: 2 additions & 2 deletions
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->isDirectoryExists($path), "Failed asserting $path exists. " . $message);
202+
$this->assertTrue($this->driver->isDirectory($path), "Failed asserting $path exists. " . $message);
203203
}
204204

205205
/**
@@ -213,7 +213,7 @@ public function assertDirectoryExists($path, $message = ''): void
213213
*/
214214
public function assertDirectoryDoesNotExist($path, $message = ''): void
215215
{
216-
$this->assertFalse($this->driver->isDirectoryExists($path), "Failed asserting $path does not exist. " . $message);
216+
$this->assertFalse($this->driver->isDirectory($path), "Failed asserting $path does not exist. " . $message);
217217
}
218218

219219
/**

app/code/Magento/RemoteStorage/Driver/DriverFactoryInterface.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ interface DriverFactoryInterface
1616
/**
1717
* Creates driver from stored config.
1818
*
19-
* @return ExtendedRemoteDriverInterface
19+
* @return RemoteDriverInterface
2020
*
2121
* @throws DriverException
2222
*/
23-
public function create(): ExtendedRemoteDriverInterface;
23+
public function create(): RemoteDriverInterface;
2424

2525
/**
2626
* Creates driver from config.
@@ -29,7 +29,7 @@ public function create(): ExtendedRemoteDriverInterface;
2929
* @param string $prefix
3030
* @param string $cacheAdapter
3131
* @param array $cacheConfig
32-
* @return ExtendedRemoteDriverInterface
32+
* @return RemoteDriverInterface
3333
*
3434
* @throws DriverException
3535
*/
@@ -38,5 +38,5 @@ public function createConfigured(
3838
string $prefix,
3939
string $cacheAdapter = '',
4040
array $cacheConfig = []
41-
): ExtendedRemoteDriverInterface;
41+
): RemoteDriverInterface;
4242
}

app/code/Magento/RemoteStorage/Driver/ExtendedRemoteDriverInterface.php

Lines changed: 0 additions & 30 deletions
This file was deleted.

app/code/Magento/RemoteStorage/Test/Unit/Setup/ConfigOptionsListTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use Magento\Framework\Exception\LocalizedException;
1111
use Magento\RemoteStorage\Driver\DriverFactoryInterface;
1212
use Magento\RemoteStorage\Driver\DriverFactoryPool;
13-
use Magento\RemoteStorage\Driver\ExtendedRemoteDriverInterface;
13+
use Magento\RemoteStorage\Driver\RemoteDriverInterface;
1414
use Magento\RemoteStorage\Setup\ConfigOptionsList;
1515
use PHPUnit\Framework\MockObject\MockObject;
1616
use PHPUnit\Framework\TestCase;
@@ -86,7 +86,7 @@ public function testValidate(array $input, bool $isDeploymentConfigExists, array
8686
->with($input['remote-storage-driver'])
8787
->willReturn($driverFactoryMock);
8888

89-
$remoteDriverMock = $this->getMockBuilder(ExtendedRemoteDriverInterface::class)
89+
$remoteDriverMock = $this->getMockBuilder(RemoteDriverInterface::class)
9090
->disableOriginalConstructor()
9191
->getMock();
9292

0 commit comments

Comments
 (0)