Skip to content

Commit

Permalink
GL-2039: Resolved review commnets and added testcases.
Browse files Browse the repository at this point in the history
  • Loading branch information
akashkska committed Feb 21, 2024
1 parent 6141704 commit 60bf6c6
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/Command/CodeStudio/CodeStudioWizardCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
'Node_project',
];
$projectSelected = $this->io->choice('Select a project type', $projectType, $projectType[0]);
echo "Selected project is, $projectSelected";

if ($projectSelected == 'Drupal_project') {
$phpVersions = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Acquia\Cli\Tests\Commands\CodeStudio;

use Acquia\Cli\Command\CodeStudio\CodeStudioCiCdVariables;
use Acquia\Cli\Command\CodeStudio\CodeStudioPipelinesMigrateCommand;
use Acquia\Cli\Command\CommandBase;
use Acquia\Cli\Tests\Commands\Ide\IdeRequiredTestTrait;
Expand Down Expand Up @@ -92,7 +91,51 @@ public function testCommand(mixed $mockedGitlabProjects, mixed $inputs, mixed $a
$this->mockRequest('getAccount');
$this->mockGitLabPermissionsRequest($this::$applicationUuid);
$projects = $this->mockGetGitLabProjects($this::$applicationUuid, $this->gitLabProjectId, $mockedGitlabProjects);
$projects->variables($this->gitLabProjectId)->willReturn(CodeStudioCiCdVariables::getDefaultsForPhp());
$gitlabCicdVariables = [
[
'key' => 'ACQUIA_APPLICATION_UUID',
'masked' => TRUE,
'protected' => FALSE,
'value' => NULL,
'variable_type' => 'env_var',
],
[
'key' => 'ACQUIA_CLOUD_API_TOKEN_KEY',
'masked' => TRUE,
'protected' => FALSE,
'value' => NULL,
'variable_type' => 'env_var',
],
[
'key' => 'ACQUIA_CLOUD_API_TOKEN_SECRET',
'masked' => TRUE,
'protected' => FALSE,
'value' => NULL,
'variable_type' => 'env_var',
],
[
'key' => 'ACQUIA_GLAB_TOKEN_NAME',
'masked' => TRUE,
'protected' => FALSE,
'value' => NULL,
'variable_type' => 'env_var',
],
[
'key' => 'ACQUIA_GLAB_TOKEN_SECRET',
'masked' => TRUE,
'protected' => FALSE,
'value' => NULL,
'variable_type' => 'env_var',
],
[
'key' => 'PHP_VERSION',
'masked' => FALSE,
'protected' => FALSE,
'value' => NULL,
'variable_type' => 'env_var',
],
];
$projects->variables($this->gitLabProjectId)->willReturn($gitlabCicdVariables);
$projects->update($this->gitLabProjectId, Argument::type('array'));
$gitlabClient->projects()->willReturn($projects);
$localMachineHelper->getFilesystem()->willReturn(new Filesystem())->shouldBeCalled();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,29 @@ public function providerTestCommand(): array {
$this->key,
// Enter Cloud secret,
$this->secret,
// Select a project type Drupal_project
'0',
// Select PHP version 8.1
'0',
// Do you want to continue?
'y',
],
// Args
[],
],
[
// No projects.
[],
// Inputs
[
// 'Would you like to create a new Code Studio project?
'y',
// Enter Cloud Key
$this->key,
// Enter Cloud secret,
$this->secret,
// Select a project type Node_project
'1',
// Select PHP version 8.1
'0',
// Do you want to continue?
Expand All @@ -176,6 +199,29 @@ public function providerTestCommand(): array {
$this->key,
// Enter Cloud secret,
$this->secret,
// Select a project type Drupal_project
'0',
// Select PHP version 8.2
'1',
// Do you want to continue?
'y',
],
// Args
[],
],
[
// No projects.
[],
// Inputs
[
// 'Would you like to create a new Code Studio project?
'y',
// Enter Cloud Key
$this->key,
// Enter Cloud secret,
$this->secret,
// Select a project type Node_project
'1',
// Select PHP version 8.2
'1',
// Do you want to continue?
Expand Down

0 comments on commit 60bf6c6

Please sign in to comment.