From d39bf28f45b3b488318d63487fe256048923028e Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Wed, 5 Feb 2025 10:53:39 +0100 Subject: [PATCH] Test error_log() in tests --- tests/end-to-end/regression/2155.phpt | 25 +++++++++++++++ .../regression/2155/Issue2155Test.php | 32 +++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 tests/end-to-end/regression/2155.phpt create mode 100644 tests/end-to-end/regression/2155/Issue2155Test.php diff --git a/tests/end-to-end/regression/2155.phpt b/tests/end-to-end/regression/2155.phpt new file mode 100644 index 0000000000..b4f7fdd360 --- /dev/null +++ b/tests/end-to-end/regression/2155.phpt @@ -0,0 +1,25 @@ +--TEST-- +https://github.com/sebastianbergmann/phpunit/issues/2155 +--FILE-- +run($_SERVER['argv']); +--EXPECTF-- +PHPUnit %s by Sebastian Bergmann and contributors. + +Runtime: %s + +. 1 / 1 (100%) + +Time: %s, Memory: %s + +Issue2155 (PHPUnit\TestFixture\Issue2155\Issue2155) + ✔ 1 + +OK (1 test, 1 assertion) diff --git a/tests/end-to-end/regression/2155/Issue2155Test.php b/tests/end-to-end/regression/2155/Issue2155Test.php new file mode 100644 index 0000000000..ffd0efcd8b --- /dev/null +++ b/tests/end-to-end/regression/2155/Issue2155Test.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TestFixture\Issue2155; + +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\TestDox; +use PHPUnit\Framework\TestCase; + +class Foo { + public function doFoo() { + error_log('logged a side effect'); + + return ''; + } +} + +final class Issue2155Test extends TestCase +{ + public function testOne(): void + { + $foo = new Foo(); + + self::assertSame('', $foo->doFoo()); + } +}