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:
@@ -18,11 +18,16 @@
|
||||
* Unit tests for Random allocation
|
||||
*
|
||||
* @package workshopallocation_random
|
||||
* @category phpunit
|
||||
* @category test
|
||||
* @copyright 2009 David Mudrak <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace workshopallocation_random;
|
||||
|
||||
use workshop;
|
||||
use workshop_random_allocator;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
// Include the code to test
|
||||
@@ -30,8 +35,15 @@ global $CFG;
|
||||
require_once($CFG->dirroot . '/mod/workshop/locallib.php');
|
||||
require_once($CFG->dirroot . '/mod/workshop/allocation/random/lib.php');
|
||||
|
||||
|
||||
class workshopallocation_random_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Unit tests for Random allocation
|
||||
*
|
||||
* @package workshopallocation_random
|
||||
* @category test
|
||||
* @copyright 2009 David Mudrak <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class allocator_test extends \advanced_testcase {
|
||||
|
||||
/** workshop instance emulation */
|
||||
protected $workshop;
|
||||
@@ -63,8 +75,8 @@ class workshopallocation_random_testcase extends advanced_testcase {
|
||||
|
||||
public function test_self_allocation_equal_user_groups() {
|
||||
// fixture setup
|
||||
$authors = array(0 => array_fill_keys(array(4, 6, 10), new stdclass()));
|
||||
$reviewers = array(0 => array_fill_keys(array(4, 6, 10), new stdclass()));
|
||||
$authors = array(0 => array_fill_keys(array(4, 6, 10), new \stdClass()));
|
||||
$reviewers = array(0 => array_fill_keys(array(4, 6, 10), new \stdClass()));
|
||||
// exercise SUT
|
||||
$newallocations = $this->allocator->self_allocation($authors, $reviewers);
|
||||
// verify
|
||||
@@ -73,8 +85,8 @@ class workshopallocation_random_testcase extends advanced_testcase {
|
||||
|
||||
public function test_self_allocation_different_user_groups() {
|
||||
// fixture setup
|
||||
$authors = array(0 => array_fill_keys(array(1, 4, 5, 10, 13), new stdclass()));
|
||||
$reviewers = array(0 => array_fill_keys(array(4, 7, 10), new stdclass()));
|
||||
$authors = array(0 => array_fill_keys(array(1, 4, 5, 10, 13), new \stdClass()));
|
||||
$reviewers = array(0 => array_fill_keys(array(4, 7, 10), new \stdClass()));
|
||||
// exercise SUT
|
||||
$newallocations = $this->allocator->self_allocation($authors, $reviewers);
|
||||
// verify
|
||||
@@ -83,8 +95,8 @@ class workshopallocation_random_testcase extends advanced_testcase {
|
||||
|
||||
public function test_self_allocation_skip_existing() {
|
||||
// fixture setup
|
||||
$authors = array(0 => array_fill_keys(array(3, 4, 10), new stdclass()));
|
||||
$reviewers = array(0 => array_fill_keys(array(3, 4, 10), new stdclass()));
|
||||
$authors = array(0 => array_fill_keys(array(3, 4, 10), new \stdClass()));
|
||||
$reviewers = array(0 => array_fill_keys(array(3, 4, 10), new \stdClass()));
|
||||
$assessments = array(23 => (object)array('authorid' => 3, 'reviewerid' => 3));
|
||||
// exercise SUT
|
||||
$newallocations = $this->allocator->self_allocation($authors, $reviewers, $assessments);
|
||||
@@ -121,7 +133,7 @@ class workshopallocation_random_testcase extends advanced_testcase {
|
||||
87 => (object)array('id' => 121, 'authorid' => 3),
|
||||
);
|
||||
// exercise SUT
|
||||
$this->expectException(moodle_exception::class);
|
||||
$this->expectException(\moodle_exception::class);
|
||||
$submissions = $this->allocator->index_submissions_by_authors($submissions);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user