MDL-72837 core_cache: Rename unit test classes to new standard

For the three unit tests that are going to be modified in future
commit, I first changed them to use a namespace and class name
matching filename, as per current standard.
This commit is contained in:
sam marshall 2022-01-12 13:19:55 +00:00
parent e94167174a
commit 691c5b8326
3 changed files with 89 additions and 37 deletions

View File

@ -14,32 +14,44 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* PHPunit tests for the cache API
*
* This file is part of Moodle's cache API, affectionately called MUC.
* It contains the components that are requried in order to use caching.
*
* @package core
* @category cache
* @copyright 2012 Sam Hemelryk
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_cache;
defined('MOODLE_INTERNAL') || die();
// Include the necessary evils.
global $CFG;
require_once($CFG->dirroot.'/cache/locallib.php');
require_once($CFG->dirroot.'/cache/tests/fixtures/lib.php');
use advanced_testcase;
use cache;
use cache_config;
use cache_config_testing;
use cache_factory;
use cache_helper;
use cache_loader;
use cache_phpunit_application;
use cache_phpunit_cache;
use cache_phpunit_dummy_object;
use cache_phpunit_factory;
use cache_phpunit_session;
use cacheable_object_array;
use cache_store;
use coding_exception;
use Exception;
use stdClass;
/**
* PHPunit tests for the cache API
*
* @package core_cache
* @copyright 2012 Sam Hemelryk
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class core_cache_testcase extends advanced_testcase {
class cache_test extends advanced_testcase {
/**
* Load required libraries and fixtures.
*/
public static function setUpBeforeClass(): void {
global $CFG;
require_once($CFG->dirroot . '/cache/locallib.php');
require_once($CFG->dirroot . '/cache/tests/fixtures/lib.php');
}
/**
* Set things back to the default before each test.

View File

@ -14,23 +14,61 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace core_course;
use advanced_testcase;
use backup_controller;
use backup;
use blog_entry;
use cache;
use calendar_event;
use coding_exception;
use comment;
use completion_criteria_date;
use completion_completion;
use context_course;
use context_module;
use context_system;
use context_coursecat;
use core_completion_external;
use core_external;
use core_tag_index_builder;
use core_tag_tag;
use course_capability_assignment;
use course_request;
use core_course_category;
use enrol_imsenterprise_testcase;
use external_api;
use grade_item;
use grading_manager;
use moodle_exception;
use moodle_url;
use phpunit_util;
use rating_manager;
use restore_controller;
use stdClass;
use testing_data_generator;
/**
* Course related unit tests
*
* @package core
* @package core_course
* @category phpunit
* @copyright 2012 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class courselib_test extends advanced_testcase {
defined('MOODLE_INTERNAL') || die();
/**
* Load required libraries and fixtures.
*/
public static function setUpBeforeClass(): void {
global $CFG;
global $CFG;
require_once($CFG->dirroot . '/course/lib.php');
require_once($CFG->dirroot . '/course/tests/fixtures/course_capability_assignment.php');
require_once($CFG->dirroot . '/enrol/imsenterprise/tests/imsenterprise_test.php');
class core_course_courselib_testcase extends advanced_testcase {
require_once($CFG->dirroot . '/course/lib.php');
require_once($CFG->dirroot . '/course/tests/fixtures/course_capability_assignment.php');
require_once($CFG->dirroot . '/enrol/imsenterprise/tests/imsenterprise_test.php');
}
/**
* Set forum specific test values for calling create_module().

View File

@ -14,23 +14,25 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace core;
use advanced_testcase;
use cache;
use cm_info;
use coding_exception;
use context_course;
use context_module;
use course_modinfo;
use moodle_exception;
use moodle_url;
use Exception;
/**
* Unit tests for lib/modinfolib.php.
*
* @package core
* @category phpunit
* @copyright 2012 Andrew Davis
*/
defined('MOODLE_INTERNAL') || die();
global $CFG;
require_once($CFG->libdir . '/modinfolib.php');
/**
* Unit tests for modinfolib.php
*
* @copyright 2012 Andrew Davis
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class modinfolib_test extends advanced_testcase {