Skip to content

Commit 0ee0ff8

Browse files
committed
Appropriate version unit test fix
1 parent a199d79 commit 0ee0ff8

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

src/Config/Validator/Deploy/AppropriateVersion.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function validate(): Validator\ResultInterface
8181
);
8282
}
8383

84-
if (!$this->magentoVersion->satisfies('>= 2.4.7')) {
84+
if (!$this->magentoVersion->isGreaterOrEqual('2.4.7')) {
8585
$variables = [
8686
DeployInterface::VAR_USE_LUA,
8787
DeployInterface::VAR_LUA_KEY,

src/Step/Deploy/PreDeploy/ConfigUpdate/Cache.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,13 @@ public function execute()
131131
$config['cache']['graphql'] = $graphqlConfig;
132132
}
133133

134-
$config['cache']['frontend']['default']['backend_options']['_useLua'] = $luaConfigKey;
135-
$config['cache']['frontend']['default']['backend_options']['use_lua'] = $luaConfig;
134+
if (!empty($luaConfigKey)) {
135+
$config['cache']['frontend']['default']['backend_options']['_useLua'] = $luaConfigKey;
136+
}
137+
138+
if (!empty($luaConfig)) {
139+
$config['cache']['frontend']['default']['backend_options']['use_lua'] = $luaConfig;
140+
}
136141
$this->configWriter->create($config);
137142
} catch (FileSystemException $e) {
138143
throw new StepException($e->getMessage(), Error::DEPLOY_ENV_PHP_IS_NOT_WRITABLE);

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ public function testValidateVersionGreaterTwoDotTwo()
6666
->method('isGreaterOrEqual')
6767
->with('2.2')
6868
->willReturn(true);
69+
$this->magentoVersion->expects($this->once())
70+
->method('isGreaterOrEqual')
71+
->with('2.4.7')
72+
->willReturn(true);
6973
$this->magentoVersion->expects($this->once())
7074
->method('satisfies')
7175
->willReturn(true);
@@ -81,6 +85,10 @@ public function testValidateVersionTwoDotOneAndVariablesNotConfigured()
8185
->method('isGreaterOrEqual')
8286
->with('2.2')
8387
->willReturn(false);
88+
$this->magentoVersion->expects($this->once())
89+
->method('isGreaterOrEqual')
90+
->with('2.4.7')
91+
->willReturn(false);
8492
$this->magentoVersion->expects($this->once())
8593
->method('satisfies')
8694
->willReturn(false);
@@ -97,6 +105,10 @@ public function testValidateVersionTwoDotOneAndAllVariablesAreConfigured()
97105
->method('isGreaterOrEqual')
98106
->with('2.2')
99107
->willReturn(false);
108+
$this->magentoVersion->expects($this->once())
109+
->method('isGreaterOrEqual')
110+
->with('2.4.7')
111+
->willReturn(false);
100112
$this->magentoVersion->expects($this->once())
101113
->method('satisfies')
102114
->willReturn(false);

0 commit comments

Comments
 (0)