Skip to content

Commit

Permalink
GL-2368: Added mock for curl command.
Browse files Browse the repository at this point in the history
  • Loading branch information
akashkska committed Mar 29, 2024
1 parent 9f00e5d commit 5a22697
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/phpunit/src/CommandTestBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,15 @@ protected function mockCreateMySqlDumpOnLocal(ObjectProphecy $localMachineHelper
->shouldBeCalled();
}

protected function mockCurlCommand(ObjectProphecy $localMachineHelper): void {
$localMachineHelper->checkRequiredBinariesExist(["curl"])->shouldBeCalled();
$process = $this->mockProcess();
$process->getOutput()->willReturn('');
$command = $this->getCurlString();

Check failure on line 391 in tests/phpunit/src/CommandTestBase.php

View workflow job for this annotation

GitHub Actions / test (ubuntu-22.04, 8.1, none)

Call to an undefined method Acquia\Cli\Tests\CommandTestBase::getCurlString().

Check failure on line 391 in tests/phpunit/src/CommandTestBase.php

View workflow job for this annotation

GitHub Actions / test (ubuntu-22.04, 8.2, none)

Call to an undefined method Acquia\Cli\Tests\CommandTestBase::getCurlString().

Check failure on line 391 in tests/phpunit/src/CommandTestBase.php

View workflow job for this annotation

GitHub Actions / test (ubuntu-22.04, 8.3, none)

Call to an undefined method Acquia\Cli\Tests\CommandTestBase::getCurlString().
$localMachineHelper->executeFromCmd($command, Argument::type('callable'), NULL, TRUE)->willReturn($process->reveal())
->shouldBeCalled();
}

protected function mockExecutePvExists(
ObjectProphecy $localMachineHelper,
bool $pvExists = TRUE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,10 @@ public function testCommand(array $mockedGitlabProjects, array $inputs, array $a
$this->mockGitlabGetHost($localMachineHelper, $this->gitLabHost);
$this->mockGitlabGetToken($localMachineHelper, $this->gitLabToken, $this->gitLabHost);

if ($inputs[0] == 'y' && $inputs[1] == '1' ) {
$this->mockCurlCommand($localMachineHelper);
}

/** @var Filesystem|ObjectProphecy $fileSystem */
$fileSystem = $this->prophet->prophesize(Filesystem::class);
// Set properties and execute.
Expand Down

0 comments on commit 5a22697

Please sign in to comment.