elearningsoftware / moodle-mod_journal

The Moodle journal module for moodle 2.0+
https://moodle.org/plugins/view.php?plugin=mod_journal
16 stars 34 forks source link

Unit tests failing in Moodle (tool_dataprivacy) #102

Open guillogo opened 8 months ago

guillogo commented 8 months ago

Hi,

There are multiple unit tests failing due to an issue in line 135 of /mod/journal/classes/privacy/provider.php :

2) tool_dataprivacy\expired_contexts_test::test_process_course_context_with_override_unexpired_role
Unexpected debugging() call detected.
Debugging: Error reading from database (ERROR:  column j.userid does not exist
LINE 5:             SELECT j.userid
                           ^

            SELECT DISTINCT u.id
            FROM phpu_user u
            JOIN (
            SELECT j.userid
              FROM phpu_journal j
              JOIN phpu_modules m
                ON m.name = $1
              JOIN phpu_course_modules cm
                ON cm.instance = j.id
               AND cm.module = m.id
              JOIN phpu_context ctx
                ON ctx.instanceid = cm.id
               AND ctx.contextlevel = $2
             WHERE ctx.id = $3) target ON u.id = target.userid
[array (
  0 => 'journal',
  1 => 70,
  2 => 194001,
)])
* line 293 of /lib/dml/moodle_read_slave_trait.php: call to moodle_database->query_end()
* line 341 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->read_slave_query_end()
* line 1027 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
* line 56 of /privacy/classes/local/request/userlist.php: call to pgsql_native_moodle_database->get_records_sql()
* line 135 of /mod/journal/classes/privacy/provider.php: call to core_privacy\local\request\userlist->add_from_sql()
* line 8144 of /lib/moodlelib.php: call to mod_journal\privacy\provider::get_users_in_context()
* line 578 of /privacy/classes/manager.php: call to component_class_callback()
* line 611 of /privacy/classes/manager.php: call to core_privacy\manager::component_class_callback()
* line 285 of /privacy/classes/manager.php: call to core_privacy\manager->handled_component_class_callback()
* line 451 of /admin/tool/dataprivacy/classes/expired_contexts_manager.php: call to core_privacy\manager->get_users_in_context()
* line 388 of /admin/tool/dataprivacy/classes/expired_contexts_manager.php: call to tool_dataprivacy\expired_contexts_manager->delete_expired_context()
* line 946 of /admin/tool/dataprivacy/tests/expired_contexts_test.php: call to tool_dataprivacy\expired_contexts_manager->process_approved_deletions()

3) tool_dataprivacy\expired_contexts_test::test_process_course_context_with_override_expired_role
Unexpected debugging() call detected.
Debugging: Error reading from database (ERROR:  column j.userid does not exist
LINE 5:             SELECT j.userid
                           ^

            SELECT DISTINCT u.id
            FROM phpu_user u
            JOIN (
            SELECT j.userid
              FROM phpu_journal j
              JOIN phpu_modules m
                ON m.name = $1
              JOIN phpu_course_modules cm
                ON cm.instance = j.id
               AND cm.module = m.id
              JOIN phpu_context ctx
                ON ctx.instanceid = cm.id
               AND ctx.contextlevel = $2
             WHERE ctx.id = $3) target ON u.id = target.userid
[array (
  0 => 'journal',
  1 => 70,
  2 => 194001,
)])
* line 293 of /lib/dml/moodle_read_slave_trait.php: call to moodle_database->query_end()
* line 341 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->read_slave_query_end()
* line 1027 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
* line 56 of /privacy/classes/local/request/userlist.php: call to pgsql_native_moodle_database->get_records_sql()
* line 135 of /mod/journal/classes/privacy/provider.php: call to core_privacy\local\request\userlist->add_from_sql()
* line 8144 of /lib/moodlelib.php: call to mod_journal\privacy\provider::get_users_in_context()
* line 578 of /privacy/classes/manager.php: call to component_class_callback()
* line 611 of /privacy/classes/manager.php: call to core_privacy\manager::component_class_callback()
* line 285 of /privacy/classes/manager.php: call to core_privacy\manager->handled_component_class_callback()
* line 451 of /admin/tool/dataprivacy/classes/expired_contexts_manager.php: call to core_privacy\manager->get_users_in_context()
* line 388 of /admin/tool/dataprivacy/classes/expired_contexts_manager.php: call to tool_dataprivacy\expired_contexts_manager->delete_expired_context()
* line 1034 of /admin/tool/dataprivacy/tests/expired_contexts_test.php: call to tool_dataprivacy\expired_contexts_manager->process_approved_deletions()

4) tool_dataprivacy\expired_contexts_test::test_process_course_context_with_user_in_both_lists
Unexpected debugging() call detected.
Debugging: Error reading from database (ERROR:  column j.userid does not exist
LINE 5:             SELECT j.userid
                           ^

            SELECT DISTINCT u.id
            FROM phpu_user u
            JOIN (
            SELECT j.userid
              FROM phpu_journal j
              JOIN phpu_modules m
                ON m.name = $1
              JOIN phpu_course_modules cm
                ON cm.instance = j.id
               AND cm.module = m.id
              JOIN phpu_context ctx
                ON ctx.instanceid = cm.id
               AND ctx.contextlevel = $2
             WHERE ctx.id = $3) target ON u.id = target.userid
[array (
  0 => 'journal',
  1 => 70,
  2 => 194001,
)])
* line 293 of /lib/dml/moodle_read_slave_trait.php: call to moodle_database->query_end()
* line 341 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->read_slave_query_end()
* line 1027 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
* line 56 of /privacy/classes/local/request/userlist.php: call to pgsql_native_moodle_database->get_records_sql()
* line 135 of /mod/journal/classes/privacy/provider.php: call to core_privacy\local\request\userlist->add_from_sql()
* line 8144 of /lib/moodlelib.php: call to mod_journal\privacy\provider::get_users_in_context()
* line 578 of /privacy/classes/manager.php: call to component_class_callback()
* line 611 of /privacy/classes/manager.php: call to core_privacy\manager::component_class_callback()
* line 285 of /privacy/classes/manager.php: call to core_privacy\manager->handled_component_class_callback()
* line 451 of /admin/tool/dataprivacy/classes/expired_contexts_manager.php: call to core_privacy\manager->get_users_in_context()
* line 388 of /admin/tool/dataprivacy/classes/expired_contexts_manager.php: call to tool_dataprivacy\expired_contexts_manager->delete_expired_context()
* line 1123 of /admin/tool/dataprivacy/tests/expired_contexts_test.php: call to tool_dataprivacy\expired_contexts_manager->process_approved_deletions()

5) tool_dataprivacy\expired_contexts_test::test_process_course_context_with_user_in_both_lists_expired
Unexpected debugging() call detected.
Debugging: Error reading from database (ERROR:  column j.userid does not exist
LINE 5:             SELECT j.userid
                           ^

            SELECT DISTINCT u.id
            FROM phpu_user u
            JOIN (
            SELECT j.userid
              FROM phpu_journal j
              JOIN phpu_modules m
                ON m.name = $1
              JOIN phpu_course_modules cm
                ON cm.instance = j.id
               AND cm.module = m.id
              JOIN phpu_context ctx
                ON ctx.instanceid = cm.id
               AND ctx.contextlevel = $2
             WHERE ctx.id = $3) target ON u.id = target.userid
[array (
  0 => 'journal',
  1 => 70,
  2 => 194001,
)])
* line 293 of /lib/dml/moodle_read_slave_trait.php: call to moodle_database->query_end()
* line 341 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->read_slave_query_end()
* line 1027 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
* line 56 of /privacy/classes/local/request/userlist.php: call to pgsql_native_moodle_database->get_records_sql()
* line 135 of /mod/journal/classes/privacy/provider.php: call to core_privacy\local\request\userlist->add_from_sql()
* line 8144 of /lib/moodlelib.php: call to mod_journal\privacy\provider::get_users_in_context()
* line 578 of /privacy/classes/manager.php: call to component_class_callback()
* line 611 of /privacy/classes/manager.php: call to core_privacy\manager::component_class_callback()
* line 285 of /privacy/classes/manager.php: call to core_privacy\manager->handled_component_class_callback()
* line 451 of /admin/tool/dataprivacy/classes/expired_contexts_manager.php: call to core_privacy\manager->get_users_in_context()
* line 388 of /admin/tool/dataprivacy/classes/expired_contexts_manager.php: call to tool_dataprivacy\expired_contexts_manager->delete_expired_context()
* line 1219 of /admin/tool/dataprivacy/tests/expired_contexts_test.php: call to tool_dataprivacy\expired_contexts_manager->process_approved_deletions()
larsbonczek commented 1 month ago

This should be fixed by #101