Skip to content

Commit 8b84ebf

Browse files
committed
fixed unit test
1 parent febffbd commit 8b84ebf

File tree

5 files changed

+15
-11
lines changed

5 files changed

+15
-11
lines changed

src/Test/Unit/Config/Validator/Deploy/ServiceVersionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public function testValidate(): void
126126
$serviceMariaDB->expects($this->once())
127127
->method('getVersion')
128128
->willReturn('10.2');
129-
$this->serviceFactory->expects($this->exactly(6))
129+
$this->serviceFactory->expects($this->exactly(8))
130130
->method('create')
131131
->willReturnOnConsecutiveCalls(
132132
$serviceRmq,
@@ -148,7 +148,7 @@ public function testValidate(): void
148148
['Version of service \'opensearch\' is 1.2', []],
149149
['Version of service \'mariadb\' is 10.2', []]
150150
];
151-
$matcher = $this->exactly(6);
151+
$matcher = $this->exactly(8);
152152
$this->loggerMock->expects($matcher)
153153
->method('info')
154154
// withConsecutive() alternative.

src/Test/Unit/Service/EolValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ public function testValidateServiceEol()
181181
->method('getVersion')
182182
->willReturn('8.0');
183183
// withConsecutive() alternative.
184-
$this->serviceFactoryMock->expects($this->exactly(6))
184+
$this->serviceFactoryMock->expects($this->exactly(8))
185185
->method('create')
186186
->willReturnCallback(fn($param) => match ($param) {
187187
'php' => $service1,

src/Test/Unit/Service/ServiceFactoryTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Magento\MagentoCloud\Service\ElasticSearch;
1414
use Magento\MagentoCloud\Service\RabbitMq;
1515
use Magento\MagentoCloud\Service\Redis;
16+
use Magento\MagentoCloud\Service\Valkey;
1617
use Magento\MagentoCloud\Service\ServiceFactory;
1718
use Magento\MagentoCloud\Service\ServiceInterface;
1819
use Magento\MagentoCloud\Service\ServiceMismatchException;

src/Test/Unit/Step/Deploy/InstallUpdate/ConfigUpdate/Session/ConfigTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ public function testEnvConfigurationMergingValkey(
208208
$this->valkeyMock->expects($this->exactly($valkeyCallTime))
209209
->method('getConfiguration')
210210
->willReturn($valkeyConfig);
211-
$this->redisSessionMock->expects($this->once())
211+
$this->valkeySessionMock->expects($this->once())
212212
->method('getConfiguration')
213213
->willReturn($valkeySessionConfig);
214214
$package = $this->getMockForAbstractClass(PackageInterface::class);
@@ -261,15 +261,15 @@ public function envConfigurationMergingDataProvider(): array
261261
$redisConfig,
262262
1,
263263
$result,
264-
'redis/valkey will be used for session if it was not override by SESSION_CONFIGURATION',
264+
'redis will be used for session if it was not override by SESSION_CONFIGURATION',
265265
],
266266
[
267267
[StageConfigInterface::OPTION_MERGE => true],
268268
[],
269269
$redisConfig,
270270
1,
271271
$result,
272-
'redis/valkey will be used for session if it was not override by SESSION_CONFIGURATION',
272+
'redis will be used for session if it was not override by SESSION_CONFIGURATION',
273273
],
274274
[
275275
[
@@ -280,7 +280,7 @@ public function envConfigurationMergingDataProvider(): array
280280
$redisConfig,
281281
1,
282282
$resultWithMergedKey,
283-
'redis/valkey will be used for session if it was not override by SESSION_CONFIGURATION',
283+
'redis will be used for session if it was not override by SESSION_CONFIGURATION',
284284
],
285285
[
286286
[
@@ -294,7 +294,7 @@ public function envConfigurationMergingDataProvider(): array
294294
$redisConfig,
295295
0,
296296
$resultWithMergedHostAndPort,
297-
'redis-session/valkey-session will be used for session if it was not override by SESSION_CONFIGURATION',
297+
'redis-session will be used for session if it was not override by SESSION_CONFIGURATION',
298298
],
299299
];
300300
}

src/Test/Unit/Step/Deploy/PreDeploy/ConfigUpdate/CacheTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public function testExecute(
133133
) {
134134
$this->magentoVersion->expects($this->any())
135135
->method('isGreaterOrEqual')
136-
->with('2.3.0')
136+
->with($this->anything())
137137
->willReturn($isGreaterOrEqual);
138138
$this->configReaderMock->expects($this->once())
139139
->method('read')
@@ -444,6 +444,9 @@ public function testExecuteRedisService()
444444
$this->step->execute();
445445
}
446446

447+
/**
448+
* @throws StepException
449+
*/
447450
public function testExecuteRedisFailed()
448451
{
449452
$this->prepareMocks(false);
@@ -486,9 +489,9 @@ public function testExecuteMixedBackends()
486489
],
487490
]);
488491

489-
$this->magentoVersion->expects($this->exactly(2))
492+
$this->magentoVersion->expects($this->any())
490493
->method('isGreaterOrEqual')
491-
->with('2.3.0')
494+
->with($this->anything())
492495
->willReturn(true);
493496
$this->socketCreateMock->expects($this->exactly(3))
494497
->with(AF_INET, SOCK_STREAM, SOL_TCP)

0 commit comments

Comments
 (0)