diff --git a/auth/tests/auth_test.php b/auth/tests/auth_test.php index 0b2b8ae00e88f..e1bf85f6cbbad 100644 --- a/auth/tests/auth_test.php +++ b/auth/tests/auth_test.php @@ -34,7 +34,7 @@ * @copyright 2013 Frédéric Massart * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class auth_testcase extends advanced_testcase { +class core_auth_testcase extends advanced_testcase { public function test_user_loggedin_event() { global $USER; diff --git a/backup/controller/tests/controller_test.php b/backup/controller/tests/controller_test.php index 6b44703cf13e7..a485145988269 100644 --- a/backup/controller/tests/controller_test.php +++ b/backup/controller/tests/controller_test.php @@ -30,7 +30,7 @@ /* * controller tests (all) */ -class backup_controller_testcase extends advanced_testcase { +class core_backup_controller_testcase extends advanced_testcase { protected $moduleid; // course_modules id used for testing protected $sectionid; // course_sections id used for testing diff --git a/backup/converter/moodle1/tests/lib_test.php b/backup/converter/moodle1/tests/moodle1_converter_test.php similarity index 99% rename from backup/converter/moodle1/tests/lib_test.php rename to backup/converter/moodle1/tests/moodle1_converter_test.php index 8fb50b688a8ee..3209287216464 100644 --- a/backup/converter/moodle1/tests/lib_test.php +++ b/backup/converter/moodle1/tests/moodle1_converter_test.php @@ -30,7 +30,7 @@ require_once($CFG->dirroot . '/backup/converter/moodle1/lib.php'); -class moodle1_converter_testcase extends advanced_testcase { +class core_backup_moodle1_converter_testcase extends advanced_testcase { /** @var string the name of the directory containing the unpacked Moodle 1.9 backup */ protected $tempdir; diff --git a/badges/tests/badgeslib_test.php b/badges/tests/badgeslib_test.php index b51d155e6afd2..9ccafc137de06 100644 --- a/badges/tests/badgeslib_test.php +++ b/badges/tests/badgeslib_test.php @@ -29,7 +29,7 @@ global $CFG; require_once($CFG->libdir . '/badgeslib.php'); -class badges_testcase extends advanced_testcase { +class core_badgeslib_testcase extends advanced_testcase { protected $badgeid; protected function setUp() { diff --git a/blog/tests/bloglib_test.php b/blog/tests/bloglib_test.php index f385eb3e9e1cb..394d66d1cabce 100644 --- a/blog/tests/bloglib_test.php +++ b/blog/tests/bloglib_test.php @@ -31,7 +31,7 @@ /** * Test functions that rely on the DB tables */ -class bloglib_testcase extends advanced_testcase { +class core_bloglib_testcase extends advanced_testcase { private $courseid; // To store important ids to be used in tests private $cmid; diff --git a/cache/tests/administration_helper_test.php b/cache/tests/administration_helper_test.php new file mode 100644 index 0000000000000..6a1630d7c6920 --- /dev/null +++ b/cache/tests/administration_helper_test.php @@ -0,0 +1,236 @@ +. + +/** + * PHPunit tests for the cache API and in particular things in locallib.php + * + * 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 + */ + +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'); + + +/** + * PHPunit tests for the cache API and in particular the cache_administration_helper + * + * @copyright 2012 Sam Hemelryk + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class core_cache_administration_helper_testcase extends advanced_testcase { + + /** + * Set things back to the default before each test. + */ + public function setUp() { + parent::setUp(); + cache_factory::reset(); + cache_config_phpunittest::create_default_configuration(); + } + + /** + * Final task is to reset the cache system + */ + public static function tearDownAfterClass() { + parent::tearDownAfterClass(); + cache_factory::reset(); + } + + /** + * Test the numerous summaries the helper can produce. + */ + public function test_get_summaries() { + // First the preparation. + $config = cache_config_writer::instance(); + $this->assertTrue($config->add_store_instance('summariesstore', 'file')); + $config->set_definition_mappings('core/eventinvalidation', array('summariesstore')); + $this->assertTrue($config->set_mode_mappings(array( + cache_store::MODE_APPLICATION => array('summariesstore'), + cache_store::MODE_SESSION => array('default_session'), + cache_store::MODE_REQUEST => array('default_request'), + ))); + + $storesummaries = cache_administration_helper::get_store_instance_summaries(); + $this->assertInternalType('array', $storesummaries); + $this->assertArrayHasKey('summariesstore', $storesummaries); + $summary = $storesummaries['summariesstore']; + // Check the keys + $this->assertArrayHasKey('name', $summary); + $this->assertArrayHasKey('plugin', $summary); + $this->assertArrayHasKey('default', $summary); + $this->assertArrayHasKey('isready', $summary); + $this->assertArrayHasKey('requirementsmet', $summary); + $this->assertArrayHasKey('mappings', $summary); + $this->assertArrayHasKey('modes', $summary); + $this->assertArrayHasKey('supports', $summary); + // Check the important/known values + $this->assertEquals('summariesstore', $summary['name']); + $this->assertEquals('file', $summary['plugin']); + $this->assertEquals(0, $summary['default']); + $this->assertEquals(1, $summary['isready']); + $this->assertEquals(1, $summary['requirementsmet']); + $this->assertEquals(1, $summary['mappings']); + + $definitionsummaries = cache_administration_helper::get_definition_summaries(); + $this->assertInternalType('array', $definitionsummaries); + $this->assertArrayHasKey('core/eventinvalidation', $definitionsummaries); + $summary = $definitionsummaries['core/eventinvalidation']; + // Check the keys + $this->assertArrayHasKey('id', $summary); + $this->assertArrayHasKey('name', $summary); + $this->assertArrayHasKey('mode', $summary); + $this->assertArrayHasKey('component', $summary); + $this->assertArrayHasKey('area', $summary); + $this->assertArrayHasKey('mappings', $summary); + // Check the important/known values + $this->assertEquals('core/eventinvalidation', $summary['id']); + $this->assertInstanceOf('lang_string', $summary['name']); + $this->assertEquals(cache_store::MODE_APPLICATION, $summary['mode']); + $this->assertEquals('core', $summary['component']); + $this->assertEquals('eventinvalidation', $summary['area']); + $this->assertInternalType('array', $summary['mappings']); + $this->assertContains('summariesstore', $summary['mappings']); + + $pluginsummaries = cache_administration_helper::get_store_plugin_summaries(); + $this->assertInternalType('array', $pluginsummaries); + $this->assertArrayHasKey('file', $pluginsummaries); + $summary = $pluginsummaries['file']; + // Check the keys + $this->assertArrayHasKey('name', $summary); + $this->assertArrayHasKey('requirementsmet', $summary); + $this->assertArrayHasKey('instances', $summary); + $this->assertArrayHasKey('modes', $summary); + $this->assertArrayHasKey('supports', $summary); + $this->assertArrayHasKey('canaddinstance', $summary); + + $locksummaries = cache_administration_helper::get_lock_summaries(); + $this->assertInternalType('array', $locksummaries); + $this->assertTrue(count($locksummaries) > 0); + + $mappings = cache_administration_helper::get_default_mode_stores(); + $this->assertInternalType('array', $mappings); + $this->assertCount(3, $mappings); + $this->assertArrayHasKey(cache_store::MODE_APPLICATION, $mappings); + $this->assertInternalType('array', $mappings[cache_store::MODE_APPLICATION]); + $this->assertContains('summariesstore', $mappings[cache_store::MODE_APPLICATION]); + + $potentials = cache_administration_helper::get_definition_store_options('core', 'eventinvalidation'); + $this->assertInternalType('array', $potentials); // Currently used, suitable, default + $this->assertCount(3, $potentials); + $this->assertArrayHasKey('summariesstore', $potentials[0]); + $this->assertArrayHasKey('summariesstore', $potentials[1]); + $this->assertArrayHasKey('default_application', $potentials[1]); + } + + /** + * Test instantiating an add store form. + */ + public function test_get_add_store_form() { + $form = cache_administration_helper::get_add_store_form('file'); + $this->assertInstanceOf('moodleform', $form); + + try { + $form = cache_administration_helper::get_add_store_form('somethingstupid'); + $this->fail('You should not be able to create an add form for a store plugin that does not exist.'); + } catch (moodle_exception $e) { + $this->assertInstanceOf('coding_exception', $e, 'Needs to be: ' .get_class($e)." ::: ".$e->getMessage()); + } + } + + /** + * Test instantiating a form to edit a store instance. + */ + public function test_get_edit_store_form() { + $config = cache_config_writer::instance(); + $this->assertTrue($config->add_store_instance('summariesstore', 'file')); + + $form = cache_administration_helper::get_edit_store_form('file', 'summariesstore'); + $this->assertInstanceOf('moodleform', $form); + + try { + $form = cache_administration_helper::get_edit_store_form('somethingstupid', 'moron'); + $this->fail('You should not be able to create an edit form for a store plugin that does not exist.'); + } catch (moodle_exception $e) { + $this->assertInstanceOf('coding_exception', $e); + } + + try { + $form = cache_administration_helper::get_edit_store_form('file', 'blisters'); + $this->fail('You should not be able to create an edit form for a store plugin that does not exist.'); + } catch (moodle_exception $e) { + $this->assertInstanceOf('coding_exception', $e); + } + } + + /** + * Test the hash_key functionality. + */ + public function test_hash_key() { + global $CFG; + + $currentdebugging = $CFG->debug; + + $CFG->debug = E_ALL; + + // First with simplekeys + $instance = cache_config_phpunittest::instance(true); + $instance->phpunit_add_definition('phpunit/hashtest', array( + 'mode' => cache_store::MODE_APPLICATION, + 'component' => 'phpunit', + 'area' => 'hashtest', + 'simplekeys' => true + )); + $factory = cache_factory::instance(); + $definition = $factory->create_definition('phpunit', 'hashtest'); + + $result = cache_helper::hash_key('test', $definition); + $this->assertEquals('test-'.$definition->generate_single_key_prefix(), $result); + + try { + cache_helper::hash_key('test/test', $definition); + $this->fail('Invalid key was allowed, you should see this.'); + } catch (coding_exception $e) { + $this->assertEquals('test/test', $e->debuginfo); + } + + // Second without simple keys + $instance->phpunit_add_definition('phpunit/hashtest2', array( + 'mode' => cache_store::MODE_APPLICATION, + 'component' => 'phpunit', + 'area' => 'hashtest2', + 'simplekeys' => false + )); + $definition = $factory->create_definition('phpunit', 'hashtest2'); + + $result = cache_helper::hash_key('test', $definition); + $this->assertEquals(sha1($definition->generate_single_key_prefix().'-test'), $result); + + $result = cache_helper::hash_key('test/test', $definition); + $this->assertEquals(sha1($definition->generate_single_key_prefix().'-test/test'), $result); + + $CFG->debug = $currentdebugging; + } +} diff --git a/cache/tests/cache_test.php b/cache/tests/cache_test.php index 138800457e680..e7f4cdc20b059 100644 --- a/cache/tests/cache_test.php +++ b/cache/tests/cache_test.php @@ -39,7 +39,7 @@ * @copyright 2012 Sam Hemelryk * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class cache_phpunit_tests extends advanced_testcase { +class core_cache_testcase extends advanced_testcase { /** * Set things back to the default before each test. diff --git a/cache/tests/locallib_test.php b/cache/tests/config_writer_test.php similarity index 57% rename from cache/tests/locallib_test.php rename to cache/tests/config_writer_test.php index 56397f212c48e..f49f65ee31727 100644 --- a/cache/tests/locallib_test.php +++ b/cache/tests/config_writer_test.php @@ -39,7 +39,7 @@ * @copyright 2012 Sam Hemelryk * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class cache_config_writer_phpunit_tests extends advanced_testcase { +class core_cache_config_writer_testcase extends advanced_testcase { /** * Set things back to the default before each test. @@ -288,204 +288,3 @@ public function test_set_definition_mappings() { } } } - -/** - * PHPunit tests for the cache API and in particular the cache_administration_helper - * - * @copyright 2012 Sam Hemelryk - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -class cache_administration_helper_phpunit_tests extends advanced_testcase { - - /** - * Set things back to the default before each test. - */ - public function setUp() { - parent::setUp(); - cache_factory::reset(); - cache_config_phpunittest::create_default_configuration(); - } - - /** - * Final task is to reset the cache system - */ - public static function tearDownAfterClass() { - parent::tearDownAfterClass(); - cache_factory::reset(); - } - - /** - * Test the numerous summaries the helper can produce. - */ - public function test_get_summaries() { - // First the preparation. - $config = cache_config_writer::instance(); - $this->assertTrue($config->add_store_instance('summariesstore', 'file')); - $config->set_definition_mappings('core/eventinvalidation', array('summariesstore')); - $this->assertTrue($config->set_mode_mappings(array( - cache_store::MODE_APPLICATION => array('summariesstore'), - cache_store::MODE_SESSION => array('default_session'), - cache_store::MODE_REQUEST => array('default_request'), - ))); - - $storesummaries = cache_administration_helper::get_store_instance_summaries(); - $this->assertInternalType('array', $storesummaries); - $this->assertArrayHasKey('summariesstore', $storesummaries); - $summary = $storesummaries['summariesstore']; - // Check the keys - $this->assertArrayHasKey('name', $summary); - $this->assertArrayHasKey('plugin', $summary); - $this->assertArrayHasKey('default', $summary); - $this->assertArrayHasKey('isready', $summary); - $this->assertArrayHasKey('requirementsmet', $summary); - $this->assertArrayHasKey('mappings', $summary); - $this->assertArrayHasKey('modes', $summary); - $this->assertArrayHasKey('supports', $summary); - // Check the important/known values - $this->assertEquals('summariesstore', $summary['name']); - $this->assertEquals('file', $summary['plugin']); - $this->assertEquals(0, $summary['default']); - $this->assertEquals(1, $summary['isready']); - $this->assertEquals(1, $summary['requirementsmet']); - $this->assertEquals(1, $summary['mappings']); - - $definitionsummaries = cache_administration_helper::get_definition_summaries(); - $this->assertInternalType('array', $definitionsummaries); - $this->assertArrayHasKey('core/eventinvalidation', $definitionsummaries); - $summary = $definitionsummaries['core/eventinvalidation']; - // Check the keys - $this->assertArrayHasKey('id', $summary); - $this->assertArrayHasKey('name', $summary); - $this->assertArrayHasKey('mode', $summary); - $this->assertArrayHasKey('component', $summary); - $this->assertArrayHasKey('area', $summary); - $this->assertArrayHasKey('mappings', $summary); - // Check the important/known values - $this->assertEquals('core/eventinvalidation', $summary['id']); - $this->assertInstanceOf('lang_string', $summary['name']); - $this->assertEquals(cache_store::MODE_APPLICATION, $summary['mode']); - $this->assertEquals('core', $summary['component']); - $this->assertEquals('eventinvalidation', $summary['area']); - $this->assertInternalType('array', $summary['mappings']); - $this->assertContains('summariesstore', $summary['mappings']); - - $pluginsummaries = cache_administration_helper::get_store_plugin_summaries(); - $this->assertInternalType('array', $pluginsummaries); - $this->assertArrayHasKey('file', $pluginsummaries); - $summary = $pluginsummaries['file']; - // Check the keys - $this->assertArrayHasKey('name', $summary); - $this->assertArrayHasKey('requirementsmet', $summary); - $this->assertArrayHasKey('instances', $summary); - $this->assertArrayHasKey('modes', $summary); - $this->assertArrayHasKey('supports', $summary); - $this->assertArrayHasKey('canaddinstance', $summary); - - $locksummaries = cache_administration_helper::get_lock_summaries(); - $this->assertInternalType('array', $locksummaries); - $this->assertTrue(count($locksummaries) > 0); - - $mappings = cache_administration_helper::get_default_mode_stores(); - $this->assertInternalType('array', $mappings); - $this->assertCount(3, $mappings); - $this->assertArrayHasKey(cache_store::MODE_APPLICATION, $mappings); - $this->assertInternalType('array', $mappings[cache_store::MODE_APPLICATION]); - $this->assertContains('summariesstore', $mappings[cache_store::MODE_APPLICATION]); - - $potentials = cache_administration_helper::get_definition_store_options('core', 'eventinvalidation'); - $this->assertInternalType('array', $potentials); // Currently used, suitable, default - $this->assertCount(3, $potentials); - $this->assertArrayHasKey('summariesstore', $potentials[0]); - $this->assertArrayHasKey('summariesstore', $potentials[1]); - $this->assertArrayHasKey('default_application', $potentials[1]); - } - - /** - * Test instantiating an add store form. - */ - public function test_get_add_store_form() { - $form = cache_administration_helper::get_add_store_form('file'); - $this->assertInstanceOf('moodleform', $form); - - try { - $form = cache_administration_helper::get_add_store_form('somethingstupid'); - $this->fail('You should not be able to create an add form for a store plugin that does not exist.'); - } catch (moodle_exception $e) { - $this->assertInstanceOf('coding_exception', $e, 'Needs to be: ' .get_class($e)." ::: ".$e->getMessage()); - } - } - - /** - * Test instantiating a form to edit a store instance. - */ - public function test_get_edit_store_form() { - $config = cache_config_writer::instance(); - $this->assertTrue($config->add_store_instance('summariesstore', 'file')); - - $form = cache_administration_helper::get_edit_store_form('file', 'summariesstore'); - $this->assertInstanceOf('moodleform', $form); - - try { - $form = cache_administration_helper::get_edit_store_form('somethingstupid', 'moron'); - $this->fail('You should not be able to create an edit form for a store plugin that does not exist.'); - } catch (moodle_exception $e) { - $this->assertInstanceOf('coding_exception', $e); - } - - try { - $form = cache_administration_helper::get_edit_store_form('file', 'blisters'); - $this->fail('You should not be able to create an edit form for a store plugin that does not exist.'); - } catch (moodle_exception $e) { - $this->assertInstanceOf('coding_exception', $e); - } - } - - /** - * Test the hash_key functionality. - */ - public function test_hash_key() { - global $CFG; - - $currentdebugging = $CFG->debug; - - $CFG->debug = E_ALL; - - // First with simplekeys - $instance = cache_config_phpunittest::instance(true); - $instance->phpunit_add_definition('phpunit/hashtest', array( - 'mode' => cache_store::MODE_APPLICATION, - 'component' => 'phpunit', - 'area' => 'hashtest', - 'simplekeys' => true - )); - $factory = cache_factory::instance(); - $definition = $factory->create_definition('phpunit', 'hashtest'); - - $result = cache_helper::hash_key('test', $definition); - $this->assertEquals('test-'.$definition->generate_single_key_prefix(), $result); - - try { - cache_helper::hash_key('test/test', $definition); - $this->fail('Invalid key was allowed, you should see this.'); - } catch (coding_exception $e) { - $this->assertEquals('test/test', $e->debuginfo); - } - - // Second without simple keys - $instance->phpunit_add_definition('phpunit/hashtest2', array( - 'mode' => cache_store::MODE_APPLICATION, - 'component' => 'phpunit', - 'area' => 'hashtest2', - 'simplekeys' => false - )); - $definition = $factory->create_definition('phpunit', 'hashtest2'); - - $result = cache_helper::hash_key('test', $definition); - $this->assertEquals(sha1($definition->generate_single_key_prefix().'-test'), $result); - - $result = cache_helper::hash_key('test/test', $definition); - $this->assertEquals(sha1($definition->generate_single_key_prefix().'-test/test'), $result); - - $CFG->debug = $currentdebugging; - } -} diff --git a/calendar/tests/externallib_test.php b/calendar/tests/externallib_test.php index e38538e6ff74e..44bb9e755bdec 100644 --- a/calendar/tests/externallib_test.php +++ b/calendar/tests/externallib_test.php @@ -38,7 +38,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @since Moodle 2.5 */ -class core_calendar_external_testcase extends externallib_advanced_testcase { +class core_calendar_externallib_testcase extends externallib_advanced_testcase { /** * Tests set up diff --git a/calendar/tests/calendarical_test.php b/calendar/tests/ical_test.php similarity index 100% rename from calendar/tests/calendarical_test.php rename to calendar/tests/ical_test.php diff --git a/cohort/tests/cohortlib_test.php b/cohort/tests/cohortlib_test.php index db0b2f0125c18..e6446e77edd1e 100644 --- a/cohort/tests/cohortlib_test.php +++ b/cohort/tests/cohortlib_test.php @@ -37,7 +37,7 @@ * @copyright 2012 Petr Skoda {@link http://skodak.org} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class cohort_testcase extends advanced_testcase { +class core_cohort_cohortlib_testcase extends advanced_testcase { public function test_cohort_add_cohort() { global $DB; diff --git a/cohort/tests/externallib_test.php b/cohort/tests/externallib_test.php index c8137fb28c1a8..8f7f4ba8d2f34 100644 --- a/cohort/tests/externallib_test.php +++ b/cohort/tests/externallib_test.php @@ -30,7 +30,7 @@ require_once($CFG->dirroot . '/webservice/tests/helpers.php'); require_once($CFG->dirroot . '/cohort/externallib.php'); -class core_cohort_external_testcase extends externallib_advanced_testcase { +class core_cohort_externallib_testcase extends externallib_advanced_testcase { /** * Test create_cohorts diff --git a/course/tests/courselib_test.php b/course/tests/courselib_test.php index 50d191ccefcb4..55db3b293a221 100644 --- a/course/tests/courselib_test.php +++ b/course/tests/courselib_test.php @@ -28,7 +28,7 @@ global $CFG; require_once($CFG->dirroot.'/course/lib.php'); -class courselib_testcase extends advanced_testcase { +class core_course_courselib_testcase extends advanced_testcase { /** * Set forum specific test values for calling create_module(). diff --git a/course/tests/courserequest_test.php b/course/tests/courserequest_test.php index d376772d78299..0b23a4eabb820 100644 --- a/course/tests/courserequest_test.php +++ b/course/tests/courserequest_test.php @@ -29,7 +29,7 @@ global $CFG; require_once($CFG->dirroot.'/course/lib.php'); -class courserequest_testcase extends advanced_testcase { +class core_course_courserequest_testcase extends advanced_testcase { public function test_create_request() { global $DB, $USER; diff --git a/course/tests/externallib_test.php b/course/tests/externallib_test.php index ab0a67e6f5f4b..86936327598ef 100644 --- a/course/tests/externallib_test.php +++ b/course/tests/externallib_test.php @@ -37,7 +37,7 @@ * @copyright 2012 Jerome Mouneyrac * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class core_course_external_testcase extends externallib_advanced_testcase { +class core_course_externallib_testcase extends externallib_advanced_testcase { /** * Tests set up diff --git a/enrol/tests/enrollib_test.php b/enrol/tests/enrollib_test.php index 5505cb2c0ba8f..250fcd8ba925a 100644 --- a/enrol/tests/enrollib_test.php +++ b/enrol/tests/enrollib_test.php @@ -34,7 +34,7 @@ * @copyright 2012 Petr Skoda {@link http://skodak.org} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class core_enrol_testcase extends advanced_testcase { +class core_enrollib_testcase extends advanced_testcase { public function test_enrol_get_all_users_courses() { global $DB, $CFG; diff --git a/enrol/tests/externallib_test.php b/enrol/tests/externallib_test.php index c93ebcb17ef70..26c80cffe4433 100644 --- a/enrol/tests/externallib_test.php +++ b/enrol/tests/externallib_test.php @@ -30,7 +30,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @since Moodle 2.4 */ -class core_enrol_external_testcase extends externallib_advanced_testcase { +class core_enrol_externallib_testcase extends externallib_advanced_testcase { /** * Test get_enrolled_users diff --git a/enrol/tests/externallib_role_test.php b/enrol/tests/role_external_test.php similarity index 98% rename from enrol/tests/externallib_role_test.php rename to enrol/tests/role_external_test.php index f3b77f01a5a61..2a8c4a877ebe8 100644 --- a/enrol/tests/externallib_role_test.php +++ b/enrol/tests/role_external_test.php @@ -30,7 +30,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @since Moodle 2.4 */ -class core_role_external_testcase extends externallib_advanced_testcase { +class core_enrol_role_external_testcase extends externallib_advanced_testcase { /** * Tests set up diff --git a/files/tests/externallib_test.php b/files/tests/externallib_test.php index ce91c1c9749cd..88fbb341a8eb8 100644 --- a/files/tests/externallib_test.php +++ b/files/tests/externallib_test.php @@ -31,7 +31,7 @@ require_once($CFG->dirroot . '/webservice/tests/helpers.php'); require_once($CFG->dirroot . '/files/externallib.php'); -class test_external_files extends advanced_testcase { +class core_files_externallib_testcase extends advanced_testcase { /* * Test core_files_external::upload(). diff --git a/grade/grading/tests/lib_test.php b/grade/grading/tests/grading_manager_test.php similarity index 98% rename from grade/grading/tests/lib_test.php rename to grade/grading/tests/grading_manager_test.php index 087f40c3b8389..0e806e812e8f9 100644 --- a/grade/grading/tests/lib_test.php +++ b/grade/grading/tests/grading_manager_test.php @@ -49,7 +49,7 @@ class testable_grading_manager extends grading_manager { * @copyright 2011 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class grading_manager_testcase extends advanced_testcase { +class core_grade_grading_manager_testcase extends advanced_testcase { public function test_basic_instantiation() { $manager1 = get_grading_manager(); diff --git a/grade/tests/edittree_test.php b/grade/tests/edittreelib_test.php similarity index 96% rename from grade/tests/edittree_test.php rename to grade/tests/edittreelib_test.php index 7cac51651a8ef..59e4a23043a3a 100644 --- a/grade/tests/edittree_test.php +++ b/grade/tests/edittreelib_test.php @@ -32,7 +32,7 @@ /** * Tests grade_edit_tree (deals with the data on the categories and items page in the gradebook) */ -class gradeedittreelib_testcase extends basic_testcase { +class core_grade_edittreelib_testcase extends basic_testcase { var $courseid = 1; var $context = null; var $grade_edit_tree = null; diff --git a/grade/tests/externallib_test.php b/grade/tests/externallib_test.php index a1cbfc5f49454..defbe491347c9 100644 --- a/grade/tests/externallib_test.php +++ b/grade/tests/externallib_test.php @@ -28,7 +28,7 @@ * @copyright 2013 Paul Charsley * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class core_grade_external_testcase extends externallib_advanced_testcase { +class core_grade_externallib_testcase extends externallib_advanced_testcase { /** * Tests set up diff --git a/grade/tests/querylib_test.php b/grade/tests/querylib_test.php index b37df3459408d..dca1a9ee786ee 100644 --- a/grade/tests/querylib_test.php +++ b/grade/tests/querylib_test.php @@ -30,7 +30,7 @@ require_once($CFG->dirroot.'/grade/querylib.php'); -class grade_querylib_testcase extends advanced_testcase { +class core_grade_querylib_testcase extends advanced_testcase { public function test_grade_get_gradable_activities() { $this->resetAfterTest(true); diff --git a/grade/tests/reportgrader_test.php b/grade/tests/report_graderlib_test.php similarity index 98% rename from grade/tests/reportgrader_test.php rename to grade/tests/report_graderlib_test.php index 07be5e32f2b6e..f3fd1ee6a1649 100644 --- a/grade/tests/reportgrader_test.php +++ b/grade/tests/report_graderlib_test.php @@ -32,7 +32,7 @@ /** * Tests grade_report_grader (the grader report) */ -class grade_report_graderlib_testcase extends advanced_testcase { +class core_grade_report_graderlib_testcase extends advanced_testcase { /** * Tests grade_report_grader::process_data() diff --git a/grade/tests/reportlib_test.php b/grade/tests/reportlib_test.php index af3f7915b878e..dac85f9da3100 100644 --- a/grade/tests/reportlib_test.php +++ b/grade/tests/reportlib_test.php @@ -61,7 +61,7 @@ public function process_action($target, $action) { /** * Tests grade_report, the parent class for all grade reports. */ -class gradereportlib_testcase extends advanced_testcase { +class core_grade_reportlib_testcase extends advanced_testcase { /** * Tests grade_report::blank_hidden_total() diff --git a/grade/tests/reportuser_test.php b/grade/tests/reportuserlib_test.php similarity index 99% rename from grade/tests/reportuser_test.php rename to grade/tests/reportuserlib_test.php index b27d717d0606e..10cea41af997c 100644 --- a/grade/tests/reportuser_test.php +++ b/grade/tests/reportuserlib_test.php @@ -33,7 +33,7 @@ /** * Tests grade_report_user (the gradebook's user report) */ -class gradereportuserlib_testcase extends advanced_testcase { +class core_grade_reportuserlib_testcase extends advanced_testcase { /** * Tests grade_report_user::inject_rowspans() diff --git a/group/tests/externallib_test.php b/group/tests/externallib_test.php index 8048d18a387c3..d3ca01ec3c271 100644 --- a/group/tests/externallib_test.php +++ b/group/tests/externallib_test.php @@ -32,7 +32,7 @@ require_once($CFG->dirroot . '/group/externallib.php'); require_once($CFG->dirroot . '/group/lib.php'); -class core_group_external_testcase extends externallib_advanced_testcase { +class core_group_externallib_testcase extends externallib_advanced_testcase { /** * Test create_groups diff --git a/iplookup/tests/geoip_test.php b/iplookup/tests/geoip_test.php index 5a363c7a015e9..3c21394c4e31a 100644 --- a/iplookup/tests/geoip_test.php +++ b/iplookup/tests/geoip_test.php @@ -29,7 +29,7 @@ /** * GeoIp data file parsing test. */ -class geoip_testcase extends advanced_testcase { +class core_iplookup_geoip_testcase extends advanced_testcase { public function test_geoip() { global $CFG; diff --git a/iplookup/tests/geoplugin_test.php b/iplookup/tests/geoplugin_test.php index 5cf0ecc030bf5..bf546970eb5a4 100644 --- a/iplookup/tests/geoplugin_test.php +++ b/iplookup/tests/geoplugin_test.php @@ -29,7 +29,7 @@ /** * GeoIp data file parsing test. */ -class geoplugin_testcase extends advanced_testcase { +class core_iplookup_geoplugin_testcase extends advanced_testcase { public function test_geoip() { global $CFG; diff --git a/lib/ajax/tests/ajaxlib_test.php b/lib/ajax/tests/ajaxlib_test.php index 7bdb28d473776..f8096f0f95e5f 100644 --- a/lib/ajax/tests/ajaxlib_test.php +++ b/lib/ajax/tests/ajaxlib_test.php @@ -35,7 +35,7 @@ * @copyright 2008 Tim Hunt * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class ajax_testcase extends advanced_testcase { +class core_ajaxlib_testcase extends advanced_testcase { var $user_agents = array( 'MSIE' => array( diff --git a/lib/ddl/tests/ddl_test.php b/lib/ddl/tests/ddl_test.php index cb44aa3ec2d3c..ea6b477252b0f 100644 --- a/lib/ddl/tests/ddl_test.php +++ b/lib/ddl/tests/ddl_test.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die(); -class ddl_testcase extends database_driver_testcase { +class core_ddl_testcase extends database_driver_testcase { private $tables = array(); private $records= array(); diff --git a/lib/dml/tests/dml_test.php b/lib/dml/tests/dml_test.php index 273dcff9e33eb..c01fedb10f0aa 100644 --- a/lib/dml/tests/dml_test.php +++ b/lib/dml/tests/dml_test.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die(); -class dml_testcase extends database_driver_testcase { +class core_dml_testcase extends database_driver_testcase { protected function setUp() { parent::setUp(); diff --git a/lib/external/tests/externallib_test.php b/lib/external/tests/external_test.php similarity index 100% rename from lib/external/tests/externallib_test.php rename to lib/external/tests/external_test.php diff --git a/lib/filestorage/tests/file_storage_test.php b/lib/filestorage/tests/file_storage_test.php index 709e886fc8261..4b8fc69ee380c 100644 --- a/lib/filestorage/tests/file_storage_test.php +++ b/lib/filestorage/tests/file_storage_test.php @@ -31,7 +31,7 @@ require_once($CFG->dirroot . '/repository/lib.php'); require_once($CFG->libdir . '/filestorage/stored_file.php'); -class filestoragelib_testcase extends advanced_testcase { +class core_files_file_storage_testcase extends advanced_testcase { /** * Files can be created from strings. diff --git a/lib/filestorage/tests/zip_packer_test.php b/lib/filestorage/tests/zip_packer_test.php index ab3728a0558c2..b5ea794238f31 100644 --- a/lib/filestorage/tests/zip_packer_test.php +++ b/lib/filestorage/tests/zip_packer_test.php @@ -26,7 +26,7 @@ defined('MOODLE_INTERNAL') || die(); -class zip_packer_testcase extends advanced_testcase { +class core_files_zip_packer_testcase extends advanced_testcase { protected $testfile; protected $files; diff --git a/lib/grade/tests/grade_category_test.php b/lib/grade/tests/grade_category_test.php index e4281a0460a12..60ad6d277ba61 100644 --- a/lib/grade/tests/grade_category_test.php +++ b/lib/grade/tests/grade_category_test.php @@ -26,7 +26,7 @@ require_once(__DIR__.'/fixtures/lib.php'); -class grade_category_testcase extends grade_base_testcase { +class core_grade_category_testcase extends grade_base_testcase { public function test_grade_category() { $this->sub_test_grade_category_construct(); diff --git a/lib/grade/tests/grade_grade_test.php b/lib/grade/tests/grade_grade_test.php index 56dddc89ea92b..1d91caa2495ae 100644 --- a/lib/grade/tests/grade_grade_test.php +++ b/lib/grade/tests/grade_grade_test.php @@ -26,7 +26,7 @@ require_once(__DIR__.'/fixtures/lib.php'); -class grade_grade_testcase extends grade_base_testcase { +class core_grade_grade_testcase extends grade_base_testcase { public function test_grade_grade() { $this->sub_test_grade_grade_construct(); diff --git a/lib/grade/tests/grade_item_test.php b/lib/grade/tests/grade_item_test.php index 03cc3dbbdecd0..b884d8dccd63d 100644 --- a/lib/grade/tests/grade_item_test.php +++ b/lib/grade/tests/grade_item_test.php @@ -25,7 +25,7 @@ require_once(__DIR__.'/fixtures/lib.php'); -class grade_item_testcase extends grade_base_testcase { +class core_grade_item_testcase extends grade_base_testcase { public function test_grade_item() { $this->sub_test_grade_item_construct(); $this->sub_test_grade_item_insert(); diff --git a/lib/grade/tests/grade_outcome_test.php b/lib/grade/tests/grade_outcome_test.php index 78ea8516b163b..91dc257a53dc1 100644 --- a/lib/grade/tests/grade_outcome_test.php +++ b/lib/grade/tests/grade_outcome_test.php @@ -26,7 +26,7 @@ require_once(__DIR__.'/fixtures/lib.php'); -class grade_outcome_testcase extends grade_base_testcase { +class core_grade_outcome_testcase extends grade_base_testcase { public function test_grade_outcome() { $this->sub_test_grade_outcome_construct(); diff --git a/lib/grade/tests/grade_scale_test.php b/lib/grade/tests/grade_scale_test.php index f1322222823a8..2cb1c977acf12 100644 --- a/lib/grade/tests/grade_scale_test.php +++ b/lib/grade/tests/grade_scale_test.php @@ -26,7 +26,7 @@ require_once(__DIR__.'/fixtures/lib.php'); -class grade_scale_testcase extends grade_base_testcase { +class core_grade_scale_testcase extends grade_base_testcase { public function test_grade_scale() { $this->sub_test_scale_construct(); diff --git a/message/tests/externallib_test.php b/message/tests/externallib_test.php index 83f9f6cd07402..cddd3e38e6971 100644 --- a/message/tests/externallib_test.php +++ b/message/tests/externallib_test.php @@ -30,7 +30,7 @@ require_once($CFG->dirroot . '/webservice/tests/helpers.php'); require_once($CFG->dirroot . '/message/externallib.php'); -class core_message_external_testcase extends externallib_advanced_testcase { +class core_message_externallib_testcase extends externallib_advanced_testcase { /** * Send a fake message. diff --git a/notes/tests/externallib_test.php b/notes/tests/externallib_test.php index 7e85630ebe41b..645b7ddcf1787 100644 --- a/notes/tests/externallib_test.php +++ b/notes/tests/externallib_test.php @@ -30,7 +30,7 @@ require_once($CFG->dirroot . '/webservice/tests/helpers.php'); require_once($CFG->dirroot . '/notes/externallib.php'); -class core_notes_external_testcase extends externallib_advanced_testcase { +class core_notes_externallib_testcase extends externallib_advanced_testcase { /** * Test create_notes diff --git a/phpunit.xml.dist b/phpunit.xml.dist index ee1ad83de943a..4932dda34cc9d 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -31,11 +31,13 @@ lib/testing/tests - + lib/ddl/tests + + lib/dml/tests - + lib/tests lib/ajax/tests lib/form/tests diff --git a/repository/tests/generator_test.php b/repository/tests/generator_test.php index c6954985fd85e..d21fc355ddee0 100644 --- a/repository/tests/generator_test.php +++ b/repository/tests/generator_test.php @@ -33,7 +33,7 @@ * @copyright 2013 Frédéric Massart * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class repository_generator_testcase extends advanced_testcase { +class core_repository_generator_testcase extends advanced_testcase { /** * Basic test of creation of repository types. diff --git a/repository/tests/repository_test.php b/repository/tests/repositorylib_test.php similarity index 99% rename from repository/tests/repository_test.php rename to repository/tests/repositorylib_test.php index 9b4c8ae4ee46f..3d41ab0f8a9e5 100644 --- a/repository/tests/repository_test.php +++ b/repository/tests/repositorylib_test.php @@ -28,7 +28,7 @@ global $CFG; require_once("$CFG->dirroot/repository/lib.php"); -class repositorylib_testcase extends advanced_testcase { +class core_repositorylib_testcase extends advanced_testcase { /** * Installing repository tests diff --git a/user/tests/externallib_test.php b/user/tests/externallib_test.php index ae5cfdda1e9f7..f58271e62fd39 100644 --- a/user/tests/externallib_test.php +++ b/user/tests/externallib_test.php @@ -31,7 +31,7 @@ require_once($CFG->dirroot . '/webservice/tests/helpers.php'); require_once($CFG->dirroot . '/user/externallib.php'); -class core_user_external_testcase extends externallib_advanced_testcase { +class core_user_externallib_testcase extends externallib_advanced_testcase { /** * Test get_users diff --git a/webservice/tests/externallib_test.php b/webservice/tests/externallib_test.php index 8f21a12ecc8f2..7b8588d1742bc 100644 --- a/webservice/tests/externallib_test.php +++ b/webservice/tests/externallib_test.php @@ -28,7 +28,7 @@ * @copyright 2012 Paul Charsley * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class core_webservice_external_testcase extends externallib_advanced_testcase { +class core_webservice_externallib_testcase extends externallib_advanced_testcase { public function setUp() { // Calling parent is good, always