Skip to content

Commit

Permalink
Merge branch '6.5' into 7.3
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Sep 7, 2018
2 parents a5c8fd7 + d8bdb50 commit ce00155
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/TextUI/TestRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,6 @@ public function doRun(Test $suite, array $arguments = [], bool $exit = true): Te

$this->handleConfiguration($arguments);

$this->processSuiteFilters($suite, $arguments);

if (isset($arguments['bootstrap'])) {
$GLOBALS['__PHPUNIT_BOOTSTRAP'] = $arguments['bootstrap'];
}
Expand Down Expand Up @@ -575,6 +573,7 @@ public function doRun(Test $suite, array $arguments = [], bool $exit = true): Te
$result->setTimeoutForLargeTests($arguments['timeoutForLargeTests']);

if ($suite instanceof TestSuite) {
$this->processSuiteFilters($suite, $arguments);
$suite->setRunTestInSeparateProcess($arguments['processIsolation']);
}

Expand Down
49 changes: 49 additions & 0 deletions tests/unit/TextUI/TestRunnerTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\TextUI;

use PHPUnit\Framework\TestCase;

class TestRunnerTest extends TestCase
{
public function testTestIsRunnable()
{
$runner = new TestRunner();
$runner->setPrinter($this->getResultPrinterMock());
$runner->doRun(new \Success(), ['filter' => 'foo'], false);
}

public function testSuiteIsRunnable()
{
$runner = new TestRunner();
$runner->setPrinter($this->getResultPrinterMock());
$runner->doRun($this->getSuiteMock(), ['filter' => 'foo'], false);
}

/**
* @return \PHPUnit\TextUI\ResultPrinter
*/
private function getResultPrinterMock()
{
return $this->createMock(\PHPUnit\TextUI\ResultPrinter::class);
}

/**
* @return \PHPUnit\Framework\TestSuite
*/
private function getSuiteMock()
{
$suite = $this->createMock(\PHPUnit\Framework\TestSuite::class);
$suite->expects($this->once())->method('injectFilter');
$suite->expects($this->once())->method('run');

return $suite;
}
}

0 comments on commit ce00155

Please sign in to comment.