Skip to content

Commit

Permalink
Allow the phpunit task to test single files.
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Krämer committed Apr 21, 2015
1 parent b529585 commit f3efe17
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/Task/Testing/PHPUnit.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit f3efe17

Please sign in to comment.