|
| 1 | +--TEST-- |
| 2 | +The right events are emitted in the right order when PHPUnit's error handler is disabled |
| 3 | +--SKIPIF-- |
| 4 | +<?php declare(strict_types=1); |
| 5 | +if (DIRECTORY_SEPARATOR === '\\') { |
| 6 | + print "skip: this test does not work on Windows / GitHub Actions\n"; |
| 7 | +} |
| 8 | +--FILE-- |
| 9 | +<?php declare(strict_types=1); |
| 10 | +$traceFile = tempnam(sys_get_temp_dir(), __FILE__); |
| 11 | + |
| 12 | +$_SERVER['argv'][] = '--do-not-cache-result'; |
| 13 | +$_SERVER['argv'][] = '--no-output'; |
| 14 | +$_SERVER['argv'][] = '--log-events-text'; |
| 15 | +$_SERVER['argv'][] = $traceFile; |
| 16 | +$_SERVER['argv'][] = '--fail-on-notice'; |
| 17 | +$_SERVER['argv'][] = '--configuration'; |
| 18 | +$_SERVER['argv'][] = __DIR__ . '/_files/error-handler-can-be-disabled'; |
| 19 | + |
| 20 | +require __DIR__ . '/../../bootstrap.php'; |
| 21 | + |
| 22 | +(new PHPUnit\TextUI\Application)->run($_SERVER['argv']); |
| 23 | + |
| 24 | +print file_get_contents($traceFile); |
| 25 | + |
| 26 | +unlink($traceFile); |
| 27 | +--EXPECTF-- |
| 28 | +PHPUnit Started (PHPUnit %s using %s) |
| 29 | +Test Runner Configured |
| 30 | +Bootstrap Finished (%s/src/Foo.php) |
| 31 | +Test Suite Loaded (2 tests) |
| 32 | +Event Facade Sealed |
| 33 | +Test Runner Started |
| 34 | +Test Suite Sorted |
| 35 | +Test Runner Execution Started (2 tests) |
| 36 | +Test Suite Started (%s/phpunit.xml, 2 tests) |
| 37 | +Test Suite Started (default, 2 tests) |
| 38 | +Test Suite Started (PHPUnit\TestFixture\Event\ErrorHandlerCanBeDisabled\FooTest, 2 tests) |
| 39 | +Test Preparation Started (PHPUnit\TestFixture\Event\ErrorHandlerCanBeDisabled\FooTest::testMethodA) |
| 40 | +Test Prepared (PHPUnit\TestFixture\Event\ErrorHandlerCanBeDisabled\FooTest::testMethodA) |
| 41 | +Assertion Succeeded (Constraint: exception of type "Exception", Value: Exception Object #92 ( |
| 42 | + 'message' => 'fopen(%s/missing/directory): Failed to open stream: No such file or directory' |
| 43 | + 'string' => '' |
| 44 | + 'code' => 0 |
| 45 | + 'file' => '%s/src/Foo.php' |
| 46 | + 'line' => 26 |
| 47 | + 'previous' => null |
| 48 | +)) |
| 49 | +Assertion Succeeded (Constraint: exception message contains 'Failed to open stream', Value: 'fopen(%s/missing/directory): Failed to open stream: No such file or directory') |
| 50 | +Test Passed (PHPUnit\TestFixture\Event\ErrorHandlerCanBeDisabled\FooTest::testMethodA) |
| 51 | +Test Finished (PHPUnit\TestFixture\Event\ErrorHandlerCanBeDisabled\FooTest::testMethodA) |
| 52 | +Test Preparation Started (PHPUnit\TestFixture\Event\ErrorHandlerCanBeDisabled\FooTest::testMethodB) |
| 53 | +Test Prepared (PHPUnit\TestFixture\Event\ErrorHandlerCanBeDisabled\FooTest::testMethodB) |
| 54 | +Assertion Succeeded (Constraint: is identical to 'Triggering', Value: 'Triggering') |
| 55 | +Test Passed (PHPUnit\TestFixture\Event\ErrorHandlerCanBeDisabled\FooTest::testMethodB) |
| 56 | +Test Finished (PHPUnit\TestFixture\Event\ErrorHandlerCanBeDisabled\FooTest::testMethodB) |
| 57 | +Test Suite Finished (PHPUnit\TestFixture\Event\ErrorHandlerCanBeDisabled\FooTest, 2 tests) |
| 58 | +Test Suite Finished (default, 2 tests) |
| 59 | +Test Suite Finished (%s/phpunit.xml, 2 tests) |
| 60 | +Test Runner Execution Finished |
| 61 | +Test Runner Finished |
| 62 | +PHPUnit Finished (Shell Exit Code: 0) |
0 commit comments