46 Commits

Author SHA1 Message Date
Meirza
337bc1554a MDL-78164 lib: Added class properties that are not declared in grade
In PHP 8.2 and later, setting a value to an undeclared class property is
deprecated and emits a deprecation notice.
So we need to add missing class properties that still need to be declared.

Co-authored-by: Andrew Nicols <andrew@nicols.co.uk>
2023-06-21 14:41:35 +07:00
Marina Glancy
8fc1486d36 MDL-77164 various: fix incorrect phpdocs 2023-04-13 11:35:06 +01:00
Sara Arjona
1147a9fe9d MDL-72350 mod: Remove mod_assignment
The Assignment 2.2 activity module was disabled in 2012 but kept to
enable pre-2.2 backups to be restored and have the assignments
auto-converted to new assignments. After almost 10 years, it's time
to remove it from Moodle core.
2023-03-30 09:00:10 +08:00
Eloy Lafuente (stronk7)
83b490a594 MDL-75111 phpunit: Move tests to use correct names and ns (take#4)
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:

- The following task tests have been moved within the level2 directory:
  - \core\adhoc_task_test => \core\task\adhoc_task_test
  - \core\scheduled_task_test => \core\task\scheduled_task_test
  - \core\calendar_cron_task_test => \core\task\calendar_cron_task_test
  - \core\h5p_get_content_types_task_test => \core\task\h5p_get_content_types_task_test
  - \core\task_database_logger_test => \core\task\database_logger_test
  - \core\task_logging_test => \core\task\logging_test

- The following event tests have been moved within level2 directory:
  - \core\event_context_locked_test => \core\event\context_locked_test
  - \core\event_deprecated_test => \core\event\deprecated_test
  - \core\event_grade_deleted_test => \core\event\grade_deleted_test
  - \core\event_profile_field_test => \core\event\profile_field_test
  - \core\event_unknown_logged_test => \core\event\unknown_logged_test
  - \core\event_user_graded_test => \core\event\user_graded_test
  - \core\event_user_password_updated_test => \core\event\user_password_updated_test

- The following output tests have been moved within level2 directory:
  - \core\mustache_template_finder_test => \core\output\mustache_template_finder_test
  - \core\mustache_template_source_loader_test => \core\output\mustache_template_source_loader_test
  - \core\output_mustache_helper_collection_test => \core\output\mustache_helper_collection_test

- The following tests have been moved to their correct tests directories:
  - lib/tests/time_splittings_test.php => analytics/tests/time_splittings_test.php

- All the classes and tests under lib/filebrowser and lib/filestorage
  belong to core, not to core_files. Some day we should move
  them to their correct subsystem.
- All the classes and tests under lib/grade belong to core, not
  to core_grades. Some day we should move them to their correct
  subsystem.
- The core_grades_external class and its \core\grades_external_test
  unit test should belong to the grades subsystem or, alternatively,
  to \core\external, they both should be moved together.
- The core_grading_external class and its \core\grading_external_test
  unit test should belong to the grading subsystem or, alternatively,
  to \core\external, they both should be moved together.
- The \core\message\message and \core\message\inbound (may be others)
  classes, and their associated tests should go to the core_message
  subsystem.
- The core_user class, and its associated tests should go to the
  core_user subsystem.
- The \core\update namespace is plain wrong (update is not valid API)
  and needs action 1) create it or 2) move elsewhere.
2022-08-26 16:34:20 +02:00
Eloy Lafuente (stronk7)
e0d79c8e71 MDL-74449 gradebook: Protect flatten_dependencies_array() a little bit
It has been detected that the flatten_dependencies_array() was fragile
and leading to wrong results when some incorrect data was passed to it.

This includes:

- Missing elements.
- Null dependencies.
- Non array dependencies.

While the existing behaviour (testing-wise) has been preserved, now the
situations above are better controlled and the function ignores all
those incorrect cases that shouldn't happen ever.

That implies that a good number of notices/warnings/errors aren't
happening anymore. That was impacting both results (when the problems
were  only notices and warnings) and execution (when the problems
were errors).

Covered with tests.
2022-06-10 18:17:53 +02:00
Luca Bösch
aa9a591ecd MDL-70433 grades: prevent double escaping in titles 2021-08-27 10:56:20 +02:00
Sujith Haridasan
7b3f43db95 MDL-57020 scales: Allow deletion of unused scales in forum
Allow deletion of unused scales used in a
forum for the course.

