From b7569ec26362c940edeed57e669da752d748a5e5 Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Tue, 21 Mar 2023 11:06:01 +0100 Subject: [PATCH] Add test for #5287 --- tests/end-to-end/regression/5287.phpt | 63 +++++++++++++++++++ .../regression/5287/A/AnotherClassTest.php | 29 +++++++++ .../regression/5287/B/MyClassTest.php | 20 ++++++ .../regression/5287/C/MyClassTest.php | 20 ++++++ 4 files changed, 132 insertions(+) create mode 100644 tests/end-to-end/regression/5287.phpt create mode 100644 tests/end-to-end/regression/5287/A/AnotherClassTest.php create mode 100644 tests/end-to-end/regression/5287/B/MyClassTest.php create mode 100644 tests/end-to-end/regression/5287/C/MyClassTest.php diff --git a/tests/end-to-end/regression/5287.phpt b/tests/end-to-end/regression/5287.phpt new file mode 100644 index 00000000000..a454476075a --- /dev/null +++ b/tests/end-to-end/regression/5287.phpt @@ -0,0 +1,63 @@ +--TEST-- +https://github.com/sebastianbergmann/phpunit/issues/5287 +--XFAIL-- +https://github.com/sebastianbergmann/phpunit/issues/5287 +--SKIPIF-- +run($_SERVER['argv']); + +print file_get_contents($traceFile); + +unlink($traceFile); +--EXPECTF-- +PHPUnit Started (PHPUnit %s using %s) +Test Runner Configured +Test Suite Loaded (3 tests) +Event Facade Sealed +Test Runner Started +Test Suite Sorted +Test Runner Execution Started (3 tests) +Test Suite Started (%s/5287, 3 tests) +Test Suite Started (PHPUnit\TestFixture\Issue5278\A\AnotherClassTest, 1 test) +Test Suite Started (PHPUnit\TestFixture\Issue5278\A\AnotherClassTest::test, 1 test) +Test Preparation Started (PHPUnit\TestFixture\Issue5278\A\AnotherClassTest::test#0) +Test Prepared (PHPUnit\TestFixture\Issue5278\A\AnotherClassTest::test#0) +Assertion Succeeded (Constraint: is true, Value: true) +Test Passed (PHPUnit\TestFixture\Issue5278\A\AnotherClassTest::test#0) +Test Finished (PHPUnit\TestFixture\Issue5278\A\AnotherClassTest::test#0) +Test Suite Finished (PHPUnit\TestFixture\Issue5278\A\AnotherClassTest::test, 1 test) +Test Suite Finished (PHPUnit\TestFixture\Issue5278\A\AnotherClassTest, 1 test) +Test Suite Started (PHPUnit\TestFixture\Issue5278\B\MyClassTest, 1 test) +Test Preparation Started (PHPUnit\TestFixture\Issue5278\B\MyClassTest::test) +Test Prepared (PHPUnit\TestFixture\Issue5278\B\MyClassTest::test) +Assertion Succeeded (Constraint: is true, Value: true) +Test Passed (PHPUnit\TestFixture\Issue5278\B\MyClassTest::test) +Test Finished (PHPUnit\TestFixture\Issue5278\B\MyClassTest::test) +Test Suite Finished (PHPUnit\TestFixture\Issue5278\B\MyClassTest, 1 test) +Test Suite Started (PHPUnit\TestFixture\Issue5278\C\MyClassTest, 1 test) +Test Preparation Started (PHPUnit\TestFixture\Issue5278\C\MyClassTest::test) +Test Prepared (PHPUnit\TestFixture\Issue5278\C\MyClassTest::test) +Assertion Succeeded (Constraint: is true, Value: true) +Test Passed (PHPUnit\TestFixture\Issue5278\C\MyClassTest::test) +Test Finished (PHPUnit\TestFixture\Issue5278\C\MyClassTest::test) +Test Suite Finished (PHPUnit\TestFixture\Issue5278\C\MyClassTest, 1 test) +Test Suite Finished (%s/5287, 3 tests) +Test Runner Execution Finished +Test Runner Finished +PHPUnit Finished (Shell Exit Code: 0) diff --git a/tests/end-to-end/regression/5287/A/AnotherClassTest.php b/tests/end-to-end/regression/5287/A/AnotherClassTest.php new file mode 100644 index 00000000000..b4e611fab61 --- /dev/null +++ b/tests/end-to-end/regression/5287/A/AnotherClassTest.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TestFixture\Issue5278\A; + +use PHPUnit\Framework\TestCase; +use PHPUnit\TestFixture\Issue5278\C\MyClassTest; + +final class AnotherClassTest extends TestCase +{ + public static function provide(): array + { + new MyClassTest('test'); + + return [[true]]; + } + + /** @dataProvider provide */ + public function test(bool $value): void + { + $this->assertTrue($value); + } +} diff --git a/tests/end-to-end/regression/5287/B/MyClassTest.php b/tests/end-to-end/regression/5287/B/MyClassTest.php new file mode 100644 index 00000000000..46843c217af --- /dev/null +++ b/tests/end-to-end/regression/5287/B/MyClassTest.php @@ -0,0 +1,20 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TestFixture\Issue5278\B; + +use PHPUnit\Framework\TestCase; + +final class MyClassTest extends TestCase +{ + public function test(): void + { + $this->assertTrue(false); + } +} diff --git a/tests/end-to-end/regression/5287/C/MyClassTest.php b/tests/end-to-end/regression/5287/C/MyClassTest.php new file mode 100644 index 00000000000..329225082d4 --- /dev/null +++ b/tests/end-to-end/regression/5287/C/MyClassTest.php @@ -0,0 +1,20 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TestFixture\Issue5278\C; + +use PHPUnit\Framework\TestCase; + +final class MyClassTest extends TestCase +{ + public function test(): void + { + $this->assertTrue(true); + } +}