MDL-40388 Reset globals after each unit test

This commit is contained in:
Jamie Pratt
2013-07-09 11:56:53 +08:00
committed by Damyon Wiese
parent 954ba4bce4
commit 4eff6ed9fe
2 changed files with 26 additions and 0 deletions
+22
View File
@@ -219,6 +219,28 @@ class core_phpunit_advanced_testcase extends advanced_testcase {
$this->assertTrue(isset($CFG->admin));
$this->assertEquals(1, $CFG->rolesactive);
// _GET change.
$_GET['__somethingthatwillnotnormallybepresent__'] = 'yy';
phpunit_util::reset_all_data(true);
$this->assertEquals(array(), $_GET);
// _POST change.
$_POST['__somethingthatwillnotnormallybepresent2__'] = 'yy';
phpunit_util::reset_all_data(true);
$this->assertEquals(array(), $_POST);
// _FILES change.
$_FILES['__somethingthatwillnotnormallybepresent3__'] = 'yy';
phpunit_util::reset_all_data(true);
$this->assertEquals(array(), $_FILES);
// _REQUEST change.
$_REQUEST['__somethingthatwillnotnormallybepresent4__'] = 'yy';
phpunit_util::reset_all_data(true);
$this->assertEquals(array(), $_REQUEST);
//silent changes
$_SERVER['xx'] = 'yy';
phpunit_util::reset_all_data(true);