Skip to content

Commit 7aae80f

Browse files
staabmsebastianbergmann
authored andcommitted
Regression test for error_log()
1 parent bdda253 commit 7aae80f

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
--TEST--
2+
https://github.com/sebastianbergmann/phpunit/issues/2155
3+
--FILE--
4+
<?php declare(strict_types=1);
5+
$_SERVER['argv'][] = '--do-not-cache-result';
6+
$_SERVER['argv'][] = '--no-configuration';
7+
$_SERVER['argv'][] = '--testdox';
8+
$_SERVER['argv'][] = __DIR__ . '/2155/Issue2155Test_NoExpectsLog.php';
9+
10+
require_once __DIR__ . '/../../bootstrap.php';
11+
12+
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
13+
--EXPECTF--
14+
PHPUnit %s by Sebastian Bergmann and contributors.
15+
16+
Runtime: %s
17+
18+
logged a side effect
19+
. 1 / 1 (100%)
20+
21+
Time: %s, Memory: %s
22+
23+
Issue2155Test_No Expects Log (PHPUnit\TestFixture\Issue2155\Issue2155Test_NoExpectsLog)
24+
✔ One
25+
26+
OK (1 test, 1 assertion)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php declare(strict_types=1);
2+
/*
3+
* This file is part of PHPUnit.
4+
*
5+
* (c) Sebastian Bergmann <[email protected]>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
namespace PHPUnit\TestFixture\Issue2155;
11+
12+
use function error_log;
13+
use PHPUnit\Framework\TestCase;
14+
15+
class Foo
16+
{
17+
public function doFoo()
18+
{
19+
error_log('logged a side effect');
20+
21+
return '';
22+
}
23+
}
24+
25+
final class Issue2155Test_NoExpectsLog extends TestCase
26+
{
27+
public function testOne(): void
28+
{
29+
$foo = new Foo;
30+
31+
$this->assertSame('', $foo->doFoo());
32+
}
33+
}

0 commit comments

Comments
 (0)