From 10052edb204cd6e8b7b455c7029ada966624f756 Mon Sep 17 00:00:00 2001 From: Michael van Tricht Date: Thu, 6 Apr 2017 22:49:37 +0200 Subject: [PATCH] Make test suite compatible with PHPUnit 5. --- .travis.yml | 3 +++ lib/Cake/TestSuite/CakeTestCase.php | 2 +- lib/Cake/TestSuite/CakeTestRunner.php | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index e416c915c..5e46a2c26 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,6 +32,9 @@ matrix: - php: 7.0 env: PHPCS=1 + - php: 7.1 + env: DB=mysql PHPUNIT=5.7.19 + before_script: - composer global require "phpunit/phpunit=$PHPUNIT" diff --git a/lib/Cake/TestSuite/CakeTestCase.php b/lib/Cake/TestSuite/CakeTestCase.php index 5b537e979..7b3f099eb 100644 --- a/lib/Cake/TestSuite/CakeTestCase.php +++ b/lib/Cake/TestSuite/CakeTestCase.php @@ -655,7 +655,7 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase { * @deprecated 3.0.0 This is a compatibility wrapper for 1.x. It will be removed in 3.0. * @return void */ - protected function expectException($name = 'Exception', $message = '') { + public function expectException($name = 'Exception', $message = '') { $this->setExpectedException($name, $message); } diff --git a/lib/Cake/TestSuite/CakeTestRunner.php b/lib/Cake/TestSuite/CakeTestRunner.php index da36429ba..7fb2f8a3e 100644 --- a/lib/Cake/TestSuite/CakeTestRunner.php +++ b/lib/Cake/TestSuite/CakeTestRunner.php @@ -44,9 +44,10 @@ class CakeTestRunner extends PHPUnit_TextUI_TestRunner { * * @param PHPUnit_Framework_Test $suite The test suite to run * @param array $arguments The CLI arguments + * @param bool $exit Exits by default or returns the results * @return void */ - public function doRun(PHPUnit_Framework_Test $suite, array $arguments = array()) { + public function doRun(PHPUnit_Framework_Test $suite, array $arguments = array(), $exit = true) { if (isset($arguments['printer'])) { static::$versionStringPrinted = true; }