Problem/Motivation
__PHPUNIT_BOOTSTRAP was removed along with all globals in PHPUnit 10. DependencySerializationTrait relies on it to "fix" tests.
This was added as part of #2553655: Convert ViewKernelTestBase to use KernelTestBaseTNG and then modified by #2909164: Fatal error with stub container in DependencySerializationTrait::__wakeup() as a way to deal with hard to understand test failures.
Steps to reproduce
This is exposed by this failure running tests with PHPUnit 10:
4) Drupal\Tests\views_ui\Unit\ViewUIObjectTest::testSerialization
Drupal\Core\DependencyInjection\ContainerNotInitializedException: \Drupal::$container is not initialized yet. \Drupal::setContainer() must be called with a real container.
/app/core/lib/Drupal.php:169
/app/core/lib/Drupal/Core/DependencyInjection/DependencySerializationTrait.php:80
/app/core/modules/views_ui/tests/src/Unit/ViewUIObjectTest.php:134
/app/vendor/phpunit/phpunit/src/Framework/TestRunner.php:103
/app/vendor/phpunit/phpunit/src/Framework/TestSuite.php:340
Additionally here is the change in PHPUnit where this was removed:
https://github.com/sebastianbergmann/phpunit/commit/91fa2f8256eba9ed40a34b87aab8b869ee836099
Proposed resolution
Remove PHPUNIT hack in DependencySerializationTrait.
Remaining tasks
User interface changes
NA
API changes
None
Data model changes
NA
Release notes snippet
NA