From 1e4bd9e9ce982c8ed9e5fdc3a1f264e546af8a74 Mon Sep 17 00:00:00 2001 From: elfet Date: Fri, 20 Feb 2015 17:48:40 +0300 Subject: [PATCH] Add parallel test. --- test/recipe/Helper/RecipeTester.php | 8 ++++-- test/src/Executor/Fixture/recipe.php | 9 ++++++ test/src/Executor/ParallelExecutorTest.php | 33 ++++++++++++++++++++++ 3 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 test/src/Executor/Fixture/recipe.php create mode 100644 test/src/Executor/ParallelExecutorTest.php diff --git a/test/recipe/Helper/RecipeTester.php b/test/recipe/Helper/RecipeTester.php index d47f3e6d..eee7ca4f 100644 --- a/test/recipe/Helper/RecipeTester.php +++ b/test/recipe/Helper/RecipeTester.php @@ -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(); } /** diff --git a/test/src/Executor/Fixture/recipe.php b/test/src/Executor/Fixture/recipe.php new file mode 100644 index 00000000..697f0e98 --- /dev/null +++ b/test/src/Executor/Fixture/recipe.php @@ -0,0 +1,9 @@ + + * + * 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); + } +} + \ No newline at end of file