mirror of
https://github.com/moodle/moodle.git
synced 2025-04-15 13:33:52 +02:00
MDL-67353 course: move form tearDown() to reset_all_data()
We are already cleaning all sort of caches, statics, singletons there and it's better to ensure they are always reset to avoid myterious failures @ distance.
This commit is contained in:
parent
e46a9874a5
commit
4af44dbc8e
@ -71,7 +71,7 @@ class course_handler extends \core_customfield\handler {
|
||||
/**
|
||||
* Run reset code after unit tests to reset the singleton usage.
|
||||
*/
|
||||
public static function reset_after_test(): void {
|
||||
public static function reset_caches(): void {
|
||||
if (!PHPUNIT_TEST) {
|
||||
throw new \coding_exception('This feature is only intended for use in unit tests');
|
||||
}
|
||||
|
@ -37,14 +37,6 @@ use \core_customfield\category_controller;
|
||||
*/
|
||||
class core_customfield_api_testcase extends advanced_testcase {
|
||||
|
||||
/**
|
||||
* Tear down to reset the singleton after each test.
|
||||
*/
|
||||
public function tearDown() {
|
||||
core_course\customfield\course_handler::reset_after_test();
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get generator.
|
||||
*
|
||||
|
@ -36,14 +36,6 @@ use \core_customfield\field_controller;
|
||||
*/
|
||||
class core_customfield_category_controller_testcase extends advanced_testcase {
|
||||
|
||||
/**
|
||||
* Tear down to reset the singleton after each test.
|
||||
*/
|
||||
public function tearDown() {
|
||||
core_course\customfield\course_handler::reset_after_test();
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get generator.
|
||||
*
|
||||
|
@ -34,14 +34,6 @@ use core_customfield\data_controller;
|
||||
*/
|
||||
class core_customfield_data_controller_testcase extends advanced_testcase {
|
||||
|
||||
/**
|
||||
* Tear down to reset the singleton after each test.
|
||||
*/
|
||||
public function tearDown() {
|
||||
core_course\customfield\course_handler::reset_after_test();
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get generator.
|
||||
*
|
||||
|
@ -38,14 +38,6 @@ use \core_customfield\field_controller;
|
||||
*/
|
||||
class core_customfield_field_controller_testcase extends advanced_testcase {
|
||||
|
||||
/**
|
||||
* Tear down to reset the singleton after each test.
|
||||
*/
|
||||
public function tearDown() {
|
||||
core_course\customfield\course_handler::reset_after_test();
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get generator.
|
||||
*
|
||||
|
@ -35,14 +35,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
*/
|
||||
class core_customfield_generator_testcase extends advanced_testcase {
|
||||
|
||||
/**
|
||||
* Tear down to reset the singleton after each test.
|
||||
*/
|
||||
public function tearDown() {
|
||||
core_course\customfield\course_handler::reset_after_test();
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get generator
|
||||
* @return core_customfield_generator
|
||||
|
@ -38,14 +38,6 @@ use core_customfield\privacy\provider;
|
||||
*/
|
||||
class core_customfield_privacy_testcase extends provider_testcase {
|
||||
|
||||
/**
|
||||
* Tear down to reset the singleton after each test.
|
||||
*/
|
||||
public function tearDown() {
|
||||
core_course\customfield\course_handler::reset_after_test();
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate data.
|
||||
*
|
||||
|
@ -252,6 +252,9 @@ class phpunit_util extends testing_util {
|
||||
if (class_exists('\core\update\checker')) {
|
||||
\core\update\checker::reset_caches(true);
|
||||
}
|
||||
if (class_exists('\core_course\customfield\course_handler')) {
|
||||
\core_course\customfield\course_handler::reset_caches();
|
||||
}
|
||||
|
||||
// Clear static cache within restore.
|
||||
if (class_exists('restore_section_structure_step')) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user