diff --git a/lib/phpunit/classes/advanced_testcase.php b/lib/phpunit/classes/advanced_testcase.php index a7a33bb7b59..e4bace9dce6 100644 --- a/lib/phpunit/classes/advanced_testcase.php +++ b/lib/phpunit/classes/advanced_testcase.php @@ -241,7 +241,7 @@ abstract class advanced_testcase extends PHPUnit_Framework_TestCase { /** * Return debugging messages from the current test. - * @return array + * @return array with instances having 'message', 'level' and 'stacktrace' property. */ public function getDebuggingMessages() { return phpunit_util::get_debugging_messages(); @@ -249,10 +249,9 @@ abstract class advanced_testcase extends PHPUnit_Framework_TestCase { /** * Clear all previous debugging messages in current test. - * @return array */ public function resetDebugging() { - return phpunit_util::reset_debugging(); + phpunit_util::reset_debugging(); } /** @@ -293,6 +292,10 @@ abstract class advanced_testcase extends PHPUnit_Framework_TestCase { phpunit_util::reset_debugging(); } + /** + * Call when no debugging() messages expected. + * @param string $message + */ public function assertDebuggingNotCalled($message = '') { $debugging = phpunit_util::get_debugging_messages(); $count = count($debugging); diff --git a/lib/phpunit/classes/database_driver_testcase.php b/lib/phpunit/classes/database_driver_testcase.php index 09b7dd2544b..4f56eb8a5e9 100644 --- a/lib/phpunit/classes/database_driver_testcase.php +++ b/lib/phpunit/classes/database_driver_testcase.php @@ -136,7 +136,7 @@ abstract class database_driver_testcase extends PHPUnit_Framework_TestCase { /** * Return debugging messages from the current test. - * @return array + * @return array with instances having 'message', 'level' and 'stacktrace' property. */ public function getDebuggingMessages() { return phpunit_util::get_debugging_messages(); @@ -144,10 +144,9 @@ abstract class database_driver_testcase extends PHPUnit_Framework_TestCase { /** * Clear all previous debugging messages in current test. - * @return array */ public function resetDebugging() { - return phpunit_util::reset_debugging(); + phpunit_util::reset_debugging(); } /** @@ -188,6 +187,10 @@ abstract class database_driver_testcase extends PHPUnit_Framework_TestCase { phpunit_util::reset_debugging(); } + /** + * Call when no debugging() messages expected. + * @param string $message + */ public function assertDebuggingNotCalled($message = '') { $debugging = phpunit_util::get_debugging_messages(); $count = count($debugging); diff --git a/lib/upgrade.txt b/lib/upgrade.txt index 34db5a016a0..61d350a3b6d 100644 --- a/lib/upgrade.txt +++ b/lib/upgrade.txt @@ -11,6 +11,11 @@ YUI changes: * moodle-enrol-notification has been renamed to moodle-core-notification * YUI2 code must now use 2in3, see http://yuilibrary.com/yui/docs/yui/yui-yui2.html +Unit testing changes: +* output debugging() is not sent to standard output any more, + use $this->assertDebuggingCalled(), $this->assertDebuggingNotCalled(), + $this->getDebuggingMessages() or $this->assertResetDebugging() instead. + === 2.3 === Database layer changes: