Skip to content

Commit

Permalink
Move regression test for #5068 to correct location
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Oct 6, 2022
1 parent af2b1fd commit 4c758b8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
--TEST--
phpunit ../../_files/AssertionFailedErrorChainedTest.php
https://github.com/sebastianbergmann/phpunit/issues/5068
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][] = '--do-not-cache-result';
$_SERVER['argv'][] = '--no-configuration';
$_SERVER['argv'][] = __DIR__ . '/../../_files/AssertionFailedErrorChainedTest.php';
$_SERVER['argv'][] = '--process-isolation';
$_SERVER['argv'][] = __DIR__ . '/5068/Issue5068Test.php';

require_once __DIR__ . '/../../bootstrap.php';
PHPUnit\TextUI\Command::main();
Expand All @@ -17,14 +18,14 @@ Time: %s, Memory: %s

There was 1 failure:

1) AssertionFailedErrorChainedTest::testOne
1) PHPUnit\TestFixture\Issue5068Test::testOne
foo

%sAssertionFailedErrorChainedTest.php:%d
%sIssue5068Test.php:%d

Caused by RuntimeException: foo

%sAssertionFailedErrorChainedTest.php:%d
%sIssue5068Test.php:%d

FAILURES!
Tests: 1, Assertions: 0, Failures: 1.
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,25 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\TestFixture;

use PHPUnit\Framework\AssertionFailedError;
use PHPUnit\Framework\TestCase;
use RuntimeException;
use Throwable;

class AssertionFailedErrorChainedTest extends TestCase
final class Issue5068Test extends TestCase
{
/**
* @runInSeparateProcess
*/
public function testOne(): void
{
throw new \RuntimeException('foo');
throw new RuntimeException('foo');
}

protected function onNotSuccessfulTest(Throwable $t): void
{
throw new AssertionFailedError($t->getMessage(), $t->getCode(), $t, true);
throw new AssertionFailedError($t->getMessage(), $t->getCode(), $t);

/* @noinspection PhpUnreachableStatementInspection */
parent::onNotSuccessfulTest($t);
}
}

0 comments on commit 4c758b8

Please sign in to comment.