diff --git a/src/Command/CodeStudio/CodeStudioWizardCommand.php b/src/Command/CodeStudio/CodeStudioWizardCommand.php index 2c6032e1e..337827a2c 100644 --- a/src/Command/CodeStudio/CodeStudioWizardCommand.php +++ b/src/Command/CodeStudio/CodeStudioWizardCommand.php @@ -44,10 +44,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->reAuthenticate($cloudKey, $cloudSecret, $this->cloudCredentials->getBaseUri(), $this->cloudCredentials->getAccountsUri()); $phpVersion = NULL; $nodeVersion = NULL; - $projectType = [ - 'Drupal_project', - 'Node_project', - ]; + $projectType = $this->getListOfProjectType(); $projectSelected = $this->io->choice('Select a project type', $projectType, $projectType[0]); switch ($projectSelected) { @@ -168,6 +165,17 @@ private function getGitLabProjectAccessTokenByName(array $project, string $name) return NULL; } + /** + * @return array|null ? + */ + private function getListOfProjectType(): ?array { + $array = [ + 'Drupal_project', + 'Node_project', + ]; + return $array; + } + private function createProjectAccessToken(array $project, string $projectAccessTokenName): string { $this->io->writeln("Creating project access token..."); diff --git a/tests/phpunit/src/CommandTestBase.php b/tests/phpunit/src/CommandTestBase.php index 1a86adc6e..ccc940049 100644 --- a/tests/phpunit/src/CommandTestBase.php +++ b/tests/phpunit/src/CommandTestBase.php @@ -669,6 +669,16 @@ protected function getMockGitLabVariables(): array { ]; } + /** + * @return array + */ + protected function getMockProjectTypeValue(): array { + return [ + 'Drupal_project', + 'Node_project', + ]; + } + /** * Normalize strings for Windows tests. * diff --git a/tests/phpunit/src/Commands/CodeStudio/CodeStudioWizardCommandTest.php b/tests/phpunit/src/Commands/CodeStudio/CodeStudioWizardCommandTest.php index 5a2b4379f..7fd83c528 100644 --- a/tests/phpunit/src/Commands/CodeStudio/CodeStudioWizardCommandTest.php +++ b/tests/phpunit/src/Commands/CodeStudio/CodeStudioWizardCommandTest.php @@ -302,7 +302,7 @@ public function testCommand(array $mockedGitlabProjects, array $inputs, array $a /** @var Filesystem|ObjectProphecy $fileSystem */ $fileSystem = $this->prophet->prophesize(Filesystem::class); - + $this->mockGitlabProjectType($this->gitLabProjectId); // Set properties and execute. $this->executeCommand($args, $inputs); @@ -462,6 +462,11 @@ protected function mockGitLabNamespaces(ObjectProphecy $gitlabClient): void { $gitlabClient->namespaces()->willReturn($namespaces->reveal()); } + protected function mockGitlabProjectType(int $gitlabProjectId): void { + $projectType = $this->getMockProjectTypeValue(); + $this->assertCount(2, $projectType); + } + protected function mockGitLabVariables(int $gitlabProjectId, ObjectProphecy $projects): void { $variables = $this->getMockGitLabVariables(); $projects->variables($gitlabProjectId)->willReturn($variables);