28 Commits

Author SHA1 Message Date
Eloy Lafuente (stronk7)
ba1f804ffa
MDL-65292 style: Fix all function declarations white space
This has been generated running the following Sniffs, all
them part of the Moodle's CodeSniffer standard:
- PSR12.Functions.ReturnTypeDeclaration
- PSR12.Functions.NullableTypeDeclaration
- moodle.Methods.MethodDeclarationSpacing
- Squiz.Whitespace.ScopeKeywordSpacing

All them are, exclusively, about correct spacing, so the changes
are, all them, only white space changes.

Only exceptions to the above are 3 changes what were setting the
return type in a new line, and, when that happens, the closing
parenthesis (bracket) has to go to the same line than the colon.
2024-02-28 23:33:26 +01:00
Eloy Lafuente (stronk7)
b3c4bd6250 MDL-73799 phpunit: Move some test names, as agreed in the issue
- behaviourtype_test => behaviour_type_test (10)
- questiontype_test => question_type_test (16)
- upgradelibnewqe_test => upgrade_old_attempt_data_test (13)
2022-03-03 12:22:36 +01:00
Eloy Lafuente (stronk7)
68b4a13cec MDL-73799 phpunit: various question & quiz testcase names
To all the walkthrough, questiontype, question, upgradelibnewqe,
behaviourtype_test and edit_form 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:
- When belonging to other component and being valid api:
  - form related tests have been moved to tests/form subdir.
2022-03-03 12:22:36 +01: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
David Monllaó
6f5d32ea4d Merge branch 'MDL-64590' of https://github.com/timhunt/moodle 2019-02-12 12:45:48 +01:00
Tim Hunt
d387f50fcd MDL-64590 questions: wrong comments shown in the state history table 2019-01-18 18:00:42 +00:00
Shamim Rezaie
305d2716f6 MDL-52132 qbehaviour_manualgraded: unit test for changing comment format 2019-01-15 18:56:03 +11:00
Tim Hunt
808b68835b MDL-60139 question manual grading: redisplay mark as typed if editing
When the teacher is upgrading a previously entered grade, we re-display
exactly what they typed before if possible, rather than displaying with
a set number of decimal places.
2017-10-30 12:52:02 +00:00
Juan Segarra Montesinos
53fa2a5194 MDL-52131 qbehaviour: respect manualcomment format
The format of a manual comment in a question is respected when
the preferred editor is "Plain text area".
2017-09-14 13:30:35 +08:00
Rajesh Taneja
52f3e060e4
MDL-55091 phpunit: Following has been deprecated.
1. getMock()
2. setExpectedException()
3. checkForUnintentionallyCoveredCode renamed to beStrictAboutCoversAnnotation
4. beStrictAboutTestSize renamed to enforceTimeLimit
5. UnitTestCase class is now fully removed.
2016-07-26 10:11:30 +08:00
Russell Smith
1fcf0ca8a5 MDL-35628 performance: Remove dirname() where possible.
dirname() is a slow function compared with __DIR__ and using
'/../'.  Moodle has a large number of legacy files that are included
each time a page loads and is not able to use an autoloader as it is
functional code.  This allows those required includes to perform as
best as possible in this situation.
2016-06-10 08:06:49 +10:00
Tim Hunt
ddc016830d MDL-51476 questions: manual grading validation for ungraded Qs
The change in MDL-51090 broke manually commenting on questions for which
no mark is given (max mark == 0). This fixes it, with unit tests.

Thanks to Nick Phillips for the original suggestion of the fix.
2015-09-25 14:01:33 +01:00
Tim Hunt
6b3bd52fae MDL-51090 question manual grading: fixing for testing issues 2015-09-02 15:09:34 +08:00
Tim Hunt
b2694c0219 MDL-51090 question: further refinements to validating manual grades 2015-09-01 23:05:37 +01:00
Tim Hunt
47be39ef41 MDL-40992 qbehaviour: new type method, can Qs can finish naturally 2015-03-26 17:46:48 +00:00
Tim Hunt
097efe9de3 MDL-49315 questions: unit tests for each behaviour type class 2015-03-05 12:19:23 +00:00
Damyon Wiese
d32bc7d655 MDL-18014 Atto autosave: Atto requires $PAGE->url be set or debugging is triggered
2 quiz tests are creating forms with text editors manually - they need to ensure a valid
$PAGE->url is set so they don't trigger debugging warnings from $PAGE->url magic method
called by Atto.
2014-08-19 16:02:14 +08:00
Tim Hunt
e101ec9fd7 MDL-43874 quiz, teacher comments should respect display options.
Whether the comments on manually graded questions were visible to
students should have been controlled by the 'Specific feedback' Review
option in the quiz settings. However, the quiz was not setting
$displayoptions->manualcomment, so it did not work.
2014-01-27 12:01:32 +00:00
Damyon Wiese
6e4dcb9a47 MDL-40493 Question: Explain why setAdminUser is needed for tests 2013-10-09 16:53:21 +08:00
Petr Škoda
c969753885 MDL-40493 question: set real $USER before testing question walktrough 2013-10-09 11:02:35 +13:00
Tim Hunt
afb1b3d03b MDL-39980 question engine: Attempt on last loses response files
When doing Each attempt builds on last, we need to copy any response
files into a draft file area, and then re-save them.

While writing the unit test for this, I had to deal with a todo in the
question engine so that questions with files in the response could be
unit-tested.

I also found an fixed a bug with qtype_essay_question::is_same_response
and fixed some notices in the existing essay/manual graded unit tests.
2013-08-15 12:55:13 +01:00
Dan Poltawski
ed07242713 MDL-39507 qtype_essay: hacky fix for unit tests
This is just to get the tests passing for integration purposes. Tim
may want to do a robust fix and revert this.
2013-08-13 10:47:19 +08:00
Eloy Lafuente (stronk7)
6026f23559 MDL-38311 Add missing comment format. 2013-03-06 02:02:45 +01:00
Eloy Lafuente (stronk7)
9f4da038c8 Merge branch 'MDL-38311' of git://github.com/timhunt/moodle 2013-03-06 01:22:32 +01:00
Tim Hunt
53b8e25626 MDL-38311 questions: manual grading API should accept commentformat
Comment format (FORMAT_...) was correctly being processed when the
manual grading happened as the result of a form submission. It was only
when done using the question_usage or question_attempt API method that
there was no way to specify the format. (Although I think the only place
this API as used was in the unit tests.)

Note that question_attempt::manual_grade API had to change, but I don't
think that is a real API change. Calling code should be using
question_usage::question_attempt, which is backwards compatible.

Note that now, if you don't pass format, then no error is generated, but
a developer debugging message is generated.
2013-03-05 11:51:47 +00:00
Tim Hunt
8407a5498b MDL-38280 manual graded behaviour: unit test for when not answered.
If the student does not submit an answer, the questoin goes to state
gaveup, rather than requiresgrading.
2013-03-01 17:04:04 +00:00
Tim Hunt
03cefcc91b MDL-37506 question code: incorrect preg_quote uses.
For preg_quote to work reliably, you must pass the delimiter you are
using for your regular expression. In many places we were failing to do
that.
2013-01-18 11:18:54 +00:00
Petr Skoda
603bd00112 MDL-32323 convert question tests
1/ type/match/tests/walkthrough_test.php - tests are failing randomly, looks like some weird randomisation is going on there - see TODOs

2/ type/multianswer/tests/upgradelibnewqe_test.php contains invalid expected value - see TODO
2012-04-10 15:27:11 +02:00