diff --git a/src/Command/CodeStudio/CodeStudioWizardCommand.php b/src/Command/CodeStudio/CodeStudioWizardCommand.php index 8d52052fb..afeea6b30 100644 --- a/src/Command/CodeStudio/CodeStudioWizardCommand.php +++ b/src/Command/CodeStudio/CodeStudioWizardCommand.php @@ -118,6 +118,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int switch ($projectSelected) { case "Drupal_project": $this->setGitLabCiCdVariablesForPhpProject($project, $appUuid, $cloudKey, $cloudSecret, $projectAccessTokenName, $projectAccessToken, $phpVersion); + $this->createScheduledPipeline($project); break; case "Node_project": $parameters = [ @@ -128,7 +129,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->setGitLabCiCdVariablesForNodeProject($project, $appUuid, $cloudKey, $cloudSecret, $projectAccessTokenName, $projectAccessToken, $nodeVersion); break; } - $this->createScheduledPipeline($project); $this->io->success([ "Successfully configured the Code Studio project!", diff --git a/tests/phpunit/src/Commands/CodeStudio/CodeStudioWizardCommandTest.php b/tests/phpunit/src/Commands/CodeStudio/CodeStudioWizardCommandTest.php index 3fce2b9b5..b312847b1 100644 --- a/tests/phpunit/src/Commands/CodeStudio/CodeStudioWizardCommandTest.php +++ b/tests/phpunit/src/Commands/CodeStudio/CodeStudioWizardCommandTest.php @@ -325,25 +325,28 @@ public function testCommand(array $mockedGitlabProjects, array $inputs, array $a ]; $projects->update($this->gitLabProjectId, $parameters)->shouldBeCalled(); } - $schedules = $this->prophet->prophesize(Schedules::class); - $schedules->showAll($this->gitLabProjectId)->willReturn([]); - $pipeline = ['id' => 1]; - $parameters = [ - // Every Thursday at midnight. - 'cron' => '0 0 * * 4', - 'description' => 'Code Studio Automatic Updates', - 'ref' => 'master', - ]; - $schedules->create($this->gitLabProjectId, $parameters)->willReturn($pipeline); - $schedules->addVariable($this->gitLabProjectId, $pipeline['id'], [ - 'key' => 'ACQUIA_JOBS_DEPRECATED_UPDATE', - 'value' => 'true', - ])->shouldBeCalled(); - $schedules->addVariable($this->gitLabProjectId, $pipeline['id'], [ - 'key' => 'ACQUIA_JOBS_COMPOSER_UPDATE', - 'value' => 'true', - ])->shouldBeCalled(); - $gitlabClient->schedules()->willReturn($schedules->reveal()); + else { + $schedules = $this->prophet->prophesize(Schedules::class); + $schedules->showAll($this->gitLabProjectId)->willReturn([]); + $pipeline = ['id' => 1]; + $parameters = [ + // Every Thursday at midnight. + 'cron' => '0 0 * * 4', + 'description' => 'Code Studio Automatic Updates', + 'ref' => 'master', + ]; + $schedules->create($this->gitLabProjectId, $parameters)->willReturn($pipeline); + $schedules->addVariable($this->gitLabProjectId, $pipeline['id'], [ + 'key' => 'ACQUIA_JOBS_DEPRECATED_UPDATE', + 'value' => 'true', + ])->shouldBeCalled(); + $schedules->addVariable($this->gitLabProjectId, $pipeline['id'], [ + 'key' => 'ACQUIA_JOBS_COMPOSER_UPDATE', + 'value' => 'true', + ])->shouldBeCalled(); + $gitlabClient->schedules()->willReturn($schedules->reveal()); + } + $gitlabClient->projects()->willReturn($projects); $this->command->setGitLabClient($gitlabClient->reveal());