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

Course sorting unit tests fail

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.8
    • Fix Version/s: 2.8
    • Component/s: Course, Unit tests
    • Labels:
    • Testing Instructions:
      Hide
      1. Verify @core_course acceptance tests are passing for all DBs.
      2. Verify core_ddl_testcase lib/ddl/tests/ddl_test.php pass for all DBs
      3. Verify core_coursecatlib_testcase lib/tests/coursecatlib_test.php pass for all DBs
      4. Re-run the tests for MDL-45847 (excluding the Behat tests)
      Show
      Verify @core_course acceptance tests are passing for all DBs. Verify core_ddl_testcase lib/ddl/tests/ddl_test.php pass for all DBs Verify core_coursecatlib_testcase lib/tests/coursecatlib_test.php pass for all DBs Re-run the tests for MDL-45847 (excluding the Behat tests)
    • Affected Branches:
      MOODLE_28_STABLE
    • Fixed Branches:
      MOODLE_28_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-46646_master

      Description

      Newly introduced unit tests are failing because the timestamps used are too large. Oracle is being strict about this, but it is probably being rounded by other DBs, so it's a general problem.

      The unit tests are failing in lib/tests/coursecatlib_test.php within test_resort_courses() where the timestamps provided for 'timecreated' exceed the 32bit limit. Reducing them by a factor of 10 allows the tests to proceed.

      I also noticed similar timestamps used in Behat tests added in the same commit. See course/tests/behat/course_category_management_listing.feature and course/tests/behat/course_resort.feature

      Here is the unit test output.

      1) core_coursecatlib_testcase::test_resort_courses
      dml_write_exception: Error writing to database (ORA-01438: value larger than specified precision allowed for this column
      INSERT INTO p_course (category,idnumber,shortname,fullname,timecreated,format,newsitems,summary,summaryformat,timemodified,sortorder,visible,visibleold) VALUES (:category,:idnumber,:shortname,:fullname,:timecreated,:format,:newsitems,:summary,:summaryformat,:timemodified,:sortorder,:visible,:visibleold) RETURNING id INTO :oracle_id
      [array (
        'category' => '458000',
        'idnumber' => '006-01',
        'shortname' => 'Biome Study',
        'fullname' => '<span lang="ar" class="multilang">دراسة منطقة إحيائية</span><span lang="en" class="multilang">Biome Study</span>',
        'timecreated' => '10000000001',
        'format' => 'topics',
        'newsitems' => 0,
        'summary' => 'Test course 1
      Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nulla non arcu lacinia neque faucibus fringilla. Vivamus porttitor turpis ac leo. Integer in sapien. Nullam eget nisl. Aliquam erat volutpat. Cras elementum. Mauris suscipit, ligula sit amet pharetra semper, nibh ante cursus purus, vel sagittis velit mauris vel metus. Integer malesuada. Nullam lectus justo, vulputate eget mollis sed, tempor sed magna. Mauris elementum mauris vitae tortor. Aliquam erat volutpat.
      Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Pellentesque ipsum. Cras pede libero, dapibus nec, pretium sit amet, tempor quis. Aliquam ante. Proin in tellus sit amet nibh dignissim sagittis. Vivamus porttitor turpis ac leo. Duis bibendum, lectus ut viverra rhoncus, dolor nunc faucibus libero, eget facilisis enim ipsum id lacus. In sem justo, commodo ut, suscipit at, pharetra vitae, orci. Aliquam erat volutpat. Nulla est.
      Vivamus luctus egestas leo. Aenean fermentum risus id tortor. Mauris dictum facilisis augue. Aliquam erat volutpat. Aliquam ornare wisi eu metus. Aliquam id dolor. Duis condimentum augue id magna semper rutrum. Donec iaculis gravida nulla. Pellentesque ipsum. Etiam dictum tincidunt diam. Quisque tincidunt scelerisque libero. Etiam egestas wisi a erat.
      Integer lacinia. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Mauris tincidunt sem sed arcu. Nullam feugiat, turpis at pulvinar vulputate, erat libero tristique tellus, nec bibendum odio risus sit amet ante. Aliquam id dolor. Maecenas sollicitudin. Et harum quidem rerum facilis est et expedita distinctio. Mauris suscipit, ligula sit amet pharetra semper, nibh ante cursus purus, vel sagittis velit mauris vel metus. Nullam dapibus fermentum ipsum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Pellentesque sapien. Duis risus. Mauris elementum mauris vitae tortor. Suspendisse nisl. Integer rutrum, orci vestibulum ullamcorper ultricies, lacus quam ultricies odio, vitae placerat pede sem sit amet enim.
      In laoreet, magna id viverra tincidunt, sem odio bibendum justo, vel imperdiet sapien wisi sed libero. Proin pede metus, vulputate nec, fermentum fringilla, vehicula vitae, justo. Nullam justo enim, consectetuer nec, ullamcorper ac, vestibulum in, elit. Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur? Maecenas lorem. Etiam posuere lacus quis dolor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Curabitur ligula sapien, pulvinar a vestibulum quis, facilisis vel sapien. Nam sed tellus id magna elementum tincidunt. Suspendisse nisl. Vivamus luctus egestas leo. Nulla non arcu lacinia neque faucibus fringilla. Etiam dui sem, fermentum vitae, sagittis id, malesuada in, quam. Etiam dictum tincidunt diam. Etiam commodo dui eget wisi. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Proin pede metus, vulputate nec, fermentum fringilla, vehicula vitae, justo. Duis ante orci, molestie vitae vehicula venenatis, tincidunt ac pede. Pellentesque sapien.',
        'summaryformat' => '0',
        'timemodified' => '10000000001',
        'sortorder' => 0,
        'visible' => '1',
        'visibleold' => '1',
      )])
       
      /home/michael/web/htdocs/master_integration/lib/dml/moodle_database.php:446
      /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:1234
      /home/michael/web/htdocs/master_integration/lib/dml/oci_native_moodle_database.php:1281
      /home/michael/web/htdocs/master_integration/course/lib.php:2539
      /home/michael/web/htdocs/master_integration/lib/testing/generator/data_generator.php:398
      /home/michael/web/htdocs/master_integration/lib/tests/coursecatlib_test.php:400
      /home/michael/web/htdocs/master_integration/lib/phpunit/classes/advanced_testcase.php:80
       
      To re-run:
       vendor/bin/phpunit core_coursecatlib_testcase lib/tests/coursecatlib_test.php
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  10/Nov/14