From 15136147ba36cd095b7a8e326ea4a5d84912f0e1 Mon Sep 17 00:00:00 2001 From: Mikhail Golenkov Date: Mon, 30 Sep 2019 10:56:04 +1000 Subject: [PATCH] MDL-66794 core_customfield: Reset Course handler after unit tests run. --- customfield/tests/api_test.php | 8 ++++++++ customfield/tests/category_controller_test.php | 8 ++++++++ customfield/tests/data_controller_test.php | 8 ++++++++ customfield/tests/field_controller_test.php | 8 ++++++++ customfield/tests/generator_test.php | 8 ++++++++ customfield/tests/privacy_test.php | 8 ++++++++ 6 files changed, 48 insertions(+) diff --git a/customfield/tests/api_test.php b/customfield/tests/api_test.php index 45d50d1712e..2aa96e1883b 100644 --- a/customfield/tests/api_test.php +++ b/customfield/tests/api_test.php @@ -37,6 +37,14 @@ use \core_customfield\category_controller; */ class core_customfield_api_testcase extends advanced_testcase { + /** + * This method is called after the last test of this test class is run. + */ + public static function tearDownAfterClass() { + $handler = core_course\customfield\course_handler::create(); + $handler->delete_all(); + } + /** * Tests set up. */ diff --git a/customfield/tests/category_controller_test.php b/customfield/tests/category_controller_test.php index 656bc5bc79d..56aa2d0d5ce 100644 --- a/customfield/tests/category_controller_test.php +++ b/customfield/tests/category_controller_test.php @@ -36,6 +36,14 @@ use \core_customfield\field_controller; */ class core_customfield_category_controller_testcase extends advanced_testcase { + /** + * This method is called after the last test of this test class is run. + */ + public static function tearDownAfterClass() { + $handler = core_course\customfield\course_handler::create(); + $handler->delete_all(); + } + /** * Tests set up. */ diff --git a/customfield/tests/data_controller_test.php b/customfield/tests/data_controller_test.php index ac5b4056a07..7cf0b7ebac0 100644 --- a/customfield/tests/data_controller_test.php +++ b/customfield/tests/data_controller_test.php @@ -34,6 +34,14 @@ use core_customfield\data_controller; */ class core_customfield_data_controller_testcase extends advanced_testcase { + /** + * This method is called after the last test of this test class is run. + */ + public static function tearDownAfterClass() { + $handler = core_course\customfield\course_handler::create(); + $handler->delete_all(); + } + /** * Tests set up. */ diff --git a/customfield/tests/field_controller_test.php b/customfield/tests/field_controller_test.php index b7044695be9..e490ef1b07a 100644 --- a/customfield/tests/field_controller_test.php +++ b/customfield/tests/field_controller_test.php @@ -38,6 +38,14 @@ use \core_customfield\field_controller; */ class core_customfield_field_controller_testcase extends advanced_testcase { + /** + * This method is called after the last test of this test class is run. + */ + public static function tearDownAfterClass() { + $handler = core_course\customfield\course_handler::create(); + $handler->delete_all(); + } + /** * Tests set up. */ diff --git a/customfield/tests/generator_test.php b/customfield/tests/generator_test.php index 4788d9cf347..059c868a8dd 100644 --- a/customfield/tests/generator_test.php +++ b/customfield/tests/generator_test.php @@ -35,6 +35,14 @@ defined('MOODLE_INTERNAL') || die(); */ class core_customfield_generator_testcase extends advanced_testcase { + /** + * This method is called after the last test of this test class is run. + */ + public static function tearDownAfterClass() { + $handler = core_course\customfield\course_handler::create(); + $handler->delete_all(); + } + /** * Get generator * @return core_customfield_generator diff --git a/customfield/tests/privacy_test.php b/customfield/tests/privacy_test.php index 9a15ced5658..69ea102f65d 100644 --- a/customfield/tests/privacy_test.php +++ b/customfield/tests/privacy_test.php @@ -45,6 +45,14 @@ class core_customfield_privacy_testcase extends provider_testcase { /** @var \core_customfield\field_controller[] */ private $cffields = []; + /** + * This method is called after the last test of this test class is run. + */ + public static function tearDownAfterClass() { + $handler = core_course\customfield\course_handler::create(); + $handler->delete_all(); + } + /** * Set up */