Skip to content

Commit

Permalink
StudentQuiz: Add static to provider function and rename variable
Browse files Browse the repository at this point in the history
  • Loading branch information
hieuvu authored and AnupamaSarjoshi committed Feb 11, 2025
1 parent 51e30dd commit f3fb08b
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion tests/add_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function test_add_studentquiz_with_expected_completion() {
* @see test_add_studentquiz_with_normal_period()
* @return array
*/
public function period_provider() {
public static function period_provider() {
$periods = range(container::DELETION_PERIOD_MIN, container::DELETION_PERIOD_MAX);
shuffle($periods);
$periods = array_slice($periods, 0, 5);
Expand Down
34 changes: 17 additions & 17 deletions tests/backup_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,71 +118,71 @@ protected function restore_sq_backup_file_to_course_shortname(string $filename,
* @coversNothing
* @return array
*/
public function old_sq_backup_data_provider(): array {
public static function old_sq_backup_data_provider(): array {

return [
'aggregated before' => [
'filename' => 'backup-moodle2-aggregated-before.mbz',
'coursefullname' => 'aggregated before',
'courseshortname' => 'ab',
'correct_answered_points' => [1, 2],
'total_points' => [32, 23],
'correctanswerpoints' => [1, 2],
'totalpoints' => [32, 23],
'questionname' => 'first',
],
'during 0' => [
'filename' => 'backup-moodle2-aggregated-during-0.mbz',
'coursefullname' => 'during 0',
'courseshortname' => 'd0',
'correct_answered_points' => [2, 1],
'total_points' => [28, 20],
'correctanswerpoints' => [2, 1],
'totalpoints' => [28, 20],
'questionname' => 'q1',
],
'during 1' => [
'filename' => 'backup-moodle2-aggregated-during-1.mbz',
'coursefullname' => 'during 1',
'courseshortname' => 'd1',
'correct_answered_points' => [2, 1],
'total_points' => [28, 20],
'correctanswerpoints' => [2, 1],
'totalpoints' => [28, 20],
'questionname' => 'q2',
],
'Missing state' => [
'filename' => 'backup-moodle2-course-two-moodle_35_sq404_missingstate.mbz',
'coursefullname' => 'Course Two',
'courseshortname' => 'C2',
'correct_answered_points' => [0],
'total_points' => [10],
'correctanswerpoints' => [0],
'totalpoints' => [10],
'questionname' => 'False is correct',
],
'Correct state' => [
'filename' => 'backup-moodle2-course-two-moodle_35_sq404_correctstate.mbz',
'coursefullname' => 'Course Two',
'courseshortname' => 'C2',
'correct_answered_points' => [0],
'total_points' => [15],
'correctanswerpoints' => [0],
'totalpoints' => [15],
'questionname' => 'False is correct',
],
'SQ in M311' => [
'filename' => 'backup-moodle2-course-with-studentquiz-m311.mbz',
'coursefullname' => 'Course Three',
'courseshortname' => 'C3',
'correct_answered_points' => [0, 0],
'total_points' => [0, 0],
'correctanswerpoints' => [0, 0],
'totalpoints' => [0, 0],
'questionname' => 'Test T/F Question',
],
'SQ in M311 with question data' => [
'filename' => 'backup-moodle2-course-2-311-with-questiondata.mbz',
'coursefullname' => 'Course Two',
'courseshortname' => 'C2',
'correct_answered_points' => [2, 0, 0],
'total_points' => [31, 21, 0],
'correctanswerpoints' => [2, 0, 0],
'totalpoints' => [31, 21, 0],
'questionname' => 'T/F Student',
],
'SQ 4.0' => [
'filename' => 'backup-moodle2-course-with-studentquiz-m400.mbz',
'coursefullname' => 'Course Four',
'courseshortname' => 'C4',
'correct_answered_points' => [0, 0],
'total_points' => [0, 0],
'correctanswerpoints' => [0, 0],
'totalpoints' => [0, 0],
'questionname' => 'Question T/F for 4.0',
]
];
Expand Down
2 changes: 1 addition & 1 deletion tests/comment_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ public function test_shorten_comment(string $content, string $expected, int $exp
* @coversNothing
* @return array
*/
public function test_shorten_comment_provider(): array {
public static function test_shorten_comment_provider(): array {

return [
'Root comment with newline html content' => [
Expand Down
2 changes: 1 addition & 1 deletion tests/cron_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public function test_send_digest_notification_task(string $state) {
* @coversNothing
* @return array List data of state.
*/
public function state_data_provider(): array {
public static function state_data_provider(): array {
return [
'Notifying updated question state to changed' => [
'state' => studentquiz_helper::$statename[studentquiz_helper::STATE_CHANGED],
Expand Down
2 changes: 1 addition & 1 deletion tests/permissions_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class permissions_test extends \advanced_testcase {
*
* @return array
*/
public function ensure_permissions_are_right_testcases(): array {
public static function ensure_permissions_are_right_testcases(): array {
return [
'default student role' => [
'student',
Expand Down
2 changes: 1 addition & 1 deletion tests/utils_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function test_send_report() {
*
* @return array
*/
public function ensure_question_version_status_is_correct_testcases(): array {
public static function ensure_question_version_status_is_correct_testcases(): array {
return [
'ready' => [
'ready', false
Expand Down

0 comments on commit f3fb08b

Please sign in to comment.