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

PHPUnit crashes when running contentbank tests with process isolation

    XMLWordPrintable

Details

    Description

      $ vendor/bin/phpunit contentbank/tests/contentbank_test.php --filter test_is_context_allowed --process-isolation
      Moodle 4.2beta (Build: 20230414)
      Php: 8.0.28, mysqli: 8.0.32, OS: Linux 5.4.0-146-generic x86_64
      PHPUnit 9.5.27 by Sebastian Bergmann and contributors.
       
      Serialization of 'Closure' is not allowed
      

      The test case never completes, because PHPUnit crashes during the run

      It's related to a "feature" (bug?) within PHPUnit that is described at https://github.com/sebastianbergmann/phpunit/issues/2739 - caused by the following:

      1. Test using a @dataProvider;
      2. @dataProvider returns a closure/callable;
      3. Running with --process-isolation

      Grepping the codebase, it seems we hit this only in contentbank tests (I didn't find any other cases that would trigger it)

      Attachments

        Activity

          People

            pholden Paul Holden
            pholden Paul Holden
            Amaia Anabitarte Amaia Anabitarte
            Ilya Tregubov Ilya Tregubov
            Kim Jared Lucas Kim Jared Lucas
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              24/Apr/23

              Time Tracking

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