From f3efe170ec7abb5648343abf7faa8566b58a536b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Kr=C3=A4mer?= Date: Tue, 21 Apr 2015 22:31:19 +0200 Subject: [PATCH] Allow the phpunit task to test single files. --- src/Task/Testing/PHPUnit.php | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/Task/Testing/PHPUnit.php b/src/Task/Testing/PHPUnit.php index 1057b6ca3..d04a41109 100644 --- a/src/Task/Testing/PHPUnit.php +++ b/src/Task/Testing/PHPUnit.php @@ -24,6 +24,13 @@ class PHPUnit extends BaseTask implements CommandInterface, PrintedInterface protected $command; + /** + * Test files to run, they're appended to the command and arguments. + * + * @var string + */ + protected $files = ''; + public function __construct($pathToPhpUnit = null) { if ($pathToPhpUnit) { @@ -110,9 +117,24 @@ public function debug() return $this; } + /** + * Test files to run. + * + * @param string|array A single file or a list of files. + * @return $this + */ + public function files($files) + { + if (is_string($files)) { + $files = [$files]; + } + $this->files = ' ' . implode(',', $files); + return $this; + } + public function getCommand() { - return $this->command . $this->arguments; + return $this->command . $this->arguments . $this->files; } public function run()