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

Replace usage of deprecated getObjectForTrait mocking

XMLWordPrintable

      See the following since upgrading to PHPUnit 11 (MDL-83468) - ignore the coverage metadata:

      $ vendor/bin/phpunit --display-phpunit-deprecations reportbuilder/tests/local/helpers/join_trait_test.php
      Moodle 5.0dev (Build: 20250221), 7a318d5c85aa15b9ad49a42c4c93b2b663adca95
      Php: 8.2.27, mysqli: 8.4.4, OS: Linux 5.4.0-205-generic x86_64
      PHPUnit 11.5.3 by Sebastian Bergmann and contributors.
       
      Runtime:       PHP 8.2.27
      Configuration: /mnt/export/moodle/master/src/phpunit.xml
       
      DDD                                                                 3 / 3 (100%)
       
      Time: 00:00.187, Memory: 62.50 MB
       
      There was 1 PHPUnit test runner deprecation:
       
      1) Metadata found in doc-comment for class core_reportbuilder\local\helpers\join_trait_test. Metadata in doc-comments is deprecated and will no longer be supported in PHPUnit 12. Update your test code to use attributes instead.
       
      --
       
      3 tests triggered 3 PHPUnit deprecations:
       
      1) core_reportbuilder\local\helpers\join_trait_test::test_add_join
      getObjectForTrait() is deprecated and will be removed in PHPUnit 12 without replacement.
       
      /mnt/export/moodle/master/src/reportbuilder/tests/local/helpers/join_trait_test.php:36
       
      2) core_reportbuilder\local\helpers\join_trait_test::test_add_join_multiple
      getObjectForTrait() is deprecated and will be removed in PHPUnit 12 without replacement.
       
      /mnt/export/moodle/master/src/reportbuilder/tests/local/helpers/join_trait_test.php:48
       
      3) core_reportbuilder\local\helpers\join_trait_test::test_add_joins
      getObjectForTrait() is deprecated and will be removed in PHPUnit 12 without replacement.
       
      /mnt/export/moodle/master/src/reportbuilder/tests/local/helpers/join_trait_test.php:68
       
      OK, but there were issues!
      Tests: 3, Assertions: 3, PHPUnit Deprecations: 4.
      

      See: https://github.com/sebastianbergmann/phpunit/issues/5244

      We need to remove usage of this method before upgrading to PHPUnit 12. Replace with a helper test class

            pholden Paul Holden
            pholden Paul Holden
            Carlos Castillo Carlos Castillo
            David Carrillo David Carrillo
            CiBoT CiBoT
            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 - 43 minutes
                43m

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