|
1 | 1 | <?php |
2 | 2 | /** |
3 | | - * Copyright © Magento, Inc. All rights reserved. |
4 | | - * See COPYING.txt for license details. |
| 3 | + * Copyright 2021 Adobe |
| 4 | + * All Rights Reserved. |
5 | 5 | */ |
| 6 | +declare(strict_types=1); |
6 | 7 |
|
7 | 8 | namespace Magento\RemoteStorage\Test\Unit\Setup; |
8 | 9 |
|
@@ -33,19 +34,10 @@ class ConfigOptionsListTest extends TestCase |
33 | 34 | */ |
34 | 35 | private $configOptionsList; |
35 | 36 |
|
36 | | - /** |
37 | | - * @return void |
38 | | - * @throws \Magento\Framework\Exception\FileSystemException |
39 | | - */ |
40 | 37 | protected function setUp(): void |
41 | 38 | { |
42 | | - $this->driverFactoryPoolMock = $this->getMockBuilder(DriverFactoryPool::class) |
43 | | - ->disableOriginalConstructor() |
44 | | - ->getMock(); |
45 | | - |
46 | | - $this->loggerMock = $this->getMockBuilder(LoggerInterface::class) |
47 | | - ->disableOriginalConstructor() |
48 | | - ->getMock(); |
| 39 | + $this->driverFactoryPoolMock = $this->createMock(DriverFactoryPool::class); |
| 40 | + $this->loggerMock = $this->createMock(LoggerInterface::class); |
49 | 41 |
|
50 | 42 | $this->configOptionsList = new ConfigOptionsList( |
51 | 43 | $this->driverFactoryPoolMock, |
@@ -299,4 +291,37 @@ public static function createConfigProvider() |
299 | 291 | ], |
300 | 292 | ]; |
301 | 293 | } |
| 294 | + |
| 295 | + /** |
| 296 | + * @dataProvider getOptionsProvider |
| 297 | + * @param string $name |
| 298 | + * @param string $configPath |
| 299 | + * @return void |
| 300 | + */ |
| 301 | + public function testGetOptions(string $name, string $configPath): void |
| 302 | + { |
| 303 | + $options = $this->configOptionsList->getOptions(); |
| 304 | + $optionsMap = array_merge( |
| 305 | + ...array_map(fn ($o) => [$o->getName() => $o->getConfigPath()], $options) |
| 306 | + ); |
| 307 | + $this->assertArrayHasKey($name, $optionsMap); |
| 308 | + $this->assertEquals($configPath, $optionsMap[$name]); |
| 309 | + } |
| 310 | + |
| 311 | + /** |
| 312 | + * @return array[] |
| 313 | + */ |
| 314 | + public static function getOptionsProvider(): array |
| 315 | + { |
| 316 | + return [ |
| 317 | + ['remote-storage-driver', 'remote_storage/driver'], |
| 318 | + ['remote-storage-prefix', 'remote_storage/prefix'], |
| 319 | + ['remote-storage-endpoint', 'remote_storage/config/endpoint'], |
| 320 | + ['remote-storage-bucket', 'remote_storage/config/bucket'], |
| 321 | + ['remote-storage-region', 'remote_storage/config/region'], |
| 322 | + ['remote-storage-key', 'remote_storage/config/credentials/key'], |
| 323 | + ['remote-storage-secret', 'remote_storage/config/credentials/secret'], |
| 324 | + ['remote-storage-path-style', 'remote_storage/config/path_style'], |
| 325 | + ]; |
| 326 | + } |
302 | 327 | } |
0 commit comments