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

core_completionlib_testcase::test_update_state failing due to time differences

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. Run phpunit on completionlib's test_update_state:

        vendor/bin/phpunit --filter="test_update_state"
        

        1. Confirm passing
      2. Open lib/completionlib.php in $EDITOR
      3. Find the update_state function
      4. Find the point at which timemodified is set to time(), and add:

        $current->timemodified += 100;
        

      5. Run phpunit on completionlib's test_update_state again
        1. Confirm passing
      6. Modify the line you added to read:

        $current->timemodified -= 100;
        

      7. Run phpunit on completionlib's test_update_state again
        1. Confirm failure (the error should report that the value is not greater than or equal).
      Show
      Run phpunit on completionlib's test_update_state: vendor/bin/phpunit --filter="test_update_state" Confirm passing Open lib/completionlib.php in $EDITOR Find the update_state function Find the point at which timemodified is set to time(), and add: $current->timemodified += 100; Run phpunit on completionlib's test_update_state again Confirm passing Modify the line you added to read: $current->timemodified -= 100; Run phpunit on completionlib's test_update_state again Confirm failure (the error should report that the value is not greater than or equal).
    • Affected Branches:
      MOODLE_28_STABLE, MOODLE_29_STABLE, MOODLE_30_STABLE
    • Fixed Branches:
      MOODLE_28_STABLE, MOODLE_29_STABLE
    • Epic Link:
    • Pull Master Branch:
      MDL-47449-master

      Description

      Curiously this should've been fixed by MDL-41935, but we've just got a failure on the nightly server:

      ) core_completionlib_testcase::test_update_state
      Expectation failed for method name is equal to <string:internal_set_data> when invoked at sequence index 2
      Parameter 1 for invocation completion_info::internal_set_data(stdClass Object (...), stdClass Object (...)) does not match expected value.
      Failed asserting that two objects are equal.
      --- Expected
      +++ Actual
      @@ @@
       stdClass Object (
           'completionstate' => 0
      -    'timemodified' => 1411996800
      +    'timemodified' => 1411996801
       )
       
      /var/lib/jenkins/moodle/behat_whole_suite_m/lib/completionlib.php:594
      /var/lib/jenkins/moodle/behat_whole_suite_m/lib/tests/completionlib_test.php:201
      /var/lib/jenkins/moodle/behat_whole_suite_m/lib/phpunit/classes/advanced_testcase.php:80
       
      To re-run:
       vendor/bin/phpunit core_completionlib_testcase lib/tests/completionlib_test.php
      

        Attachments

          Activity

            People

            • Assignee:
              dobedobedoh Andrew Nicols
              Reporter:
              poltawski Dan Poltawski
              Peer reviewer:
              Rajesh Taneja
              Integrator:
              Eloy Lafuente (stronk7)
              Tester:
              Ryan Wyllie
              Participants:
              Component watchers:
              Sam Marshall, Amaia Anabitarte, Bas Brands, Carlos Escobedo, 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:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                14/Sep/15