Signed-off-by: Sujith Haridasan <sujith@moodle.com>
2021-01-15 15:07:53 +05:30
John Yao
11886d37ed MDL-67636 gradebook: Prevent exposing hidden grade in locked category 2020-11-19 14:29:55 +11:00
Eloy Lafuente (stronk7)
3a5641cb74 MDL-67673 phpunit: Remove deprecated assertEquals() params
The optional parameters of assertEquals() and assertNotEquals()
are deprecated in PHPUnit 8 (to be removed in PHPUnit 9):

- delta => use assertEqualsWithDelta()
- canonicalize => use assertEqualsCanonicalizing()
- ignoreCase => use assertEqualsIgnoringCase
- maxDepth => removed without replacement.

More info @ https://github.com/sebastianbergmann/phpunit/issues/3341

Initial search done with:

ag 'assert(Not)?Equals\(.*,.*,' --php

Then, running tests and fixing remaining cases.
2020-10-21 12:46:00 +02:00
Eloy Lafuente (stronk7)
f6711bb394 MDL-67673 phpunit: Fix the return type of template methods
All the setup/teardown/pre/post/conditions template methods
now are required to return void. This was warned with phpunit 7
and now is enforced.

At the same time, fix a few wrong function names,
provider data and param types, return statements...
2020-10-21 12:45:59 +02:00
Nathan Nguyen
293760a4b5 MDL-68680 core_grades: check grade item before trigger delete event 2020-08-28 08:58:20 +10:00
Matt Davidson
887679e510 MDL-68163 gradebook: add grade item duplication 2020-06-02 09:28:29 -04:00
Nathan Nguyen
2aaac3f670 MDL-46978 core_grades: preserve category total visibility 2019-09-19 14:05:01 +10:00
Dmitrii Metelkin
f82931c169 MDL-65922 core: add grade_item_updated event 2019-06-21 08:54:37 +10:00
Dmitrii Metelkin
657cc33be9 MDL-65622 core: add grade_item_created event 2019-06-07 07:38:41 +10:00
Mark Nelson
ac81c98648 MDL-63591 core_grades: delete files when grade object is deleted 2018-11-21 16:15:12 +08:00
Michael Aherne
0c0f01aa4c MDL-54613 unit tests: Add iteminstance to test grade_item 2016-05-17 13:06:32 +01:00
David Monllao
1076e02f29 MDL-53309 grades: Only update when required 2016-04-15 15:15:32 +08:00
Damyon Wiese
d629c601c5 MDL-48634 grades: Add an option to rescale when changing the maxgrade 2016-02-05 18:20:17 +08:00
Colin Campbell
7006ab3eb7 MDL-51715 lib/grade: Unit test for aggregationweight 2015-11-02 10:15:05 -06:00
Frederic Massart
01a088e0a2 MDL-50062 grades: Tests for item::set_aggregation_fields_for_aggregation 2015-08-06 10:24:25 +08:00
Frederic Massart
2eb4a83c29 MDL-48618 grades: Unit tests for grade_grade::get_min/max_grade() 2015-06-10 12:33:41 +08:00
Damyon Wiese
47d6e6a7d3 MDL-47503 Grades: Completely remove aggregationsubcats
This setting is not compatible with combinations of aggregation methods
and the ways in which it does and does not work are not documented. It
was voted to remove it completely by the gradebook workshop, so I have
completely removed it and added a warning for all affected courses + restored
backups.
2014-10-20 12:03:18 +08:00
Frederic Massart
26331e3d17 MDL-46647 core_grades: Adding tests for fetch_all_helper() 2014-10-07 15:23:05 +08:00
Damyon Wiese
0db54b5ba2 MDL-46997 Grades: Fix aggregation when hiding is excluded and items have nested dependencies
Includes a unit test for the dependency flattening function.
2014-09-09 17:11:59 +08:00
Frederic Massart
3774d40f8c MDL-16474 scale: Allow scales with 1 item 2014-06-30 14:24:24 +08:00
Dan Poltawski
e6fbca9f65 Merge branch 'wip-mdl-43306-m' of git://github.com/rajeshtaneja/moodle 2014-01-20 09:45:43 +08:00
Rajesh Taneja
8acec2a693 MDL-43306 restore: Fix grade_item sortorder after restoring course
While restoring course/activity, restore will blindly insert grade_item
sortorder. Which cause dulicate sortorder and lead to unpredicatble sorting
results.

