Add parallel test.

This commit is contained in:
elfet 2015-02-20 17:48:40 +03:00
parent cf38d00b2e
commit 1e4bd9e9ce
3 changed files with 48 additions and 2 deletions

View File

@ -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();
}
/**

View File

@ -0,0 +1,9 @@
<?php
localServer('localhost');
localServer('server1');
localServer('server2');
task('test', function () {
writeln('Hello world!');
});

View 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);
}
}