From 8cd20d72562e121ccde78c43d12f1e2927279a93 Mon Sep 17 00:00:00 2001 From: Sebastian Feldmann Date: Fri, 7 Sep 2018 16:00:10 +0200 Subject: [PATCH] Add unit test to reproduce issue #3254 --- tests/unit/TextUI/TestRunnerTest.php | 49 ++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 tests/unit/TextUI/TestRunnerTest.php diff --git a/tests/unit/TextUI/TestRunnerTest.php b/tests/unit/TextUI/TestRunnerTest.php new file mode 100644 index 00000000000..b2f8bdf05b2 --- /dev/null +++ b/tests/unit/TextUI/TestRunnerTest.php @@ -0,0 +1,49 @@ + + * + * 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; + } +}