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

Random error in test_loadAddons()

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.8.5, 3.9.2, 3.10, 4.0
    • Fix Version/s: 3.8.6, 3.9.3
    • Component/s: H5P
    • Sprint:
      Moppies Kanban

      Description

      In test_loadAddons() this sentence $this->framework->loadAddons() is used to load the addons libraries and get the info related. The results are not sorted, so in the test when this assert is done ["$this->assertEquals('Library', $addons[0]['machineName']);"|https://github.com/moodle/moodle/blob/master/h5p/tests/framework_test.php#L476] we don't really know if 'Library' will be the first element of the array. So, sometimes we get some error in the PHPUnit test because it's expected one value and it gets another.

      Example of the error: Failed asserting that two strings are equal.

       

      1) core_h5p\framework_testcase::test_loadAddons
      Failed asserting that two strings are equal.
      --- Expected
      +++ Actual1
      -'Library'
      +'Library1'
      /moodle/h5p/tests/framework_test.php:
      /moodle/lib/phpunit/classes/advanced_testcase.php:
      To re-run: vendor/bin/phpunit --verbose "core_h5p\framework_testcase" h5p/tests/framework_test.php
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              pholden Paul Holden
              Reporter:
              cescobedo Carlos Escobedo
              Peer reviewer:
              Carlos Escobedo
              Integrator:
              Eloy Lafuente (stronk7)
              Tester:
              CiBoT
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                9/Nov/20

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour, 35 minutes
                  1h 35m