Skip to content

Commit a2e458a

Browse files
ISS-33802: update test phpdocs
1 parent c1cefe7 commit a2e458a

File tree

1 file changed

+57
-19
lines changed

1 file changed

+57
-19
lines changed

lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfigTest.php

Lines changed: 57 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
use Magento\Framework\App\DeploymentConfig;
1313
use Magento\Framework\App\DeploymentConfig\Reader;
1414
use Magento\Framework\Config\ConfigOptionsListConstants;
15+
use Magento\Framework\Exception\FileSystemException;
16+
use Magento\Framework\Exception\RuntimeException;
1517
use PHPUnit\Framework\MockObject\MockObject;
1618
use PHPUnit\Framework\TestCase;
1719

@@ -61,7 +63,7 @@ class DeploymentConfigTest extends TestCase
6163
/**
6264
* @var DeploymentConfig
6365
*/
64-
protected $_deploymentConfig;
66+
protected $deploymentConfig;
6567

6668
/**
6769
* @var DeploymentConfig
@@ -82,7 +84,7 @@ public static function setUpBeforeClass(): void
8284
protected function setUp(): void
8385
{
8486
$this->readerMock = $this->createMock(Reader::class);
85-
$this->_deploymentConfig = new DeploymentConfig(
87+
$this->deploymentConfig = new DeploymentConfig(
8688
$this->readerMock,
8789
['test_override' => 'overridden']
8890
);
@@ -92,19 +94,29 @@ protected function setUp(): void
9294
);
9395
}
9496

97+
/**
98+
* @return void
99+
* @throws FileSystemException
100+
* @throws RuntimeException
101+
*/
95102
public function testGetters(): void
96103
{
97104
$this->readerMock->expects($this->any())->method('load')->willReturn(self::$fixture);
98-
$this->assertSame(self::$flattenedFixture, $this->_deploymentConfig->get());
99-
$this->assertSame('scalar_value', $this->_deploymentConfig->getConfigData('configData1'));
100-
$this->assertSame(self::$fixture['configData2'], $this->_deploymentConfig->getConfigData('configData2'));
101-
$this->assertSame(self::$fixture['configData3'], $this->_deploymentConfig->getConfigData('configData3'));
102-
$this->assertSame('', $this->_deploymentConfig->get('configData3'));
103-
$this->assertSame('defaultValue', $this->_deploymentConfig->get('invalid_key', 'defaultValue'));
104-
$this->assertNull($this->_deploymentConfig->getConfigData('invalid_key'));
105-
$this->assertSame('overridden', $this->_deploymentConfig->get('test_override'));
105+
$this->assertSame(self::$flattenedFixture, $this->deploymentConfig->get());
106+
$this->assertSame('scalar_value', $this->deploymentConfig->getConfigData('configData1'));
107+
$this->assertSame(self::$fixture['configData2'], $this->deploymentConfig->getConfigData('configData2'));
108+
$this->assertSame(self::$fixture['configData3'], $this->deploymentConfig->getConfigData('configData3'));
109+
$this->assertSame('', $this->deploymentConfig->get('configData3'));
110+
$this->assertSame('defaultValue', $this->deploymentConfig->get('invalid_key', 'defaultValue'));
111+
$this->assertNull($this->deploymentConfig->getConfigData('invalid_key'));
112+
$this->assertSame('overridden', $this->deploymentConfig->get('test_override'));
106113
}
107114

115+
/**
116+
* @return void
117+
* @throws FileSystemException
118+
* @throws RuntimeException
119+
*/
108120
public function testIsAvailable(): void
109121
{
110122
$this->readerMock->expects($this->once())->method('load')->willReturn(
@@ -116,6 +128,11 @@ public function testIsAvailable(): void
116128
$this->assertTrue($object->isAvailable());
117129
}
118130

131+
/**
132+
* @return void
133+
* @throws FileSystemException
134+
* @throws RuntimeException
135+
*/
119136
public function testNotAvailable(): void
120137
{
121138
$this->readerMock->expects($this->once())->method('load')->willReturn([]);
@@ -125,6 +142,10 @@ public function testNotAvailable(): void
125142

126143
/**
127144
* test if the configuration changes during the same request, the configuration remain the same
145+
*
146+
* @return void
147+
* @throws FileSystemException
148+
* @throws RuntimeException
128149
*/
129150
public function testNotAvailableThenAvailable(): void
130151
{
@@ -135,8 +156,10 @@ public function testNotAvailableThenAvailable(): void
135156
}
136157

137158
/**
138-
* @param array $data
139159
* @dataProvider keyCollisionDataProvider
160+
* @param array $data
161+
* @throws FileSystemException
162+
* @throws RuntimeException
140163
*/
141164
public function testKeyCollision(array $data): void
142165
{
@@ -161,29 +184,44 @@ public function keyCollisionDataProvider(): array
161184
];
162185
}
163186

187+
/**
188+
* @return void
189+
* @throws FileSystemException
190+
* @throws RuntimeException
191+
*/
164192
public function testResetData(): void
165193
{
166194
$this->readerMock->expects($this->once())->method('load')->willReturn(self::$fixture);
167-
$this->assertSame(self::$flattenedFixture, $this->_deploymentConfig->get());
168-
$this->_deploymentConfig->resetData();
195+
$this->assertSame(self::$flattenedFixture, $this->deploymentConfig->get());
196+
$this->deploymentConfig->resetData();
169197
// second time to ensure loader will be invoked only once after reset
170-
$this->assertSame(self::$flattenedFixture, $this->_deploymentConfig->get());
171-
$this->assertSame(self::$flattenedFixture, $this->_deploymentConfig->get());
198+
$this->assertSame(self::$flattenedFixture, $this->deploymentConfig->get());
199+
$this->assertSame(self::$flattenedFixture, $this->deploymentConfig->get());
172200
}
173201

202+
/**
203+
* @return void
204+
* @throws FileSystemException
205+
* @throws RuntimeException
206+
*/
174207
public function testIsDbAvailable(): void
175208
{
176209
$this->readerMock->expects($this->exactly(2))->method('load')->willReturnOnConsecutiveCalls([], ['db' => []]);
177-
$this->assertFalse($this->_deploymentConfig->isDbAvailable());
178-
$this->_deploymentConfig->resetData();
179-
$this->assertTrue($this->_deploymentConfig->isDbAvailable());
210+
$this->assertFalse($this->deploymentConfig->isDbAvailable());
211+
$this->deploymentConfig->resetData();
212+
$this->assertTrue($this->deploymentConfig->isDbAvailable());
180213
}
181214

215+
/**
216+
* @return void
217+
* @throws FileSystemException
218+
* @throws RuntimeException
219+
*/
182220
public function testResetDataOnMissingConfig(): void
183221
{
184222
$this->readerMock->expects($this->once())->method('load')->willReturn(self::$fixture);
185223
$defaultValue = 'some_default_value';
186-
$result = $this->_deploymentConfig->get('missing/key', $defaultValue);
224+
$result = $this->deploymentConfig->get('missing/key', $defaultValue);
187225
$this->assertEquals($defaultValue, $result);
188226
}
189227
}

0 commit comments

Comments
 (0)