Skip to content

Commit

Permalink
add tests (5428 and 5587 issues)
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Nov 30, 2023
1 parent 0db0f8b commit b67a9dc
Show file tree
Hide file tree
Showing 15 changed files with 199 additions and 31 deletions.
8 changes: 8 additions & 0 deletions tests/end-to-end/event/_files/DeprecatedFeatureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
namespace PHPUnit\TestFixture\Event;

use const E_USER_DEPRECATED;
use function error_get_last;
use function trigger_error;
use PHPUnit\Framework\TestCase;

Expand All @@ -22,4 +23,11 @@ public function testDeprecatedFeature(): void

$this->assertTrue(true);
}

public function testDeprecatedSuppressedErrorGetLast(): void
{
$this->assertNull(error_get_last());
@trigger_error('message', E_USER_DEPRECATED);
$this->assertIsArray(error_get_last());
}
}
16 changes: 16 additions & 0 deletions tests/end-to-end/event/_files/IgnoreDeprecationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/
namespace PHPUnit\TestFixture\Event;

use function error_get_last;
use function trigger_error;
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
use PHPUnit\Framework\TestCase;
Expand All @@ -29,4 +30,19 @@ public function testTwo(): void

$this->assertTrue(true);
}

#[IgnoreDeprecations]
public function testOneErrorGetLast(): void
{
$this->assertNull(error_get_last());
trigger_error('message', E_USER_DEPRECATED);
$this->assertIsArray(error_get_last());
}

public function testTwoErrorGetLast(): void
{
$this->assertNull(error_get_last());
trigger_error('message', E_USER_DEPRECATED);
$this->assertIsArray(error_get_last());
}
}
8 changes: 8 additions & 0 deletions tests/end-to-end/event/_files/SuppressedUserNoticeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/
namespace PHPUnit\TestFixture\Event;

use function error_get_last;
use function trigger_error;
use PHPUnit\Framework\TestCase;

Expand All @@ -20,4 +21,11 @@ public function testSuppressedUserNotice(): void

@trigger_error('message', E_USER_NOTICE);
}

public function testSuppressedUserNoticeErrorGetLast(): void
{
$this->assertNull(error_get_last());
@trigger_error('message', E_USER_NOTICE);
$this->assertIsArray(error_get_last());
}
}
8 changes: 8 additions & 0 deletions tests/end-to-end/event/_files/SuppressedUserWarningTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/
namespace PHPUnit\TestFixture\Event;

use function error_get_last;
use function trigger_error;
use PHPUnit\Framework\TestCase;

Expand All @@ -20,4 +21,11 @@ public function testSuppressedUserWarning(): void

@trigger_error('message', E_USER_WARNING);
}

public function testSuppressedUserWarningErrorGetLast(): void
{
$this->assertNull(error_get_last());
@trigger_error('message', E_USER_WARNING);
$this->assertIsArray(error_get_last());
}
}
6 changes: 6 additions & 0 deletions tests/end-to-end/event/_files/UserErrorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,10 @@ public function testUserError(): void

trigger_error('message', E_USER_ERROR);
}

public function testUserErrorMustAbortExecution(): void
{
trigger_error('message', E_USER_ERROR);
$this->assertTrue(false);
}
}
8 changes: 8 additions & 0 deletions tests/end-to-end/event/_files/UserNoticeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/
namespace PHPUnit\TestFixture\Event;

use function error_get_last;
use function trigger_error;
use PHPUnit\Framework\TestCase;

Expand All @@ -20,4 +21,11 @@ public function testUserNotice(): void

trigger_error('message', E_USER_NOTICE);
}

public function testUserNoticeErrorGetLast(): void
{
$this->assertNull(error_get_last());
trigger_error('message', E_USER_NOTICE);
$this->assertIsArray(error_get_last());
}
}
8 changes: 8 additions & 0 deletions tests/end-to-end/event/_files/UserWarningTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/
namespace PHPUnit\TestFixture\Event;

use function error_get_last;
use function trigger_error;
use PHPUnit\Framework\TestCase;

Expand All @@ -20,4 +21,11 @@ public function testUserWarning(): void

trigger_error('message', E_USER_WARNING);
}

