Skip to content

Commit

Permalink
GL-2039-1: Fixed functionality for cs:wizard command and corrected te…
Browse files Browse the repository at this point in the history
…stcases accordingly.
  • Loading branch information
akashkska committed Mar 5, 2024
1 parent ea6c782 commit 77c1d33
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/Command/CodeStudio/CodeStudioCiCdVariables.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static function getDefaultsForNode(?string $cloudApplicationUuid = NULL,
],
[
'key' => 'NODE_VERSION',
'masked' => TRUE,
'masked' => FALSE,
'protected' => FALSE,
'value' => $nodeVersion,
'variable_type' => 'env_var',
Expand Down Expand Up @@ -106,7 +106,7 @@ public static function getDefaultsForPhp(?string $cloudApplicationUuid = NULL, ?
],
[
'key' => 'PHP_VERSION',
'masked' => TRUE,
'masked' => FALSE,
'protected' => FALSE,
'value' => $phpVersion,
'variable_type' => 'env_var',
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/src/CommandTestBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ protected function getMockGitLabVariables(): array {
],
2 => [
'key' => 'ACQUIA_CLOUD_API_TOKEN_SECRET',
'masked' => TRUE,
'masked' => FALSE,
'protected' => FALSE,
'value' => 'X1u\/PIQXtYaoeui.4RJSJpGZjwmWYmfl5AUQkAebYE=',
'variable_type' => 'env_var',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,15 @@ public function testGetDefaultsForNode(): void {
}

protected function testBooleanValues(array $variables): void {
foreach ($variables as $variable) {
$maskedValue = $variable['masked'];
$this->assertEquals(TRUE, $maskedValue);
foreach ($variables as $variable ) {
if ($variable['key'] !== "PHP_VERSION" && $variable['key'] !== "NODE_VERSION") {
$maskedValue = $variable['masked'];
$this->assertEquals(TRUE, $maskedValue);
}
else {
$maskedValue = $variable['masked'];
$this->assertEquals(FALSE, $maskedValue);
}
$protectedValue = $variable['protected'];
$this->assertEquals(FALSE, $protectedValue);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -517,9 +517,8 @@ protected function mockGitLabVariables(int $gitlabProjectId, ObjectProphecy $pro
$variables = $this->getMockGitLabVariables();
$projects->variables($gitlabProjectId)->willReturn($variables);
foreach ($variables as $variable) {
$projects->addVariable($this->gitLabProjectId, Argument::type('string'), Argument::type('string'), FALSE, NULL, ['masked' => $variable['masked'], 'variable_type' => $variable['variable_type']])->shouldBeCalled();
$projects->addVariable($gitlabProjectId, Argument::type('string'), Argument::type('string'), Argument::type('bool'), NULL, ['masked' => $variable['masked'], 'variable_type' => $variable['variable_type']])->shouldBeCalled();
}
// $projects->addVariable($gitlabProjectId, Argument::type('string'), Argument::type('string'), Argument::type('bool'), NULL, Argument::type('array'))->shouldBeCalled();
foreach ($variables as $variable) {
$projects->updateVariable($this->gitLabProjectId, $variable['key'], $variable['value'], FALSE, NULL, ['masked' => TRUE, 'variable_type' => 'env_var'])->shouldBeCalled();
}
Expand Down

0 comments on commit 77c1d33

Please sign in to comment.