diff --git a/core/modules/simpletest/tests/fixtures/simpletest_phpunit_run_command_test.php b/core/modules/simpletest/tests/fixtures/simpletest_phpunit_run_command_test.php index f9874c0..839f008 100644 --- a/core/modules/simpletest/tests/fixtures/simpletest_phpunit_run_command_test.php +++ b/core/modules/simpletest/tests/fixtures/simpletest_phpunit_run_command_test.php @@ -4,10 +4,18 @@ use Drupal\Tests\UnitTestCase; +/** + * This test crashes PHP. + * + * To avoid accidentally running, it is not in a normal PSR-4 directory, the + * file name does not adhere to PSR-4 and an environment variable also needs to + * be set for the crash to happen. + */ class SimpletestPhpunitRunCommandTestWillDie extends UnitTestCase { - function testWillDie() { + public function testWillDie() { if (getenv('SimpletestPhpunitRunCommandTestWillDie') === 'fail') { + // This causes a segmentation fault. preg_match('/(.(?!b))*/', str_repeat("a", 10000)); } } diff --git a/core/modules/simpletest/tests/src/Unit/SimpletestPhpunitRunCommandTest.php b/core/modules/simpletest/tests/src/Unit/SimpletestPhpunitRunCommandTest.php index a371891..f49fe5f 100644 --- a/core/modules/simpletest/tests/src/Unit/SimpletestPhpunitRunCommandTest.php +++ b/core/modules/simpletest/tests/src/Unit/SimpletestPhpunitRunCommandTest.php @@ -11,7 +11,12 @@ use Drupal\Tests\UnitTestCase; /** + * Tests simpletest_run_phpunit_tests() handles PHPunit fatals correctly. + * * @group simpletest + * + * @runTestsInSeparateProcesses + * @preserveGlobalState disabled */ class SimpletestPhpunitRunCommandTest extends UnitTestCase {