mirror of
https://github.com/deployphp/deployer.git
synced 2025-02-24 09:12:51 +01:00
Add parallel test.
This commit is contained in:
parent
cf38d00b2e
commit
1e4bd9e9ce
@ -79,10 +79,14 @@ abstract class RecipeTester extends \PHPUnit_Framework_TestCase
|
||||
* Execute command with tester.
|
||||
*
|
||||
* @param string $command
|
||||
* @param array $args
|
||||
* @param array $options
|
||||
* @return string Display result.
|
||||
*/
|
||||
protected function exec($command)
|
||||
protected function exec($command, $args = [], $options = [])
|
||||
{
|
||||
$this->tester->run(['command' => $command]);
|
||||
$this->tester->run(['command' => $command] + $args, $options);
|
||||
return $this->tester->getDisplay();
|
||||
}
|
||||
|
||||
/**
|
||||
|
9
test/src/Executor/Fixture/recipe.php
Normal file
9
test/src/Executor/Fixture/recipe.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
localServer('localhost');
|
||||
localServer('server1');
|
||||
localServer('server2');
|
||||
|
||||
task('test', function () {
|
||||
writeln('Hello world!');
|
||||
});
|
33
test/src/Executor/ParallelExecutorTest.php
Normal file
33
test/src/Executor/ParallelExecutorTest.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/* (c) Anton Medvedev <anton@elfet.ru>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Deployer\Executor;
|
||||
|
||||
use Deployer\Helper\RecipeTester;
|
||||
|
||||
class ParallelExecutorTest extends RecipeTester
|
||||
{
|
||||
/**
|
||||
* Load or describe recipe.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function loadRecipe()
|
||||
{
|
||||
include __DIR__ . '/Fixture/recipe.php';
|
||||
}
|
||||
|
||||
public function testParallel()
|
||||
{
|
||||
define('DEPLOYER_BIN', __DIR__ . '/../../../bin/dep');
|
||||
|
||||
$display = $this->exec('test', ['--parallel' => true, '--file' => __DIR__ . '/Fixture/recipe.php']);
|
||||
|
||||
$this->assertContains('Ok', $display);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user