MDL-74413 phpunit: Move more tests to use correct names and namespaces

Applied the following changes to various testcase classes:

- Namespaced with component[\level2-API]
- Moved to level2-API subdirectory when required.
- Fixed incorrect use statements with leading backslash.
- Remove file phpdoc block
- Remove MOODLE_INTERNAL if not needed.
- 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:

- Moved to the level2 "privacy" namespace:
  - \mod_assign\privacy\feedback_legacy_polyfill_test
  - \mod_assign\privacy\submission_legacy_polyfill_test

- Moved to the level2 "task" namespace:
  - \core_message\task\migrate_message_data_test
  - \ltiservice_gradebookservices\task\cleanup_test
  - \message_email\task\send_email_test
  - \mod_lti\task\clean_access_tokens_test
  - \mod_workshop\task\cron_task_test

- Moved to the level2 "event" namespace:
  - \core_h5p\event\deleted_test
  - \core_h5p\event\viewed_test

- Renamed to a better name:
  - backup_forum_activity_task_test.php (missing "task")
This commit is contained in:
Eloy Lafuente (stronk7)
2022-05-07 20:33:10 +02:00
parent 99fc164199
commit d8ea630f24
106 changed files with 1081 additions and 1507 deletions
+8 -10
View File
@@ -14,14 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Unit tests for grade/report/lib.php.
*
* @package core_grades
* @category phpunit
* @copyright Andrew Nicols <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
namespace core_grades;
defined('MOODLE_INTERNAL') || die();
@@ -31,8 +24,13 @@ require_once($CFG->dirroot.'/grade/export/lib.php');
/**
* A test class used to test grade_report, the abstract grade report parent class
*
* @package core_grades
* @category test
* @copyright Andrew Nicols <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
class core_grade_export_test extends advanced_testcase {
class export_test extends \advanced_testcase {
/**
* Ensure that feedback is correct formatted. Test the default implementation of format_feedback
@@ -67,7 +65,7 @@ class core_grade_export_test extends advanced_testcase {
$dg = $this->getDataGenerator();
$c1 = $dg->create_course();
$u1 = $dg->create_user();
$gi1a = new grade_item($dg->create_grade_item(['courseid' => $c1->id]), false);
$gi1a = new \grade_item($dg->create_grade_item(['courseid' => $c1->id]), false);
$gi1a->update_final_grade($u1->id, 1, 'test');
$contextid = $gi1a->get_context()->id;
$gradeid = $gi1a->id;