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

Webservices unit test failures in PHP 8.1 with Moodle 4.2

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 4.2
    • 4.2
    • Web Services
    • MOODLE_402_STABLE
    • MOODLE_402_STABLE
    • MDL-77989-master
    • Hide

      Webservice runs on its own

      1. Run the test without any other tests:

        vendor/bin/phpunit --testsuite webservice_rest_testsuite
        

      Note: This test is not suited to cibot because it must be run as a single test, rather than the entire testsuite which will run the external tests first.

      require_phpunit_isolated()

      Most of this is self-tested. The case we can't test is where we include lib/externallib.php without PHPUNIT_TEST defined.

      1. Copy the attached mdl77989.php to your moodle dir
      2. Run it from CLI

      Remaining changes are unit tested

      Show
      Webservice runs on its own Run the test without any other tests: vendor/bin/phpunit --testsuite webservice_rest_testsuite Note: This test is not suited to cibot because it must be run as a single test, rather than the entire testsuite which will run the external tests first. require_phpunit_isolated() Most of this is self-tested. The case we can't test is where we include lib/externallib.php without PHPUNIT_TEST defined. Copy the attached mdl77989.php to your moodle dir Run it from CLI Remaining changes are unit tested

      Our pipelines (which we've just fixed to work in Ubuntu Jammy are triggering unit test failures on master with the webservice_reset_testsuite using PHP 8.1.18
       
       vendor/bin/phpunit --testsuite webservice_rest_testsuite
       
      There were 13 failures:
       
      1) webservice_rest\server_test::test_xmlize with data set #1 (core_external\external_value Object (...), false, '<VALUE>0</VALUE>\n')
      Failed asserting that null matches expected '<VALUE>0</VALUE>\n
      '.
       
      /var/www/html/webservice/rest/tests/server_test.php:211
      /var/www/html/lib/phpunit/classes/advanced_testcase.php:80
       
      2) webservice_rest\server_test::test_xmlize with data set #2 (core_external\external_value Object (...), true, '<VALUE>1</VALUE>\n')
      Failed asserting that null matches expected '<VALUE>1</VALUE>\n
      '.
       
      /var/www/html/webservice/rest/tests/server_test.php:211
      /var/www/html/lib/phpunit/classes/advanced_testcase.php:80
       
      3) webservice_rest\server_test::test_xmlize with data set #3 (core_external\external_value Object (...), null, '<VALUE null="null"/>\n')
      Failed asserting that null matches expected '<VALUE null="null"/>\n
      '.
       
      /var/www/html/webservice/rest/tests/server_test.php:211
      /var/www/html/lib/phpunit/classes/advanced_testcase.php:80
       
      4) webservice_rest\server_test::test_xmlize with data set #4 (core_external\external_value Object (...), 'a', '<VALUE>a</VALUE>\n')
      Failed asserting that null matches expected '<VALUE>a</VALUE>\n
      '.
       
      /var/www/html/webservice/rest/tests/server_test.php:211
      /var/www/html/lib/phpunit/classes/advanced_testcase.php:80
       
      5) webservice_rest\server_test::test_xmlize with data set #5 (core_external\external_value Object (...), 123, '<VALUE>123</VALUE>\n')
      Failed asserting that null matches expected '<VALUE>123</VALUE>\n
      '.
       
      /var/www/html/webservice/rest/tests/server_test.php:211
      /var/www/html/lib/phpunit/classes/advanced_testcase.php:80
       
      6) webservice_rest\server_test::test_xmlize with data set #6 (core_external\external_multiple_structure Object (...), array(1, 2, 3), '<MULTIPLE>\n<VALUE>1</VALUE>\...PLE>\n')

        1. mdl77989.php
          0.1 kB
        2. test1.png
          test1.png
          135 kB
        3. test2.png
          test2.png
          52 kB

            dobedobedoh Andrew Lyons
            danmarsden Dan Marsden
            Simey Lameze Simey Lameze
            Jun Pataleta Jun Pataleta
            Stevani Andolo Stevani Andolo
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours, 24 minutes
                2h 24m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.