Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-24842

Unit tests fail in accesslib

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: None
    • Component/s: Libraries, Unit tests
    • Labels:
      None
    • Affected Branches:
      MOODLE_20_STABLE

      Description

      The accesslib unit tests fail as follows:

      Exception: lib/simpletest/testaccesslib.php / ? accesslib_test / ? test_get_users_by_capability
      Unexpected PHP error [Trying to get property of non-object] severity [E_NOTICE] in [/fs2/www/html/sm449/coremoodle/lib/simpletest/testaccesslib.php line 117]
      Exception: lib/simpletest/testaccesslib.php / ? accesslib_test / ? test_get_users_by_capability
      Unexpected exception of type [dml_write_exception] with message [Error writing to database] in [/fs2/www/html/sm449/coremoodle/lib/dml/moodle_database.php line 394]

      Debug info:

      ERROR: null value in column "roleid" violates not-null constraint
      INSERT INTO tst_role_assignments (userid,roleid,contextid) VALUES($1,$2,$3) RETURNING id
      [array (
      'userid' => 1,
      'roleid' => NULL,
      'contextid' => 1,
      )]

      • line 229 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
      • line 772 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
      • line 824 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->insert_record_raw()
      • line ... of ...
      • line 122 of /lib/simpletest/testaccesslib.php: call to UnitTestCaseUsingDatabase->load_test_data()
      • line ... of ...

      Fail: lib/simpletest/testaccesslib.php / ? accesslib_test / ? test_get_switchable_roles
      Array [] does not contain the expected list of values [3]. at [/fs2/www/html/sm449/coremoodle/lib/simpletest/testaccesslib.php line 292]
      Fail: lib/simpletest/testaccesslib.php / ? accesslib_test / ? test_get_switchable_roles
      Array [] does not contain the expected list of values [3]. at [/fs2/www/html/sm449/coremoodle/lib/simpletest/testaccesslib.php line 299]
      1/1 test cases complete: 8 passes, 2 fails and 2 exceptions.

      As I am about to work on accesslib, I will try to fix these tests first.

        Attachments

          Activity

            People

            • Assignee:
              quen Sam Marshall
              Reporter:
              quen Sam Marshall
              Tester:
              Nobody
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón, Andrew Nicols, Mathew May, Michael Hawkins, Shamim Rezaie, Simey Lameze
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: