Commit 9fb434a6 authored by Eloy Lafuente's avatar Eloy Lafuente
Browse files

Merge branch 'wip-mdl-51266' of https://github.com/rajeshtaneja/moodle

parents 880eb93d 5ecf8e8f
...@@ -35,7 +35,7 @@ use core_availability\info_section; ...@@ -35,7 +35,7 @@ use core_availability\info_section;
* @copyright 2014 The Open University * @copyright 2014 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/ */
class info_testcase extends \advanced_testcase { class info_testcase extends advanced_testcase {
public function setUp() { public function setUp() {
// Load the mock condition so that it can be used. // Load the mock condition so that it can be used.
require_once(__DIR__ . '/fixtures/mock_condition.php'); require_once(__DIR__ . '/fixtures/mock_condition.php');
...@@ -87,8 +87,8 @@ class info_testcase extends \advanced_testcase { ...@@ -87,8 +87,8 @@ class info_testcase extends \advanced_testcase {
// Check invalid one. // Check invalid one.
$info = new info_module($cm3); $info = new info_module($cm3);
$this->assertFalse($info->is_available($information)); $this->assertFalse($info->is_available($information));
$debugging = phpunit_util::get_debugging_messages(); $debugging = $this->getDebuggingMessages();
phpunit_util::reset_debugging(); $this->resetDebugging();
$this->assertEquals(1, count($debugging)); $this->assertEquals(1, count($debugging));
$this->assertContains('Invalid availability', $debugging[0]->message); $this->assertContains('Invalid availability', $debugging[0]->message);
...@@ -141,8 +141,8 @@ class info_testcase extends \advanced_testcase { ...@@ -141,8 +141,8 @@ class info_testcase extends \advanced_testcase {
// Check invalid one. // Check invalid one.
$info = new info_section($sections[3]); $info = new info_section($sections[3]);
$this->assertFalse($info->is_available($information)); $this->assertFalse($info->is_available($information));
$debugging = phpunit_util::get_debugging_messages(); $debugging = $this->getDebuggingMessages();
phpunit_util::reset_debugging(); $this->resetDebugging();
$this->assertEquals(1, count($debugging)); $this->assertEquals(1, count($debugging));
$this->assertContains('Invalid availability', $debugging[0]->message); $this->assertContains('Invalid availability', $debugging[0]->message);
......
...@@ -83,14 +83,14 @@ abstract class advanced_testcase extends base_testcase { ...@@ -83,14 +83,14 @@ abstract class advanced_testcase extends base_testcase {
// Deal with any debugging messages. // Deal with any debugging messages.
$debugerror = phpunit_util::display_debugging_messages(); $debugerror = phpunit_util::display_debugging_messages();
phpunit_util::reset_debugging(); $this->resetDebugging();
if ($debugerror) { if ($debugerror) {
trigger_error('Unenxpected debugging() call detected.', E_USER_NOTICE); trigger_error('Unenxpected debugging() call detected.', E_USER_NOTICE);
} }
} catch (Exception $e) { } catch (Exception $e) {
// cleanup after failed expectation // cleanup after failed expectation
phpunit_util::reset_all_data(); self::resetAllData();
throw $e; throw $e;
} }
...@@ -104,7 +104,7 @@ abstract class advanced_testcase extends base_testcase { ...@@ -104,7 +104,7 @@ abstract class advanced_testcase extends base_testcase {
phpunit_util::reset_all_database_sequences(); phpunit_util::reset_all_database_sequences();
phpunit_util::$lastdbwrites = $DB->perf_get_writes(); // no db reset necessary phpunit_util::$lastdbwrites = $DB->perf_get_writes(); // no db reset necessary
} }
phpunit_util::reset_all_data(null); self::resetAllData(null);
} else if ($this->resetAfterTest === false) { } else if ($this->resetAfterTest === false) {
if ($this->testdbtransaction) { if ($this->testdbtransaction) {
...@@ -118,16 +118,16 @@ abstract class advanced_testcase extends base_testcase { ...@@ -118,16 +118,16 @@ abstract class advanced_testcase extends base_testcase {
try { try {
$this->testdbtransaction->allow_commit(); $this->testdbtransaction->allow_commit();
} catch (dml_transaction_exception $e) { } catch (dml_transaction_exception $e) {
phpunit_util::reset_all_data(); self::resetAllData();
throw new coding_exception('Invalid transaction state detected in test '.$this->getName()); throw new coding_exception('Invalid transaction state detected in test '.$this->getName());
} }
} }
phpunit_util::reset_all_data(true); self::resetAllData(true);
} }
// make sure test did not forget to close transaction // make sure test did not forget to close transaction
if ($DB->is_transaction_started()) { if ($DB->is_transaction_started()) {
phpunit_util::reset_all_data(); self::resetAllData();
if ($this->getStatus() == PHPUnit_Runner_BaseTestRunner::STATUS_PASSED if ($this->getStatus() == PHPUnit_Runner_BaseTestRunner::STATUS_PASSED
or $this->getStatus() == PHPUnit_Runner_BaseTestRunner::STATUS_SKIPPED or $this->getStatus() == PHPUnit_Runner_BaseTestRunner::STATUS_SKIPPED
or $this->getStatus() == PHPUnit_Runner_BaseTestRunner::STATUS_INCOMPLETE) { or $this->getStatus() == PHPUnit_Runner_BaseTestRunner::STATUS_INCOMPLETE) {
...@@ -272,7 +272,7 @@ abstract class advanced_testcase extends base_testcase { ...@@ -272,7 +272,7 @@ abstract class advanced_testcase extends base_testcase {
* @param string $message * @param string $message
*/ */
public function assertDebuggingCalled($debugmessage = null, $debuglevel = null, $message = '') { public function assertDebuggingCalled($debugmessage = null, $debuglevel = null, $message = '') {
$debugging = phpunit_util::get_debugging_messages(); $debugging = $this->getDebuggingMessages();
$count = count($debugging); $count = count($debugging);
if ($count == 0) { if ($count == 0) {
...@@ -297,7 +297,7 @@ abstract class advanced_testcase extends base_testcase { ...@@ -297,7 +297,7 @@ abstract class advanced_testcase extends base_testcase {
$this->assertSame($debuglevel, $debug->level, $message); $this->assertSame($debuglevel, $debug->level, $message);
} }
phpunit_util::reset_debugging(); $this->resetDebugging();
} }
/** /**
...@@ -305,7 +305,7 @@ abstract class advanced_testcase extends base_testcase { ...@@ -305,7 +305,7 @@ abstract class advanced_testcase extends base_testcase {
* @param string $message * @param string $message
*/ */
public function assertDebuggingNotCalled($message = '') { public function assertDebuggingNotCalled($message = '') {
$debugging = phpunit_util::get_debugging_messages(); $debugging = $this->getDebuggingMessages();
$count = count($debugging); $count = count($debugging);
if ($message === '') { if ($message === '') {
...@@ -446,16 +446,21 @@ abstract class advanced_testcase extends base_testcase { ...@@ -446,16 +446,21 @@ abstract class advanced_testcase extends base_testcase {
* @return void * @return void
*/ */
public static function tearDownAfterClass() { public static function tearDownAfterClass() {
phpunit_util::reset_all_data(); self::resetAllData();
} }
/** /**
* Reset all database tables, restore global state and clear caches and optionally purge dataroot dir. * Reset all database tables, restore global state and clear caches and optionally purge dataroot dir.
* @static *
* @param bool $detectchanges
* true - changes in global state and database are reported as errors
* false - no errors reported
* null - only critical problems are reported as errors
* @return void * @return void
*/ */
public static function resetAllData() { public static function resetAllData($detectchanges = false) {
phpunit_util::reset_all_data(); phpunit_util::reset_all_data($detectchanges);
} }
/** /**
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
* @copyright 2012 Petr Skoda {@link http://skodak.org} * @copyright 2012 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/ */
abstract class database_driver_testcase extends PHPUnit_Framework_TestCase { abstract class database_driver_testcase extends base_testcase {
/** @var moodle_database connection to extra database */ /** @var moodle_database connection to extra database */
private static $extradb = null; private static $extradb = null;
...@@ -176,7 +176,7 @@ abstract class database_driver_testcase extends PHPUnit_Framework_TestCase { ...@@ -176,7 +176,7 @@ abstract class database_driver_testcase extends PHPUnit_Framework_TestCase {
* @param string $message * @param string $message
*/ */
public function assertDebuggingCalled($debugmessage = null, $debuglevel = null, $message = '') { public function assertDebuggingCalled($debugmessage = null, $debuglevel = null, $message = '') {
$debugging = phpunit_util::get_debugging_messages(); $debugging = $this->getDebuggingMessages();
$count = count($debugging); $count = count($debugging);
if ($count == 0) { if ($count == 0) {
...@@ -201,7 +201,7 @@ abstract class database_driver_testcase extends PHPUnit_Framework_TestCase { ...@@ -201,7 +201,7 @@ abstract class database_driver_testcase extends PHPUnit_Framework_TestCase {
$this->assertSame($debuglevel, $debug->level, $message); $this->assertSame($debuglevel, $debug->level, $message);
} }
phpunit_util::reset_debugging(); $this->resetDebugging();
} }
/** /**
...@@ -209,7 +209,7 @@ abstract class database_driver_testcase extends PHPUnit_Framework_TestCase { ...@@ -209,7 +209,7 @@ abstract class database_driver_testcase extends PHPUnit_Framework_TestCase {
* @param string $message * @param string $message
*/ */
public function assertDebuggingNotCalled($message = '') { public function assertDebuggingNotCalled($message = '') {
$debugging = phpunit_util::get_debugging_messages(); $debugging = $this->getDebuggingMessages();
$count = count($debugging); $count = count($debugging);
if ($message === '') { if ($message === '') {
......
...@@ -104,16 +104,16 @@ class phpunit_util extends testing_util { ...@@ -104,16 +104,16 @@ class phpunit_util extends testing_util {
global $DB, $CFG, $USER, $SITE, $COURSE, $PAGE, $OUTPUT, $SESSION; global $DB, $CFG, $USER, $SITE, $COURSE, $PAGE, $OUTPUT, $SESSION;
// Stop any message redirection. // Stop any message redirection.
phpunit_util::stop_message_redirection(); self::stop_message_redirection();
// Stop any message redirection. // Stop any message redirection.
phpunit_util::stop_event_redirection(); self::stop_event_redirection();
// Start a new email redirection. // Start a new email redirection.
// This will clear any existing phpmailer redirection. // This will clear any existing phpmailer redirection.
// We redirect all phpmailer output to this message sink which is // We redirect all phpmailer output to this message sink which is
// called instead of phpmailer actually sending the message. // called instead of phpmailer actually sending the message.
phpunit_util::start_phpmailer_redirection(); self::start_phpmailer_redirection();
// We used to call gc_collect_cycles here to ensure desctructors were called between tests. // We used to call gc_collect_cycles here to ensure desctructors were called between tests.
// This accounted for 25% of the total time running phpunit - so we removed it. // This accounted for 25% of the total time running phpunit - so we removed it.
...@@ -320,7 +320,7 @@ class phpunit_util extends testing_util { ...@@ -320,7 +320,7 @@ class phpunit_util extends testing_util {
self::$globals['DB'] = $DB; self::$globals['DB'] = $DB;
// refresh data in all tables, clear caches, etc. // refresh data in all tables, clear caches, etc.
phpunit_util::reset_all_data(); self::reset_all_data();
} }
/** /**
...@@ -427,7 +427,7 @@ class phpunit_util extends testing_util { ...@@ -427,7 +427,7 @@ class phpunit_util extends testing_util {
} }
if ($DB->get_tables()) { if ($DB->get_tables()) {
list($errorcode, $message) = phpunit_util::testing_ready_problem(); list($errorcode, $message) = self::testing_ready_problem();
if ($errorcode) { if ($errorcode) {
phpunit_bootstrap_error(PHPUNIT_EXITCODE_REINSTALL, 'Database tables already present, Moodle PHPUnit test environment can not be initialised'); phpunit_bootstrap_error(PHPUNIT_EXITCODE_REINSTALL, 'Database tables already present, Moodle PHPUnit test environment can not be initialised');
} else { } else {
......
...@@ -198,13 +198,13 @@ class core_phpunit_advanced_testcase extends advanced_testcase { ...@@ -198,13 +198,13 @@ class core_phpunit_advanced_testcase extends advanced_testcase {
global $DB, $CFG, $COURSE, $SITE, $USER; global $DB, $CFG, $COURSE, $SITE, $USER;
$this->preventResetByRollback(); $this->preventResetByRollback();
phpunit_util::reset_all_data(true); self::resetAllData(true);
// Database change. // Database change.
$this->assertEquals(1, $DB->get_field('user', 'confirmed', array('id'=>2))); $this->assertEquals(1, $DB->get_field('user', 'confirmed', array('id'=>2)));
$DB->set_field('user', 'confirmed', 0, array('id'=>2)); $DB->set_field('user', 'confirmed', 0, array('id'=>2));
try { try {
phpunit_util::reset_all_data(true); self::resetAllData(true);
} catch (Exception $e) { } catch (Exception $e) {
$this->assertInstanceOf('PHPUnit_Framework_Error_Warning', $e); $this->assertInstanceOf('PHPUnit_Framework_Error_Warning', $e);
} }
...@@ -215,7 +215,7 @@ class core_phpunit_advanced_testcase extends advanced_testcase { ...@@ -215,7 +215,7 @@ class core_phpunit_advanced_testcase extends advanced_testcase {
unset($CFG->admin); unset($CFG->admin);
$CFG->rolesactive = 0; $CFG->rolesactive = 0;
try { try {
phpunit_util::reset_all_data(true); self::resetAllData(true);
} catch (Exception $e) { } catch (Exception $e) {
$this->assertInstanceOf('PHPUnit_Framework_Error_Warning', $e); $this->assertInstanceOf('PHPUnit_Framework_Error_Warning', $e);
$this->assertContains('xx', $e->getMessage()); $this->assertContains('xx', $e->getMessage());
...@@ -228,28 +228,28 @@ class core_phpunit_advanced_testcase extends advanced_testcase { ...@@ -228,28 +228,28 @@ class core_phpunit_advanced_testcase extends advanced_testcase {
// _GET change. // _GET change.
$_GET['__somethingthatwillnotnormallybepresent__'] = 'yy'; $_GET['__somethingthatwillnotnormallybepresent__'] = 'yy';
phpunit_util::reset_all_data(true); self::resetAllData(true);
$this->assertEquals(array(), $_GET); $this->assertEquals(array(), $_GET);
// _POST change. // _POST change.
$_POST['__somethingthatwillnotnormallybepresent2__'] = 'yy'; $_POST['__somethingthatwillnotnormallybepresent2__'] = 'yy';
phpunit_util::reset_all_data(true); self::resetAllData(true);
$this->assertEquals(array(), $_POST); $this->assertEquals(array(), $_POST);
// _FILES change. // _FILES change.
$_FILES['__somethingthatwillnotnormallybepresent3__'] = 'yy'; $_FILES['__somethingthatwillnotnormallybepresent3__'] = 'yy';
phpunit_util::reset_all_data(true); self::resetAllData(true);
$this->assertEquals(array(), $_FILES); $this->assertEquals(array(), $_FILES);
// _REQUEST change. // _REQUEST change.
$_REQUEST['__somethingthatwillnotnormallybepresent4__'] = 'yy'; $_REQUEST['__somethingthatwillnotnormallybepresent4__'] = 'yy';
phpunit_util::reset_all_data(true); self::resetAllData(true);
$this->assertEquals(array(), $_REQUEST); $this->assertEquals(array(), $_REQUEST);
// Silent changes. // Silent changes.
$_SERVER['xx'] = 'yy'; $_SERVER['xx'] = 'yy';
phpunit_util::reset_all_data(true); self::resetAllData(true);
$this->assertFalse(isset($_SERVER['xx'])); $this->assertFalse(isset($_SERVER['xx']));
// COURSE change. // COURSE change.
...@@ -257,7 +257,7 @@ class core_phpunit_advanced_testcase extends advanced_testcase { ...@@ -257,7 +257,7 @@ class core_phpunit_advanced_testcase extends advanced_testcase {
$COURSE = new stdClass(); $COURSE = new stdClass();
$COURSE->id = 7; $COURSE->id = 7;
try { try {
phpunit_util::reset_all_data(true); self::resetAllData(true);
} catch (Exception $e) { } catch (Exception $e) {
$this->assertInstanceOf('PHPUnit_Framework_Error_Warning', $e); $this->assertInstanceOf('PHPUnit_Framework_Error_Warning', $e);
$this->assertEquals(1, $SITE->id); $this->assertEquals(1, $SITE->id);
...@@ -268,7 +268,7 @@ class core_phpunit_advanced_testcase extends advanced_testcase { ...@@ -268,7 +268,7 @@ class core_phpunit_advanced_testcase extends advanced_testcase {
// USER change. // USER change.
$this->setUser(2); $this->setUser(2);
try { try {
phpunit_util::reset_all_data(true); self::resetAllData(true);
} catch (Exception $e) { } catch (Exception $e) {
$this->assertInstanceOf('PHPUnit_Framework_Error_Warning', $e); $this->assertInstanceOf('PHPUnit_Framework_Error_Warning', $e);
$this->assertEquals(0, $USER->id); $this->assertEquals(0, $USER->id);
...@@ -601,7 +601,7 @@ class core_phpunit_advanced_testcase extends advanced_testcase { ...@@ -601,7 +601,7 @@ class core_phpunit_advanced_testcase extends advanced_testcase {
$this->resetAfterTest(); $this->resetAfterTest();
// If this fails \phpunit_util::reset_all_data() must be updated. // If this fails self::resetAllData(); must be updated.
$this->assertSame('en_AU.UTF-8', get_string('locale', 'langconfig')); $this->assertSame('en_AU.UTF-8', get_string('locale', 'langconfig'));
$this->assertSame('English_Australia.1252', get_string('localewin', 'langconfig')); $this->assertSame('English_Australia.1252', get_string('localewin', 'langconfig'));
...@@ -614,7 +614,7 @@ class core_phpunit_advanced_testcase extends advanced_testcase { ...@@ -614,7 +614,7 @@ class core_phpunit_advanced_testcase extends advanced_testcase {
} }
try { try {
phpunit_util::reset_all_data(true); self::resetAllData(true);
} catch (Exception $e) { } catch (Exception $e) {
$this->assertInstanceOf('PHPUnit_Framework_Error_Warning', $e); $this->assertInstanceOf('PHPUnit_Framework_Error_Warning', $e);
} }
...@@ -633,7 +633,7 @@ class core_phpunit_advanced_testcase extends advanced_testcase { ...@@ -633,7 +633,7 @@ class core_phpunit_advanced_testcase extends advanced_testcase {
setlocale(LC_TIME, 'en_US.UTF-8'); setlocale(LC_TIME, 'en_US.UTF-8');
} }
phpunit_util::reset_all_data(false); self::resetAllData(false);
if ($CFG->ostype === 'WINDOWS') { if ($CFG->ostype === 'WINDOWS') {
$this->assertSame('English_Australia.1252', setlocale(LC_TIME, 0)); $this->assertSame('English_Australia.1252', setlocale(LC_TIME, 0));
......
...@@ -51,7 +51,6 @@ class core_messagelib_testcase extends advanced_testcase { ...@@ -51,7 +51,6 @@ class core_messagelib_testcase extends advanced_testcase {
// Check message is not sent. // Check message is not sent.
$sink = $this->redirectEmails(); $sink = $this->redirectEmails();
$this->assertTrue(phpunit_util::is_redirecting_phpmailer());
message_send($message); message_send($message);
$emails = $sink->get_messages(); $emails = $sink->get_messages();
$this->assertEmpty($emails); $this->assertEmpty($emails);
...@@ -62,7 +61,6 @@ class core_messagelib_testcase extends advanced_testcase { ...@@ -62,7 +61,6 @@ class core_messagelib_testcase extends advanced_testcase {
$this->assertTrue($preferences->$disableprovidersetting == 0); $this->assertTrue($preferences->$disableprovidersetting == 0);
$sink = $this->redirectEmails(); $sink = $this->redirectEmails();
$this->assertTrue(phpunit_util::is_redirecting_phpmailer());
message_send($message); message_send($message);
$emails = $sink->get_messages(); $emails = $sink->get_messages();
$email = reset($emails); $email = reset($emails);
...@@ -853,7 +851,6 @@ class core_messagelib_testcase extends advanced_testcase { ...@@ -853,7 +851,6 @@ class core_messagelib_testcase extends advanced_testcase {
// Make sure we are redirecting emails. // Make sure we are redirecting emails.
$sink = $this->redirectEmails(); $sink = $this->redirectEmails();
$this->assertTrue(phpunit_util::is_redirecting_phpmailer());
message_send($message); message_send($message);
// Get the email that we just sent. // Get the email that we just sent.
......
...@@ -222,8 +222,8 @@ class mod_forum_subscriptions_testcase extends advanced_testcase { ...@@ -222,8 +222,8 @@ class mod_forum_subscriptions_testcase extends advanced_testcase {
// Check the deprecated function too. // Check the deprecated function too.
$this->assertFalse(forum_is_subscribed($author->id, $forum)); $this->assertFalse(forum_is_subscribed($author->id, $forum));
$this->assertEquals(1, count(phpunit_util::get_debugging_messages())); $this->assertEquals(1, count($this->getDebuggingMessages()));
phpunit_util::reset_debugging(); $this->resetDebugging();
// Check that the user is unsubscribed from the discussion too. // Check that the user is unsubscribed from the discussion too.
$this->assertFalse(\mod_forum\subscriptions::is_subscribed($author->id, $forum, $discussion->id)); $this->assertFalse(\mod_forum\subscriptions::is_subscribed($author->id, $forum, $discussion->id));
...@@ -267,8 +267,8 @@ class mod_forum_subscriptions_testcase extends advanced_testcase { ...@@ -267,8 +267,8 @@ class mod_forum_subscriptions_testcase extends advanced_testcase {
// Subscribing to the forum should create a record in the subscriptions table, but not the forum discussion // Subscribing to the forum should create a record in the subscriptions table, but not the forum discussion
// subscriptions table. // subscriptions table.
forum_subscribe($author->id, $forum->id); forum_subscribe($author->id, $forum->id);
$this->assertEquals(1, count(phpunit_util::get_debugging_messages())); $this->assertEquals(1, count($this->getDebuggingMessages()));
phpunit_util::reset_debugging(); $this->resetDebugging();
$this->assertEquals(1, $DB->count_records('forum_subscriptions', array( $this->assertEquals(1, $DB->count_records('forum_subscriptions', array(
'userid' => $author->id, 'userid' => $author->id,
'forum' => $forum->id, 'forum' => $forum->id,
...@@ -281,8 +281,8 @@ class mod_forum_subscriptions_testcase extends advanced_testcase { ...@@ -281,8 +281,8 @@ class mod_forum_subscriptions_testcase extends advanced_testcase {
// Unsubscribing should remove the record from the forum subscriptions table, and not modify the forum // Unsubscribing should remove the record from the forum subscriptions table, and not modify the forum
// discussion subscriptions table. // discussion subscriptions table.
forum_unsubscribe($author->id, $forum->id); forum_unsubscribe($author->id, $forum->id);
$this->assertEquals(1, count(phpunit_util::get_debugging_messages())); $this->assertEquals(1, count($this->getDebuggingMessages()));
phpunit_util::reset_debugging(); $this->resetDebugging();
$this->assertEquals(0, $DB->count_records('forum_subscriptions', array( $this->assertEquals(0, $DB->count_records('forum_subscriptions', array(
'userid' => $author->id, 'userid' => $author->id,
'forum' => $forum->id, 'forum' => $forum->id,
...@@ -441,8 +441,8 @@ class mod_forum_subscriptions_testcase extends advanced_testcase { ...@@ -441,8 +441,8 @@ class mod_forum_subscriptions_testcase extends advanced_testcase {
// Check the deprecated function too. // Check the deprecated function too.
$this->assertFalse(forum_is_subscribed($author->id, $forum)); $this->assertFalse(forum_is_subscribed($author->id, $forum));
$this->assertEquals(1, count(phpunit_util::get_debugging_messages())); $this->assertEquals(1, count($this->getDebuggingMessages()));
phpunit_util::reset_debugging(); $this->resetDebugging();
// Post a discussion to the forum. // Post a discussion to the forum.
list($discussion, $post) = $this->helper_post_to_forum($forum, $author); list($discussion, $post) = $this->helper_post_to_forum($forum, $author);
...@@ -478,8 +478,8 @@ class mod_forum_subscriptions_testcase extends advanced_testcase { ...@@ -478,8 +478,8 @@ class mod_forum_subscriptions_testcase extends advanced_testcase {
// Check the deprecated function too. // Check the deprecated function too.
$this->assertTrue(forum_is_subscribed($author->id, $forum)); $this->assertTrue(forum_is_subscribed($author->id, $forum));
$this->assertEquals(1, count(phpunit_util::get_debugging_messages())); $this->assertEquals(1, count($this->getDebuggingMessages()));
phpunit_util::reset_debugging(); $this->resetDebugging();
// Post a discussion to the forum. // Post a discussion to the forum.
list($discussion, $post) = $this->helper_post_to_forum($forum, $author); list($discussion, $post) = $this->helper_post_to_forum($forum, $author);
...@@ -508,8 +508,8 @@ class mod_forum_subscriptions_testcase extends advanced_testcase { ...@@ -508,8 +508,8 @@ class mod_forum_subscriptions_testcase extends advanced_testcase {
// Check the deprecated function too. // Check the deprecated function too.
$this->assertFalse(forum_is_subscribed($author->id, $forum)); $this->assertFalse(forum_is_subscribed($author->id, $forum));
$this->assertEquals(1, count(phpunit_util::get_debugging_messages())); $this->assertEquals(1, count($this->getDebuggingMessages()));
phpunit_util::reset_debugging(); $this->resetDebugging();
// Post a discussion to the forum. // Post a discussion to the forum.
list($discussion, $post) = $this->helper_post_to_forum($forum, $author); list($discussion, $post) = $this->helper_post_to_forum($forum, $author);
...@@ -525,8 +525,8 @@ class mod_forum_subscriptions_testcase extends advanced_testcase { ...@@ -525,8 +525,8 @@ class mod_forum_subscriptions_testcase extends advanced_testcase {
// Check the deprecated function too. // Check the deprecated function too.
$this->assertFalse(forum_is_subscribed($author->id, $forum)); $this->assertFalse(forum_is_subscribed($author->id, $forum));
$this->assertEquals(1, count(phpunit_util::get_debugging_messages())); $this->assertEquals(1, count($this->getDebuggingMessages()));
phpunit_util::reset_debugging(); $this->resetDebugging();
// But subscribed to the discussion. // But subscribed to the discussion.
$this->assertTrue(\mod_forum\subscriptions::is_subscribed($author->id, $forum, $discussion->id)); $this->assertTrue(\mod_forum\subscriptions::is_subscribed($author->id, $forum, $discussion->id));
...@@ -555,8 +555,8 @@ class mod_forum_subscriptions_testcase extends advanced_testcase { ...@@ -555,8 +555,8 @@ class mod_forum_subscriptions_testcase extends advanced_testcase {