middlebury/moodle-mod_adaptivequiz

Unit tests fail with a dml_write_exception

Closed this issue · 3 comments

I'm trying to get the unit tests to work with a Moodle 2.8 installation. Unfortunately they consistently fail with errors like this one:

mod_adaptivequiz_adaptiveattempt_testcase::test_get_all_questions_in_attempt
dml_write_exception: Error writing to database (Duplicate entry '70-2' for key 'phpu_cont_conins_uix'
INSERT INTO phpu_context (id,contextlevel,instanceid,path,depth) VALUES(?,?,?,?,?)
[array (
  0 => '330',
  1 => '70',
  2 => '2',
  3 => '/1/3/16/330',
  4 => '4',
)])

/www/lib/dml/moodle_database.php:446
/www/lib/dml/mysqli_native_moodle_database.php:1164
/wwww/lib/dml/mysqli_native_moodle_database.php:1353
/www/lib/phpunit/classes/advanced_testcase.php:212
/www/mod/adaptivequiz/tests/adaptiveattempt_test.php:59
/www/mod/adaptivequiz/tests/adaptiveattempt_test.php:653
/www//lib/phpunit/classes/advanced_testcase.php:80

Could you please investigate why this is occurring? Also could you outline why the unit tests are trying to load data directly into core Moodle tables such as the context table?

Thanks for this report. I'm currently busy on other projects, so it may be a little while before I'm able to investigate this issue. As I'm not the original author of the unit-tests, I'm not sure why that action was being performed, but it is certainly worth investigating. Best, Adam

Hello everyone,
I hope you are all doing well!
Let me first introduce myself: my name is Khalid KABCHI, Moroccan and I am preparing a thesis about adaptive testing (specifically in physics).
I plan to create an adaptive test but I find huge difficulties in this sense.
For that can you help me to create my own adaptive test?
khalid.kabchi@gmail.com

Thank you for submitting this issue. This repository is now archived: The sponsor of this plugin, Middlebury College, is no longer using Moodle. Development is continuing on other forks of the project. See https://moodle.org/plugins/mod_adaptivequiz for more information and latest releases.