-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split test into one version for PHP < 8.4 and one version for PHP >= …
…8.4 (using trigger_error() with E_USER_ERROR is deprecated in PHP 8.4)
- Loading branch information
1 parent
9893b04
commit 131d7f4
Showing
2 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--TEST-- | ||
The right events are emitted in the right order for a test that runs code which triggers E_USER_ERROR | ||
--SKIPIF-- | ||
<?php declare(strict_types=1); | ||
if (version_compare('8.4.0-dev', PHP_VERSION)) { | ||
print 'skip: PHP 8.4 is required.'; | ||
} | ||
--FILE-- | ||
<?php declare(strict_types=1); | ||
$traceFile = tempnam(sys_get_temp_dir(), __FILE__); | ||
|
||
$_SERVER['argv'][] = '--do-not-cache-result'; | ||
$_SERVER['argv'][] = '--no-configuration'; | ||
$_SERVER['argv'][] = '--no-output'; | ||
$_SERVER['argv'][] = '--log-events-text'; | ||
$_SERVER['argv'][] = $traceFile; | ||
$_SERVER['argv'][] = __DIR__ . '/_files/UserErrorTest.php'; | ||
|
||
require __DIR__ . '/../../bootstrap.php'; | ||
|
||
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']); | ||
|
||
print file_get_contents($traceFile); | ||
|
||
unlink($traceFile); | ||
--EXPECTF-- | ||
PHPUnit Started (PHPUnit %s using %s) | ||
Test Runner Configured | ||
Test Suite Loaded (2 tests) | ||
Event Facade Sealed | ||
Test Runner Started | ||
Test Suite Sorted | ||
Test Runner Execution Started (2 tests) | ||
Test Suite Started (PHPUnit\TestFixture\Event\UserErrorTest, 2 tests) | ||
Test Preparation Started (PHPUnit\TestFixture\Event\UserErrorTest::testUserError) | ||
Test Prepared (PHPUnit\TestFixture\Event\UserErrorTest::testUserError) | ||
Assertion Succeeded (Constraint: is true, Value: true) | ||
Test Triggered PHP Deprecation (PHPUnit\TestFixture\Event\UserErrorTest::testUserError) | ||
Passing E_USER_ERROR to trigger_error() is deprecated since 8.4, throw an exception or call exit with a string message instead | ||
Test Triggered Error (PHPUnit\TestFixture\Event\UserErrorTest::testUserError) | ||
message | ||
Test Errored (PHPUnit\TestFixture\Event\UserErrorTest::testUserError) | ||
E_USER_ERROR was triggered | ||
Test Finished (PHPUnit\TestFixture\Event\UserErrorTest::testUserError) | ||
Test Preparation Started (PHPUnit\TestFixture\Event\UserErrorTest::testUserErrorMustAbortExecution) | ||
Test Prepared (PHPUnit\TestFixture\Event\UserErrorTest::testUserErrorMustAbortExecution) | ||
Test Triggered PHP Deprecation (PHPUnit\TestFixture\Event\UserErrorTest::testUserErrorMustAbortExecution) | ||
Passing E_USER_ERROR to trigger_error() is deprecated since 8.4, throw an exception or call exit with a string message instead | ||
Test Triggered Error (PHPUnit\TestFixture\Event\UserErrorTest::testUserErrorMustAbortExecution) | ||
message | ||
Test Errored (PHPUnit\TestFixture\Event\UserErrorTest::testUserErrorMustAbortExecution) | ||
E_USER_ERROR was triggered | ||
Test Finished (PHPUnit\TestFixture\Event\UserErrorTest::testUserErrorMustAbortExecution) | ||
Test Suite Finished (PHPUnit\TestFixture\Event\UserErrorTest, 2 tests) | ||
Test Runner Execution Finished | ||
Test Runner Finished | ||
PHPUnit Finished (Shell Exit Code: 2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters