Skip to content

Commit

Permalink
allow config to be present but don't verify file exists in console
Browse files Browse the repository at this point in the history
  • Loading branch information
brianium committed Jan 22, 2013
1 parent 3f8e436 commit a1e2e89
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 9 additions & 0 deletions functional/PHPUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ public function testWithConfigurationInDirWithoutConfigFile()
$this->assertResults($results);
}

public function testWithConfigurationThatDoesNotExist()
{
chdir(dirname(FIXTURES));
$this->path = '';
$results = $this->paratest(array('configuration' => FIXTURES . DS . 'phpunit.xml.disto'));
$this->assertRegExp('/Could not read ".*phpunit.xml.disto"./', $results);
}

public function testFunctionalWithBootstrap()
{
$results = $this->paratest(array('bootstrap' => BOOTSTRAP, 'functional' => ''));
Expand Down Expand Up @@ -167,6 +175,7 @@ public function testRunWithFatalRuntimeErrorOutputsError()
public function testRunWithoutPathArgumentDisplaysUsage()
{
$this->path = '';
chdir(dirname(FIXTURES));
$result = $this->paratest();
$usage = file_get_contents(FIXTURES . DS . 'output' . DS . 'usage.txt');
$this->assertEquals($usage, $result);
Expand Down
6 changes: 3 additions & 3 deletions src/ParaTest/Console/Testers/PHPUnit.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function configure(Command $command)

public function execute(InputInterface $input, OutputInterface $output)
{
if(!$this->canFindConfig($input) && !$this->hasPath($input))
if(!$this->hasConfig($input) && !$this->hasPath($input))
$this->displayHelp($input, $output);
$runner = new Runner($this->getRunnerOptions($input));
$runner->run();
Expand All @@ -40,11 +40,11 @@ protected function hasPath(InputInterface $input)
return $argument || $option;
}

protected function canFindConfig(InputInterface $input)
protected function hasConfig(InputInterface $input)
{
$cwd = getcwd() . DIRECTORY_SEPARATOR;

if($input->hasOption('configuration') && file_exists($input->getOption('configuration')))
if($input->getOption('configuration'))
return true;

return file_exists($cwd . 'phpunit.xml.dist') || file_exists($cwd . 'phpunit.xml');
Expand Down

0 comments on commit a1e2e89

Please # to comment.