Skip to content

Commit

Permalink
created test for sebastianbergmann#5567
Browse files Browse the repository at this point in the history
  • Loading branch information
ptomulik committed Nov 20, 2023
1 parent e57e12a commit a10689b
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 0 deletions.
56 changes: 56 additions & 0 deletions tests/end-to-end/regression/5567.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
--TEST--
https://github.com/sebastianbergmann/phpunit/issues/5567
--FILE--
<?php declare(strict_types=1);
$junitFile = tempnam(sys_get_temp_dir(), __FILE__);

$_SERVER['argv'][] = '--do-not-cache-result';
$_SERVER['argv'][] = '--no-configuration';
$_SERVER['argv'][] = '--log-junit';
$_SERVER['argv'][] = $junitFile;
$_SERVER['argv'][] = __DIR__ . '/5567/Issue5567Test.php';

require_once __DIR__ . '/../../bootstrap.php';

(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);

print file_get_contents($junitFile);

unlink($junitFile);
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.

Runtime: %s

F 1 / 1 (100%)

Time: %s, Memory: %s MB

There was 1 failure:

1) PHPUnit\TestFixture\Issue5567\Issue5567Test::testAnythingThatFailsWithRecursiveArray
Failed asserting that Array &0 [
'self' => Array &1 [
'self' => Array &1,
],
] is false.

%sIssue5567Test.php:%d

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="PHPUnit\TestFixture\Issue5567\Issue5567Test" file="%sIssue5567Test.php" tests="1" assertions="1" errors="0" failures="1" skipped="0" time="%f">
<testcase name="testAnythingThatFailsWithRecursiveArray" file="%sIssue5567Test.php" line="%d" class="PHPUnit\TestFixture\Issue5567\Issue5567Test" classname="PHPUnit.TestFixture.Issue5567.Issue5567Test" assertions="1" time="%f">
<failure type="PHPUnit\Framework\ExpectationFailedException">PHPUnit\TestFixture\Issue5567\Issue5567Test::testAnythingThatFailsWithRecursiveArray
Failed asserting that Array &amp;0 [
'self' =&gt; Array &amp;1 [
'self' =&gt; Array &amp;1,
],
] is false.

%sIssue5567Test.php:%d</failure>
</testcase>
</testsuite>
</testsuites>
23 changes: 23 additions & 0 deletions tests/end-to-end/regression/5567/Issue5567Test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\TestFixture\Issue5567;

use PHPUnit\Framework\TestCase;

final class Issue5567Test extends TestCase
{
public function testAnythingThatFailsWithRecursiveArray(): void
{
$array = [];
$array['self'] = &$array;

$this->assertFalse($array);
}
}

0 comments on commit a10689b

Please sign in to comment.