Moodle
  1. Moodle
  2. MDL-27391

Completion unit tests fail due to MDL-26778 change

    Details

    • Testing Instructions:
      Hide

      1) Ensure debugging is set to developer debug
      2) Run unit test for

      lib/simpletest/testcompletionlib.php

      Correct result: Test should pass with no warnings displayed
      When this bug occurs: Test displays warnings

      Show
      1) Ensure debugging is set to developer debug 2) Run unit test for lib/simpletest/testcompletionlib.php Correct result: Test should pass with no warnings displayed When this bug occurs: Test displays warnings
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE
    • Pull Master Branch:
      MDL-27391-master
    • Rank:
      17069

      Description

      Hi Sam,

      When I run the unit tests with this commit '6553cda7c9b9d9ae5439a22841f7986c9b67bc36' , I get these errors:

      set_module_viewed must be called before header is printed

      • line 609 of \lib\completionlib.php: call to debugging()
      • line 255 of \lib\simpletest\testcompletionlib.php: call to completion_info->set_module_viewed()
      • line 72 of \lib\simpletestlib\invoker.php: call to completionlib_test->test_set_module_viewed()
      • line 137 of \lib\simpletestlib\invoker.php: call to SimpleInvoker->invoke()
      • line 53 of \lib\simpletestlib\errors.php: call to SimpleInvokerDecorator->invoke()
      • line 137 of \lib\simpletestlib\invoker.php: call to SimpleErrorTrappingInvoker->invoke()
      • line 43 of \lib\simpletestlib\exceptions.php: call to SimpleInvokerDecorator->invoke()
      • line 148 of \lib\simpletestlib\test_case.php: call to SimpleExceptionTrappingInvoker->invoke()
      • line 617 of \lib\simpletestlib\test_case.php: call to SimpleTestCase->run()
      • line 620 of \lib\simpletestlib\test_case.php: call to TestSuite->run()
      • line 37 of \admin\report\unittest\ex_simple_test.php: call to TestSuite->run()
      • line 144 of \lib\simpletestcoveragelib.php: call to AutoGroupTest->run()
      • line 100 of \admin\report\unittest\index.php: call to autogroup_test_coverage->run()

      Let me know if you need more info. Thanks.

        Issue Links

          Activity

          Hide
          Sam Marshall added a comment -

          Sorry about this stupid glitch. The problem is that the code which checks if you call the function before the header, is obviously inappropriate in unit test.

          In this case I think the only good approach is to check the unit test is running and not display the message.

          Show
          Sam Marshall added a comment - Sorry about this stupid glitch. The problem is that the code which checks if you call the function before the header, is obviously inappropriate in unit test. In this case I think the only good approach is to check the unit test is running and not display the message.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Integrated, thanks!

          Show
          Eloy Lafuente (stronk7) added a comment - Integrated, thanks!
          Hide
          Eloy Lafuente (stronk7) added a comment -

          As far as I had all the environment ready here, I've also tested this and works as expected. Passing test.

          Show
          Eloy Lafuente (stronk7) added a comment - As far as I had all the environment ready here, I've also tested this and works as expected. Passing test.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Yuppi! Thanks!

          Show
          Eloy Lafuente (stronk7) added a comment - Yuppi! Thanks!

            People

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

              Dates

              • Created:
                Updated:
                Resolved: