-
Bug
-
Resolution: Fixed
-
Minor
-
2.6.5, 2.7.2
-
MOODLE_26_STABLE, MOODLE_27_STABLE
-
MOODLE_26_STABLE, MOODLE_27_STABLE
-
MDL-46647-master -
- Run the whole Unit Test suite across all supported DB
The test introduced, with the introduction of single point grade items, in MDL-16474 fails because, when the newly created grade item is instantiated, there is an access to the database to find a pre-existing grade item with the same provided values and a fetch to fill in the values that were not provided. Although this fetch is not needed in this case, it would normally not be a problem, except that in Oracle where there are some string comparisons that take place.
The real problem (and perhaps we should consider solving that separately) is that the grade item code blindly combines the provided values into a query, without considering the types of each value. The result is a query that compares strings to CLOBs in Oracle.
The simple fix in this case is to avoid the fetch when the grade item is instantiated, and this can be done by adding a parameter to the instantiation call.
lib/grade/tests/grade_scale_test.php, line 164 |
$grade_item = new grade_item($grade_item, false);
|
For reference, here is the unit test output that sparked this search.
2) core_grade_scale_testcase::test_grade_scale
|
dml_read_exception: Error reading from database (ORA-00932: inconsistent datatypes: expected - got CLOB
|
SELECT * FROM p_grade_items WHERE courseid = :o_param1 AND categoryid = :o_param2 AND itemname = :o_param3 AND itemtype = :o_param4 AND itemnumber = :o_param5 AND needsupdate = :o_param6 AND gradetype = :o_param7 AND scaleid = :o_param8 AND iteminfo = :o_param9 AND timecreated = :o_paran0 AND timemodified = :o_paran1
|
[array (
|
'o_param1' => '459000',
|
'o_param2' => 401001,
|
'o_param3' => 'manual grade_item scale_1',
|
'o_param4' => 'manual',
|
'o_param5' => 0,
|
'o_param6' => 0,
|
'o_param7' => 2,
|
'o_param8' => '272006',
|
'o_param9' => 'Manual grade item used for unit testing',
|
'o_paran0' => 1406725958,
|
'o_paran1' => 1406725958,
|
)])
|
|
/home/michael/web/htdocs/master_integration/lib/dml/moodle_database.php:443
|
/home/michael/web/htdocs/master_integration/lib/dml/oci_native_moodle_database.php:271
|
/home/michael/web/htdocs/master_integration/lib/dml/oci_native_moodle_database.php:1092
|
/home/michael/web/htdocs/master_integration/lib/dml/moodle_database.php:1199
|
/home/michael/web/htdocs/master_integration/lib/grade/grade_object.php:207
|
/home/michael/web/htdocs/master_integration/lib/grade/grade_object.php:160
|
/home/michael/web/htdocs/master_integration/lib/grade/grade_item.php:326
|
/home/michael/web/htdocs/master_integration/lib/grade/grade_object.php:90
|
/home/michael/web/htdocs/master_integration/lib/grade/tests/grade_scale_test.php:164
|
/home/michael/web/htdocs/master_integration/lib/grade/tests/grade_scale_test.php:39
|
/home/michael/web/htdocs/master_integration/lib/phpunit/classes/advanced_testcase.php:80
|
|
To re-run:
|
vendor/bin/phpunit core_grade_scale_testcase lib/grade/tests/grade_scale_test.php
|