-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
127 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
namespace TYPO3\Surf\Tests\Unit\Command; | ||
|
||
/* | ||
* This file is part of TYPO3 Surf. | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Symfony\Component\Console\Tester\CommandTester; | ||
use TYPO3\Surf\Command\RollbackCommand; | ||
use TYPO3\Surf\Domain\Model\Deployment; | ||
use TYPO3\Surf\Integration\FactoryInterface; | ||
|
||
class RollbackCommandTest extends TestCase | ||
{ | ||
/** | ||
* @test | ||
*/ | ||
public function executeSuccessfully(): void | ||
{ | ||
$deployment = $this->prophesize(Deployment::class); | ||
$deployment->getStatus()->willReturn(Deployment::STATUS_SUCCESS)->shouldBeCalledOnce(); | ||
$deployment->rollback(false)->shouldBeCalledOnce(); | ||
$factory = $this->prophesize(FactoryInterface::class); | ||
$factory->getDeployment('foo', '.surf', false, false)->willReturn($deployment); | ||
$command = new RollbackCommand($factory->reveal()); | ||
$commandTester = new CommandTester($command); | ||
$commandTester->execute(['deploymentName' => 'foo', '--configurationPath' => '.surf', '--simulate' => false]); | ||
|
||
$this->assertEquals('', $commandTester->getDisplay()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
namespace TYPO3\Surf\Tests\Unit\Command; | ||
|
||
/* | ||
* This file is part of TYPO3 Surf. | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Symfony\Component\Console\Tester\CommandTester; | ||
use TYPO3\Surf\Command\ShowCommand; | ||
use TYPO3\Surf\Integration\FactoryInterface; | ||
|
||
class ShowCommandTest extends TestCase | ||
{ | ||
/** | ||
* @test | ||
*/ | ||
public function executeSuccessfully(): void | ||
{ | ||
$factory = $this->prophesize(FactoryInterface::class); | ||
$factory->getDeploymentNames('.surf')->willReturn(['foo', 'bar', 'baz']); | ||
$factory->getDeploymentsBasePath('.surf')->willReturn('./surf'); | ||
$command = new ShowCommand($factory->reveal()); | ||
$commandTester = new CommandTester($command); | ||
$commandTester->execute(['--configurationPath' => '.surf']); | ||
|
||
$this->assertEquals(' | ||
<u>Deployments in "./surf":</u> | ||
foo | ||
bar | ||
baz | ||
', $commandTester->getDisplay()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace TYPO3\Surf\Tests\Unit\Command; | ||
|
||
/* | ||
* This file is part of TYPO3 Surf. | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Symfony\Component\Console\Tester\CommandTester; | ||
use TYPO3\Surf\Command\SimulateCommand; | ||
use TYPO3\Surf\Domain\Model\Deployment; | ||
use TYPO3\Surf\Integration\FactoryInterface; | ||
|
||
class SimulateCommandTest extends TestCase | ||
{ | ||
/** | ||
* @test | ||
*/ | ||
public function executeSuccessfully(): void | ||
{ | ||
$deployment = $this->prophesize(Deployment::class); | ||
$deployment->getStatus()->willReturn(Deployment::STATUS_SUCCESS)->shouldBeCalledOnce(); | ||
$deployment->simulate()->shouldBeCalledOnce(); | ||
|
||
$factory = $this->prophesize(FactoryInterface::class); | ||
$factory->getDeployment('foo', '.surf', true, true, true)->willReturn($deployment); | ||
$command = new SimulateCommand($factory->reveal()); | ||
$commandTester = new CommandTester($command); | ||
$commandTester->execute(['deploymentName' => 'foo', '--configurationPath' => '.surf', '--force' => true]); | ||
|
||
$this->assertEquals('', $commandTester->getDisplay()); | ||
} | ||
} |