MDL-73485 phpunit: externallib, generator and filter tescase names

All externallib_test, generator_test and filter_test classes:

- Namespaced with component[\level2-API]
- Moved to level2-API subdirectory when required.
- Fixed incorrect use statements with leading backslash.
- Changed code to point to global scope when needed.
- Fix some relative paths and comments here and there.
- All them passing individually.
- Complete runs passing too.

Special mention to tests under testing/tests:

1) The core_testing component doesn't exist.
2) But testing/tests are allowed because there is a suite pointing to it (phpunit.xml).
3) So, the only possible namespace for them is "core".
4) And to avoid problems with other core testcases (under lib/tests)
   they have been renamed to have testing_xxxx as prefix.

Finally, also modified calendar/tests/events/events_test.php because it uses
some renamed (core_calendar_externallib_testcase => \core_calendar\externallib_test)
classes.
This commit is contained in:
Eloy Lafuente (stronk7)
2022-01-21 19:48:23 +01:00
parent e63604fb6d
commit 100bc51f1d
85 changed files with 2339 additions and 2606 deletions
+4 -11
View File
@@ -14,24 +14,17 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* mod_folder generator tests
*
* @package mod_folder
* @category test
* @copyright 2013 Marina Glancy
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace mod_folder;
/**
* Genarator tests class for mod_folder.
* Generator tests class for mod_folder.
*
* @package mod_folder
* @category test
* @copyright 2013 Marina Glancy
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class mod_folder_generator_testcase extends advanced_testcase {
class generator_test extends \advanced_testcase {
public function test_create_instance() {
global $DB, $USER;
@@ -57,7 +50,7 @@ class mod_folder_generator_testcase extends advanced_testcase {
'course' => $course->id,
'files' => file_get_unused_draft_itemid()
);
$usercontext = context_user::instance($USER->id);
$usercontext = \context_user::instance($USER->id);
$filerecord = array('component' => 'user', 'filearea' => 'draft',
'contextid' => $usercontext->id, 'itemid' => $params['files'],
'filename' => 'file1.txt', 'filepath' => '/');