184 Commits

Author SHA1 Message Date
Andrew Nicols
094f5dbb5b
Merge branch 'MDL-77745_master' of https://github.com/marxjohnson/moodle 2023-07-21 11:58:34 +08:00
Mark Johnson
ab8a4dd8cb MDL-77745 core_question: Show question version in info box 2023-07-13 11:11:43 +01:00
danghieu1407
ab4cb28883 MDL-76757 Question bank: Can not delete the question completely 2023-07-10 14:30:01 +07:00
Jun Pataleta
d3767cb9f6
Merge branch 'MDL-78488' of https://github.com/t-schroeder/moodle 2023-07-06 11:17:03 +08:00
Tim Schroeder
b42ca2cbbd
MDL-78488 question bank: don't load statistics when they are disabled 2023-06-30 11:39:04 +02:00
Tim Hunt
3534b31745 MDL-78608 question stats: avoid loading data for missing contexts
It turns out that there are plugins which don't (currently)
clean up their question attempts when a context is deleted.
Therefore, we need to make Moodle core robust to that.
2023-06-28 17:16:48 +01:00
Tim Hunt
174e2ae3b5 MDL-75576 quiz statistics: don't compute when a user views the qbank
Previously, when a user viewed the question bank, if the quiz statistics
had not already been calculated, we would try to compute them there an then.
This could be very, very slow, leading to session lock problems.

Now, we never try to compute the statistics on the fly. Instead, we rely
on the existing \quiz_statistics\task\recalculate scheduled task to do it.
2023-05-15 09:59:34 +01:00
Tim Hunt
056db339d6 MDL-75576 question bank: bulk-load statistics for all questions at once
There is a new method on the column class, for the column to declare any
statistics it requires. The question then efficiently loads all those
statistics in one go, and makes them available as the columns are
rendererd, or do any subsequent processing.
2023-05-15 09:59:34 +01:00
Tim Hunt
9775be13e9 MDL-78025 question generator: make the behaviour less surprising
* The object returned by update_question is alwasy a new clone
  and the $question passed in will not be modified.

* The returned object has the fields like questionbankentryid and
  the ones related to versionning, so it is more like the data
  returned by question_bank::load_question_data.
2023-04-26 10:49:35 +01:00
Andrew Nicols
fcba0cb379 MDL-77989 core: Fix uses of legacy external API 2023-04-21 13:33:56 +08:00
Víctor Déniz
b576b068bd MDL-77878 lang: Use fixed strings in tests 2023-04-17 08:49:59 +01:00
Marina Glancy
4d765cd699 MDL-77164 privacy: typehint test content writer 2023-04-13 09:43:15 +01:00
Mark Johnson
bddfd39804 MDL-75301 question: Add behat generator for updating questions
This adds "core_question > updated question" as an entity for `the
following "X" exist` and calls the existing update_question() generator
which will create a new question version with the supplied data.
2023-04-03 12:31:15 +01:00
Paul Holden
813800d218
Merge branch 'MDL-75017' of https://github.com/timhunt/moodle 2023-03-30 08:47:52 +01:00
Tim Hunt
94a584bf38 MDL-75017 questions: give a clear error if the context type is invalid 2023-03-24 12:59:22 +00:00
Tim Hunt
d5086a0938 MDL-77626 quiz statistics: Divide by zero if a random Q has max mark 0 2023-03-14 16:29:12 +00:00
Meirza
e4b24bdd79 MDL-77299 question: Added class properties that are not declared.
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: Tim Hunt <t.j.Hunt@open.ac.uk>
2023-03-01 10:09:09 +07:00
Tim Hunt
837d1cbf52 MDL-76843 questions behat: enhancements requried to test this issue
* New steps to set up certian sorts of broken test data.
* Fix qtype_essay_question::un_summarise_response().
2023-02-22 14:30:22 +00:00
Andrew Nicols
ea1f5eba27 Merge branch 'MDL-76904-master' of https://github.com/NashTechOpenUniversity/moodle 2023-02-09 12:04:21 +08:00
hieuvu
1912982e95 MDL-76904 question: Keep question highlight in url 2023-01-31 16:33:32 +07:00
Andrew Nicols
5c2d98efcd MDL-76362 question: Refactor question number unit tests 2023-01-23 09:15:54 +08:00
Simey Lameze
bb0aeafb25 MDL-76870 question: change assertion to assertEqualsCanonicalizing
By using that assertion the arrays will be sorted before comparison
preventing any Oracle sorting related failures.

Credits for the solution go to Tim Hunt!
2023-01-13 18:12:48 +08:00
Andrew Nicols
bcbdb8764a MDL-76169 question: General behat fixes
Whilst amending these tests I discovered some other minor fixes to be
made.
2022-11-03 21:39:15 +08:00
Andrew Nicols
8ffbaad330 MDL-76169 question: Use action menu steps consistently 2022-11-03 21:39:15 +08:00
Andrew Nicols
3d70f457cb MDL-76169 mod_quiz: Add quiz question bank behat resolver 2022-11-03 21:39:15 +08:00
Eloy Lafuente (stronk7)
839c2e5c18 MDL-75777 phpunit: Move tests to use correct names and ns (take#6)
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.
2022-09-19 11:01:21 +02:00
Mahmoud Kassaei
1edb5f7581 MDL-75051 Questions: Selecting idnumber in the question bank,
the copy/pasting, includes extraneous text in Chrome
2022-09-09 10:11:45 +01:00
Safat Shahin
497a644b48 MDL-73376 qbank_comment: Version selection in modal
This commit implements version selection in the comment
modal to allow users to change the version of question
using that dropdown.
2022-09-01 11:43:55 +10:00
Sara Arjona
996b5c7d75 Merge branch 'MDL-75312' of https://github.com/paulholden/moodle 2022-08-17 12:26:38 +02:00
Simey Lameze
032468d269 MDL-74211 behat: convert few more steps to use new data generators 2022-08-04 09:21:33 +08:00
Simey Lameze
e5ee04d4b9 MDL-74211 behat: add course question categories page type 2022-07-29 13:02:16 +08:00
Paul Holden
3971b69bb4 MDL-75312 question: predictable ordering of available questions.
This solves sporadic test failure that tried to assert their order.
2022-07-26 17:12:48 +01:00
Thong Bui
def8753d52 MDL-74505 Question bank: Improve behat steps 2022-07-05 13:28:28 +07:00
Thong Bui
035b55252d MDL-74505 Question bank: Update validation editing question form. 2022-07-05 13:28:24 +07:00
Tim Hunt
10e8ffe312 MDL-74041 question bank: page size should be 100 2022-05-04 10:34:34 +01:00
Tim Hunt
a43f56836a MDL-74255 quiz: fix redo and regrade question version handling 2022-04-08 12:19:53 +01:00
Tim Hunt
d54bef46f1 MDL-74130 question behat: support I am on ... page or key qbank pages 2022-03-14 22:13:04 +00:00
Tim Hunt
9c65fe8b8f MDL-74130 question behat: rename behat_question -> behat_core_question
This is the expected naming for a Behat file for a core component.

Note, there are no acutal references to the deprecated class name
in core, but there might be in plugins, so we added a
backwards compatibility class with the old name. Thanks to
Andrew Lyons for hints about how to do that.
2022-03-14 22:13:04 +00:00
Marc-Alexandre Ghaly
7c016b3451 MDL-71636 core_question : API changes for column_base
This commit implements methods visibility changes to column_base class
and its child classes.
2022-03-02 08:14:48 +00:00
Sujith Haridasan
b610055bbd MDL-73335 question: Add the tertiary nav for question bank
The tertiary navigation has been added to the question bank.
- Url selector has been added for the pages:
  Questions, Categories, Import and Export
- A separate page to "Add category" has been added.
  The "Add category" is available as a tertiary nav button.
- Updated the tests for the changes made.

This commit is mostly Sujith's work, with further changes by
Tim Hunt <T.J.Hunt@open.ac.uk> so we share the blame/credit.

AMOS BEGIN
 CPY [questioncats,mod_quiz],[questioncategories,core_question]
AMOS END
2022-02-24 09:26:29 +02:00
Sujith Haridasan
c4e411e48b Revert "MDL-71915 question: Update the behat tests"
This reverts commit f000755ba1f4357f1a4e697e7e72dcb752f1ce07.
2022-02-15 15:54:00 +00:00
Sara Arjona
de83532bfa MDL-71696 question: Fix random PHPUnit error with question order 2022-02-04 18:10:35 +02:00
Safat Shahin
bf55e5a481 MDL-71696 core_question: class autoload changes
This commit implements some class autoloading
fixes to align with core question structure.
2022-02-03 22:22:50 +11:00
Safat Shahin
3008edd366 MDL-71696 core_question: Implement question status change
This commit implements the status change pop up for a question
in the base view. This feature update will allow the change of
status of a question without creating a new version.
This commit also implements the status as a char rather than
an int value.
2022-02-03 22:22:50 +11:00
Safat Shahin
111951d861 MDL-71696 mod_quiz: quiz updates and behat coverage
The versioning changes will require some major changes
in the backup and restore of question bank and its
elements. This change introduces those changes to make
it compatible with the new world of versioning in question
bank. This commit also removes quiz_slots fields and
quiz_slot_tags table.
This commit will also introduce the versioning db
structure and some major changes to the quiz
and quiz attempts for the question, random
question and the view.
This commit implements the behat changes for versioning
in core question and associated locations.
2022-02-03 22:22:44 +11:00
Guillermo Gomez
c6cfca2a08 MDL-71696 core_question: Changes for versioning
This commit adds the changes in questiontype base
to work with new question tables and the new structure in the
databse. Also needed for versioning.
This implementation will also introduct the question status
which allows a question to be in draft and ready status.
I also introduces changes to the base view where it shows
the latest version of the questions. The view of versions
for a question is not implemented in this commit.
This implementation will also introduce changes in the core
qtype plugins to support versioning and the changed
db schema.
2022-02-03 22:22:44 +11:00
Eloy Lafuente (stronk7)
100bc51f1d 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.
2022-01-21 19:48:23 +01:00
Eloy Lafuente (stronk7)
0c53a3dec8 MDL-73476 phpunit: events, external and search tescase names
All events_test, external_test and search_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 lib/external/tests/external_test.php:
- external is not a valid component
- hence, its only valid namespace is "core"
- also, it's testing lib/external/externallib.php
- hence, the file (and class) have been renamed to external_externallib_test.php
  (to avoid conflicts with other external_test that may exist in core)
2022-01-14 16:18:39 +01:00
Eloy Lafuente (stronk7)
e4a2d9c1d4 MDL-73348 phpunit: normalize all privacy provider tests
As far as now all them have correct privacy level2 namespace:
- Move them to "privacy" subdir.
- Rename the files to "provider_test.php", this includes old
  privacy_test.php and privacy_provider_test.php files
- Rename the testcase to provider_test too (to match file name)

Also, change some relative paths and comments to point to new
locations.
2021-12-17 14:21:02 +01:00
Eloy Lafuente (stronk7)
57e6fb7ad9 MDL-73348 phpunit: privacy and privacy_provider testcase names
All privacy_test and privacy_provider_test classes:

- Namespaced with component\privacy.
- Fixed incorrect use statements with leading backslash.
- Changed code to point to global scope when needed.
- Renamed a few files to make all be privacy_test or privacy_provider_test.php
- All them passing individually.
- Complete runs passing too.
2021-12-17 14:21:02 +01:00