33 Commits

Author SHA1 Message Date
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
Tim Hunt
4a45b7112c MDL-68757 questions: don't do output in low-level functions 2020-05-18 20:54:27 +01:00
Tim Hunt
bee903193b MDL-68615 questions: more increment idnumber cases found by our tester 2020-05-06 07:46:09 +01:00
Tim Hunt
1d47cb2168 MDL-68615 questions: fix fiendish default idnumber edge case 2020-05-05 16:19:54 +01:00
Jake Dallimore
9b8fc9be6d Merge branch 'MDL-67934' of https://github.com/timhunt/moodle 2020-03-25 08:28:27 +08:00
Tim Hunt
f2393804bf MDL-67934 questions: give a sensible default idnumber when duplicating 2020-03-12 18:07:11 +00:00
Tim Hunt
1b6b554118 MDL-67981 questions: avoid errors deleting contextless questions 2020-03-06 17:57:11 +00:00
Angad Sethi
86127e774f MDL-67142 quiz: fixed error when deleting saved questions long-name-quiz
An error was showing up while deleting questions
(in the question_save_from_deletion method) which had been saved
and which belonged to a quiz with a super long name, not exceeding 255
characters, as the 'name' field in 'question_categories' table had a
max size of 255 characters. The shorten_text function was used to
shorten the string to 255 characters and a unit test was added with
the name test_question_save_from_deletion_quiz_with_long_name to test
the patch.
2020-02-08 19:40:44 +05:30
Shamim Rezaie
8e93e515ed MDL-63809 question: handling bad questions in question_has_capability_on 2018-12-18 15:05:37 +11:00
Tim Hunt
616442a2fa MDL-63738 question bank: a link to download a single question 2018-10-29 10:38:24 +00:00
Jonathan Champ
b2f349a433 MDL-54035 accesslib: separate role definition cache clear
Thanks to MDL-49398, we can separate the combined user session and role
definition cache clearing function into two separate functions. At the
same time, we want to identify and remove mark_dirty() calls that were
added for role definition changes but were incorrectly left behind.

Change highlights:
 - Remove unnecessary mark_dirty() calls performed after
   assign_capability(), unassign_capability(), delete_role(),
   deleted contexts, brand new contexts
 - Move role definition cache clear from the user-centric
   accesslib_clear_all_caches() to the newly created,
   role-dedicated accesslib_reset_role_cache()
2018-09-21 09:17:42 -04:00
John Beedell
d0a60444a1 MDL-63165 Question: xml import of question categories 2018-08-24 15:20:18 +01:00
Shamim Rezaie
94fe904ed6 MDL-62897 Questions: Fix multi top cats in question_save_from_deletion 2018-07-23 14:37:40 +10:00
Simey Lameze
02b1868c32 MDL-61364 core: fix cibot coding issues 2018-03-28 10:18:33 +08:00
Simey Lameze
15cd009097 MDL-61364 core_question: tests for question_has_capability_on exception 2018-03-28 08:54:11 +08:00
Andrew Nicols
ca18d567d7 MDL-61364 question: Add unit tests for question_has_capability_on 2018-03-28 08:54:11 +08:00
Eloy Lafuente (stronk7)
9a79102a4c Merge branch 'MDL-61410-master' of git://github.com/lameze/moodle 2018-03-20 23:53:28 +01:00
Simey Lameze
2ee6e02e21 MDL-61410 question: unit tests for question_sort_tags 2018-03-19 11:45:55 +08:00
Shamim Rezaie
15f80bf579 MDL-61615 Questions: unit test for question_delete_course_category 2018-03-13 18:30:51 +11:00
Ryan Wyllie
79c9ad6277 MDL-61363 question: unit tests for question tags context change 2018-03-07 10:31:47 +08:00
Ryan Wyllie
dd69ecb630 MDL-61363 question: unit tests for course context tagging 2018-03-07 10:31:47 +08:00
Shamim Rezaie
4fa49cc647 MDL-61380 Quiz: Adding a random question 2018-03-01 11:50:52 +11:00
Shamim Rezaie
869320c7f4 MDL-61132 Questions: Unit tests compatibility
Modified unit tests to adapt with "Top" categories.
2018-02-05 11:58:58 +11:00
Frederic Massart
31031e98c7 MDL-29905 question: Auto remove stale questions upon category deletion 2016-05-30 12:26:09 +08:00
Eloy Lafuente (stronk7)
07a069f1c0 MDL-50063 unittests: Remove some unnecesary gc_collect_cycles()
Now backup and restore operations free logger resources calling
to the destroy() method. This commit ensures:

1) That gc_collect_cycles() is not used anymore in backup-related tests.
2) That all backup and restore controllers in test do always call
   to the detroy() method.
3) Some unset() calls, needed to make gc_collect_cycles() are not used
   anymore.
2016-05-13 02:50:45 +02:00
Marina Glancy
b355a1c97c MDL-50851 core_question: use new tag API 2016-01-10 15:25:47 +08:00
Tyler Bannister
7f7144fd50 MDL-47787 course: Added question delete to cm delete. 2015-06-25 16:35:22 -04:00
Tony Levi
0021942592 MDL-48924 backup: Fix some get_file_packer() calls for enabletgzbackups 2015-01-29 22:53:20 +10:30
Adrian Greeve
c42d18183a MDL-47675 phpunit: Update unit tests to pass on MSSQL
Unit tests were failing on MSSQL. gc_collect_cycles() was
removed from the phpunit utils.php file to save time in running
the tests, but MSSQL doesn't clean up open files as well as
other databases.

This patch includes the garbage collection for the unit tests
that require it.
2014-10-20 14:26:11 +08:00
Mark Nelson
cc033d48b5 MDL-44316 core_tag: changed the API to accept a contextid and component 2014-03-22 13:50:08 -07:00
Petr Škoda
3faa26e556 MDL-39915 cleanup core_questionlib_testcase 2013-07-28 14:39:16 +02:00
Tim Hunt
aa5f05110f MDL-35055 question import: slight error with the Match grades option.
Even in the 'Error if grade not listed case', it was applying a small
tolerance. In the case of a fuzzy match, it was returning the inexact
grade from the import file, rather than the precise grade that Moodle
was expecting.

That causes problems when the editing form is displayed, because the
value from the database does not match any of the available options, so
the grade is changed to 0%.
2012-08-24 15:34:20 +01:00
Petr Skoda
a3d5830a0a MDL-32149 PHPUnit test support - part 2
Includes:
* constants refactoring
* reworked db table init
* support for $CFG->debug = -1
* functional DB tests
* fixed $DB->get_indexes() to not throw exceptions when table does not exist
* fix handling of user passwords in test db
* add debug info to exception messages
* removed unnecessary PHP debug errors from mathslib
* fixed @error suppression in get_string
* fixed PHPUnit error handler setup
* added timezone info to default install
2012-04-03 22:30:53 +02:00