Now we will call grade_item::fix_duplicate_sortorder() after restore is finished
to fix duplicate sortorder and order grade items to the closest order possible
2014-01-15 10:28:00 +08:00
Damyon Wiese
40cb48792a MDL-33952 Assignment - bon voyage!
mod_assignment has been replaced with a stub that only exists to support restoring and
auto upgrading to mod_assign. If you require mod_assignment for some old plugin, then
overwrite with the 2.6 version manually.
2014-01-08 14:51:06 +08:00
Rajesh Taneja
134c514be0 MDL-21180 Gradebook: Consistent handling of change in aggregation
Change from/to GRADE_AGGREGATE_WEIGHTED_MEAN and GRADE_AGGREGATE_EXTRACREDIT_MEAN was only
handled prior to this patch. GRADE_AGGREGATE_SUM and GRADE_AGGREGATE_WEIGHTED_MEAN2 also
behave similar and should be handled same way
2013-12-16 09:57:42 +08:00
Sam Chaffee
87a26cc402 MDL-42065 core_grade: Modified some grade_item queries for improved performance
* Modified 2 queries in grade_item::depends_on to improve performance
* Added additional unit tests to cover those queries better
2013-10-09 12:16:54 -06:00
Petr Škoda
686d4ec921 MDL-41022 cleanup core_grade_scale_testcase 2013-08-24 16:21:09 +02:00
Petr Škoda
c952e0911d MDL-41022 cleanup core_grade_item_testcase 2013-08-24 16:21:01 +02:00
Petr Škoda
78953f03fd MDL-41022 cleanup core_grade_grade_testcase 2013-08-24 16:20:53 +02:00
Petr Škoda
59c50aff20 MDL-41022 cleanup core_grade_category_testcase 2013-08-24 16:19:25 +02:00
Tim Hunt
3987312883 MDL-31487 fix FEATURE_CONTROLS_GRADE_VISIBILITY for quiz.
This is a followup to MDL-18301. That fix missed the following points:

1. On the edit categories and items screens, all items had an eye-con to
control the visibility, even if the visibility was controlled by the
module.

2. Changing the visibility of a grade category change the visibility of
all items within it, even if the visibility was controlled by the
module.

3. The quiz ingored $cm->visible when controlling whether its grade item
was visible.
2013-08-08 10:03:47 +01:00
Petr Škoda
8252b7c291 MDL-40901 standardise core test case class and file names
This finally allows us to type only the class name when executing individual core test cases.
2013-08-04 22:10:31 +02:00
Andrew Davis
59772c066a MDL-31713 core_grade:added a unit test to replicate a raw grade max bug 2013-05-07 11:14:08 +08:00
Eloy Lafuente (stronk7)
82b61ff8a5 MDL-37952 make helper descendants abstract 2013-02-09 16:22:06 +01:00
Andrew Davis
69bcca5e9c MDL-36061 core_grade: added some unit tests related to refresh_grades() 2012-11-15 11:14:21 +08:00
Andrew Davis
97512dd36b MDL-35667 core_grade: added a new test for grade_category::apply_limit_rules() 2012-10-01 12:53:26 +08:00
Andrew Davis
fb80cb2aa4 MDL-13629 grade: added some unit tests to clarify the handling of droplow and improved apply_limit_rules() 2012-07-25 09:35:28 +08:00
Petr Skoda
6b04fdc0b6 MDL-32400 improve module generators
Module generators are using standard *_add_instance() methods which helps with testing, it also updates grades and calendar events if used.
2012-04-15 14:16:59 +02:00
Petr Skoda
bd42a2657e MDL-32323 do try to fetch all other grade objects with existing test fields 2012-04-11 22:56:27 +02:00
Petr Skoda
15db9f7d66 MDL-32323 do try to fetch grades with existing test fields 2012-04-11 22:41:37 +02:00
Petr Skoda
948d46da34 MDL-32323 add grade tests 2012-04-10 15:27:10 +02:00