public function testUserWarningErrorGetLast(): void
{
$this->assertNull(error_get_last());
trigger_error('message', E_USER_WARNING);
$this->assertIsArray(error_get_last());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ unlink($traceFile);
--EXPECTF--
PHPUnit Started (PHPUnit %s using %s)
Test Runner Configured
Test Suite Loaded (2 tests)
Test Suite Loaded (4 tests)
Event Facade Sealed
Test Runner Started
Test Suite Sorted
Test Runner Execution Started (2 tests)
Test Suite Started (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest, 2 tests)
Test Runner Execution Started (4 tests)
Test Suite Started (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest, 4 tests)
Test Preparation Started (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testOne)
Test Prepared (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testOne)
Test Triggered Test-Ignored Deprecation (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testOne)
Expand All @@ -41,7 +41,33 @@ message
Assertion Succeeded (Constraint: is true, Value: true)
Test Passed (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testTwo)
Test Finished (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testTwo)
Test Suite Finished (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest, 2 tests)
Test Preparation Started (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testOneErrorGetLast)
Test Prepared (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testOneErrorGetLast)
Assertion Succeeded (Constraint: is null, Value: {enable export of objects to see this value})
Test Triggered Test-Ignored Deprecation (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testOneErrorGetLast)
message
Assertion Succeeded (Constraint: is of type array, Value: Array &0 [
'type' => 16384,
'message' => 'message',
'file' => '%s%e_files%eIgnoreDeprecationsTest.php',
'line' => %d,
])
Test Passed (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testOneErrorGetLast)
Test Finished (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testOneErrorGetLast)
Test Preparation Started (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testTwoErrorGetLast)
Test Prepared (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testTwoErrorGetLast)
Assertion Succeeded (Constraint: is null, Value: {enable export of objects to see this value})
Test Triggered Deprecation (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testTwoErrorGetLast)
message
Assertion Succeeded (Constraint: is of type array, Value: Array &0 [
'type' => 16384,
'message' => 'message',
'file' => '%s%e_files%eIgnoreDeprecationsTest.php',
'line' => %d,
])
Test Passed (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testTwoErrorGetLast)
Test Finished (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testTwoErrorGetLast)
Test Suite Finished (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest, 4 tests)
Test Runner Execution Finished
Test Runner Finished
PHPUnit Finished (Shell Exit Code: 0)
21 changes: 17 additions & 4 deletions tests/end-to-end/event/suppressed-user-notice.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,33 @@ unlink($traceFile);
--EXPECTF--
PHPUnit Started (PHPUnit %s using %s)
Test Runner Configured
Test Suite Loaded (1 test)
Test Suite Loaded (2 tests)
Event Facade Sealed
Test Runner Started
Test Suite Sorted
Test Runner Execution Started (1 test)
Test Suite Started (PHPUnit\TestFixture\Event\SuppressedUserNoticeTest, 1 test)
Test Runner Execution Started (2 tests)
Test Suite Started (PHPUnit\TestFixture\Event\SuppressedUserNoticeTest, 2 tests)
Test Preparation Started (PHPUnit\TestFixture\Event\SuppressedUserNoticeTest::testSuppressedUserNotice)
Test Prepared (PHPUnit\TestFixture\Event\SuppressedUserNoticeTest::testSuppressedUserNotice)
Assertion Succeeded (Constraint: is true, Value: true)
Test Triggered Suppressed Notice (PHPUnit\TestFixture\Event\SuppressedUserNoticeTest::testSuppressedUserNotice)
message
Test Passed (PHPUnit\TestFixture\Event\SuppressedUserNoticeTest::testSuppressedUserNotice)
Test Finished (PHPUnit\TestFixture\Event\SuppressedUserNoticeTest::testSuppressedUserNotice)
Test Suite Finished (PHPUnit\TestFixture\Event\SuppressedUserNoticeTest, 1 test)
Test Preparation Started (PHPUnit\TestFixture\Event\SuppressedUserNoticeTest::testSuppressedUserNoticeErrorGetLast)
Test Prepared (PHPUnit\TestFixture\Event\SuppressedUserNoticeTest::testSuppressedUserNoticeErrorGetLast)
Assertion Succeeded (Constraint: is null, Value: {enable export of objects to see this value})
Test Triggered Suppressed Notice (PHPUnit\TestFixture\Event\SuppressedUserNoticeTest::testSuppressedUserNoticeErrorGetLast)
message
Assertion Succeeded (Constraint: is of type array, Value: Array &0 [
'type' => 1024,
'message' => 'message',
'file' => '%s%e_files%eSuppressedUserNoticeTest.php',
'line' => %d,
])
Test Passed (PHPUnit\TestFixture\Event\SuppressedUserNoticeTest::testSuppressedUserNoticeErrorGetLast)
Test Finished (PHPUnit\TestFixture\Event\SuppressedUserNoticeTest::testSuppressedUserNoticeErrorGetLast)
Test Suite Finished (PHPUnit\TestFixture\Event\SuppressedUserNoticeTest, 2 tests)
Test Runner Execution Finished
Test Runner Finished
PHPUnit Finished (Shell Exit Code: 0)
21 changes: 17 additions & 4 deletions tests/end-to-end/event/suppressed-user-warning.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,33 @@ unlink($traceFile);
--EXPECTF--
PHPUnit Started (PHPUnit %s using %s)
Test Runner Configured
Test Suite Loaded (1 test)
Test Suite Loaded (2 tests)
Event Facade Sealed
Test Runner Started
Test Suite Sorted
Test Runner Execution Started (1 test)
Test Suite Started (PHPUnit\TestFixture\Event\SuppressedUserWarningTest, 1 test)
Test Runner Execution Started (2 tests)
Test Suite Started (PHPUnit\TestFixture\Event\SuppressedUserWarningTest, 2 tests)
Test Preparation Started (PHPUnit\TestFixture\Event\SuppressedUserWarningTest::testSuppressedUserWarning)
Test Prepared (PHPUnit\TestFixture\Event\SuppressedUserWarningTest::testSuppressedUserWarning)
Assertion Succeeded (Constraint: is true, Value: true)
Test Triggered Suppressed Warning (PHPUnit\TestFixture\Event\SuppressedUserWarningTest::testSuppressedUserWarning)
message
Test Passed (PHPUnit\TestFixture\Event\SuppressedUserWarningTest::testSuppressedUserWarning)
Test Finished (PHPUnit\TestFixture\Event\SuppressedUserWarningTest::testSuppressedUserWarning)
Test Suite Finished (PHPUnit\TestFixture\Event\SuppressedUserWarningTest, 1 test)
Test Preparation Started (PHPUnit\TestFixture\Event\SuppressedUserWarningTest::testSuppressedUserWarningErrorGetLast)
Test Prepared (PHPUnit\TestFixture\Event\SuppressedUserWarningTest::testSuppressedUserWarningErrorGetLast)
Assertion Succeeded (Constraint: is null, Value: {enable export of objects to see this value})
Test Triggered Suppressed Warning (PHPUnit\TestFixture\Event\SuppressedUserWarningTest::testSuppressedUserWarningErrorGetLast)
message
Assertion Succeeded (Constraint: is of type array, Value: Array &0 [
'type' => 512,
'message' => 'message',
'file' => '%s%e_files%eSuppressedUserWarningTest.php',
'line' => %d,
])
Test Passed (PHPUnit\TestFixture\Event\SuppressedUserWarningTest::testSuppressedUserWarningErrorGetLast)
Test Finished (PHPUnit\TestFixture\Event\SuppressedUserWarningTest::testSuppressedUserWarningErrorGetLast)
Test Suite Finished (PHPUnit\TestFixture\Event\SuppressedUserWarningTest, 2 tests)
Test Runner Execution Finished
Test Runner Finished
PHPUnit Finished (Shell Exit Code: 0)
21 changes: 17 additions & 4 deletions tests/end-to-end/event/user-deprecated.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ unlink($traceFile);
--EXPECTF--
PHPUnit Started (PHPUnit %s using %s)
Test Runner Configured
Test Suite Loaded (1 test)
Test Suite Loaded (2 tests)
Event Facade Sealed
Test Runner Started
Test Suite Sorted
Test Runner Execution Started (1 test)
Test Suite Started (PHPUnit\TestFixture\Event\DeprecatedFeatureTest, 1 test)
Test Runner Execution Started (2 tests)
Test Suite Started (PHPUnit\TestFixture\Event\DeprecatedFeatureTest, 2 tests)
Test Preparation Started (PHPUnit\TestFixture\Event\DeprecatedFeatureTest::testDeprecatedFeature)
Test Prepared (PHPUnit\TestFixture\Event\DeprecatedFeatureTest::testDeprecatedFeature)
Test Triggered Deprecation (PHPUnit\TestFixture\Event\DeprecatedFeatureTest::testDeprecatedFeature)
Expand All @@ -36,7 +36,20 @@ message
Assertion Succeeded (Constraint: is true, Value: true)
Test Passed (PHPUnit\TestFixture\Event\DeprecatedFeatureTest::testDeprecatedFeature)
Test Finished (PHPUnit\TestFixture\Event\DeprecatedFeatureTest::testDeprecatedFeature)
Test Suite Finished (PHPUnit\TestFixture\Event\DeprecatedFeatureTest, 1 test)
Test Preparation Started (PHPUnit\TestFixture\Event\DeprecatedFeatureTest::testDeprecatedSuppressedErrorGetLast)
Test Prepared (PHPUnit\TestFixture\Event\DeprecatedFeatureTest::testDeprecatedSuppressedErrorGetLast)
Assertion Succeeded (Constraint: is null, Value: {enable export of objects to see this value})
Test Triggered Suppressed Deprecation (PHPUnit\TestFixture\Event\DeprecatedFeatureTest::testDeprecatedSuppressedErrorGetLast)
message
Assertion Succeeded (Constraint: is of type array, Value: Array &0 [
'type' => 16384,
'message' => 'message',
'file' => '%s%e_files%eDeprecatedFeatureTest.php',
'line' => %d,
])
Test Passed (PHPUnit\TestFixture\Event\DeprecatedFeatureTest::testDeprecatedSuppressedErrorGetLast)
Test Finished (PHPUnit\TestFixture\Event\DeprecatedFeatureTest::testDeprecatedSuppressedErrorGetLast)
Test Suite Finished (PHPUnit\TestFixture\Event\DeprecatedFeatureTest, 2 tests)
Test Runner Execution Finished
Test Runner Finished
PHPUnit Finished (Shell Exit Code: 0)
15 changes: 11 additions & 4 deletions tests/end-to-end/event/user-error.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ unlink($traceFile);
--EXPECTF--
PHPUnit Started (PHPUnit %s using %s)
Test Runner Configured
Test Suite Loaded (1 test)
Test Suite Loaded (2 tests)
Event Facade Sealed
Test Runner Started
Test Suite Sorted
Test Runner Execution Started (1 test)
Test Suite Started (PHPUnit\TestFixture\Event\UserErrorTest, 1 test)
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)
Expand All @@ -35,7 +35,14 @@ message
Test Errored (PHPUnit\TestFixture\Event\UserErrorTest::testUserError)
Any E_*_ERROR must abort execution
Test Finished (PHPUnit\TestFixture\Event\UserErrorTest::testUserError)
Test Suite Finished (PHPUnit\TestFixture\Event\UserErrorTest, 1 test)
Test Preparation Started (PHPUnit\TestFixture\Event\UserErrorTest::testUserErrorMustAbortExecution)
Test Prepared (PHPUnit\TestFixture\Event\UserErrorTest::testUserErrorMustAbortExecution)
Test Triggered Error (PHPUnit\TestFixture\Event\UserErrorTest::testUserErrorMustAbortExecution)
message
Test Errored (PHPUnit\TestFixture\Event\UserErrorTest::testUserErrorMustAbortExecution)
Any E_*_ERROR must abort execution
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)
21 changes: 17 additions & 4 deletions tests/end-to-end/event/user-notice.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,33 @@ unlink($traceFile);
--EXPECTF--
PHPUnit Started (PHPUnit %s using %s)
Test Runner Configured
Test Suite Loaded (1 test)
Test Suite Loaded (2 tests)
Event Facade Sealed
Test Runner Started
Test Suite Sorted
Test Runner Execution Started (1 test)
Test Suite Started (PHPUnit\TestFixture\Event\UserNoticeTest, 1 test)
Test Runner Execution Started (2 tests)
Test Suite Started (PHPUnit\TestFixture\Event\UserNoticeTest, 2 tests)
Test Preparation Started (PHPUnit\TestFixture\Event\UserNoticeTest::testUserNotice)
Test Prepared (PHPUnit\TestFixture\Event\UserNoticeTest::testUserNotice)
Assertion Succeeded (Constraint: is true, Value: true)
Test Triggered Notice (PHPUnit\TestFixture\Event\UserNoticeTest::testUserNotice)
message
Test Passed (PHPUnit\TestFixture\Event\UserNoticeTest::testUserNotice)
Test Finished (PHPUnit\TestFixture\Event\UserNoticeTest::testUserNotice)
Test Suite Finished (PHPUnit\TestFixture\Event\UserNoticeTest, 1 test)
Test Preparation Started (PHPUnit\TestFixture\Event\UserNoticeTest::testUserNoticeErrorGetLast)
Test Prepared (PHPUnit\TestFixture\Event\UserNoticeTest::testUserNoticeErrorGetLast)
Assertion Succeeded (Constraint: is null, Value: {enable export of objects to see this value})
Test Triggered Notice (PHPUnit\TestFixture\Event\UserNoticeTest::testUserNoticeErrorGetLast)
message
Assertion Succeeded (Constraint: is of type array, Value: Array &0 [
'type' => 1024,
'message' => 'message',
'file' => '%s%e_files%eUserNoticeTest.php',
'line' => %d,
])
Test Passed (PHPUnit\TestFixture\Event\UserNoticeTest::testUserNoticeErrorGetLast)
Test Finished (PHPUnit\TestFixture\Event\UserNoticeTest::testUserNoticeErrorGetLast)
Test Suite Finished (PHPUnit\TestFixture\Event\UserNoticeTest, 2 tests)
Test Runner Execution Finished
Test Runner Finished
PHPUnit Finished (Shell Exit Code: 0)
Loading

0 comments on commit b67a9dc

Please sign in to comment.