Skip to content

Commit 479d181

Browse files
mvoriseksebastianbergmann
authored andcommitted
add tests (5428 and 5587 issues)
1 parent 9a8a8ed commit 479d181

15 files changed

+199
-31
lines changed

tests/end-to-end/event/_files/DeprecatedFeatureTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
namespace PHPUnit\TestFixture\Event;
1111

1212
use const E_USER_DEPRECATED;
13+
use function error_get_last;
1314
use function trigger_error;
1415
use PHPUnit\Framework\TestCase;
1516

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

2324
$this->assertTrue(true);
2425
}
26+
27+
public function testDeprecatedSuppressedErrorGetLast(): void
28+
{
29+
$this->assertNull(error_get_last());
30+
@trigger_error('message', E_USER_DEPRECATED);
31+
$this->assertIsArray(error_get_last());
32+
}
2533
}

tests/end-to-end/event/_files/IgnoreDeprecationsTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010
namespace PHPUnit\TestFixture\Event;
1111

12+
use function error_get_last;
1213
use function trigger_error;
1314
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
1415
use PHPUnit\Framework\TestCase;
@@ -29,4 +30,19 @@ public function testTwo(): void
2930

3031
$this->assertTrue(true);
3132
}
33+
34+
#[IgnoreDeprecations]
35+
public function testOneErrorGetLast(): void
36+
{
37+
$this->assertNull(error_get_last());
38+
trigger_error('message', E_USER_DEPRECATED);
39+
$this->assertIsArray(error_get_last());
40+
}
41+
42+
public function testTwoErrorGetLast(): void
43+
{
44+
$this->assertNull(error_get_last());
45+
trigger_error('message', E_USER_DEPRECATED);
46+
$this->assertIsArray(error_get_last());
47+
}
3248
}

tests/end-to-end/event/_files/SuppressedUserNoticeTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010
namespace PHPUnit\TestFixture\Event;
1111

12+
use function error_get_last;
1213
use function trigger_error;
1314
use PHPUnit\Framework\TestCase;
1415

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

2122
@trigger_error('message', E_USER_NOTICE);
2223
}
24+
25+
public function testSuppressedUserNoticeErrorGetLast(): void
26+
{
27+
$this->assertNull(error_get_last());
28+
@trigger_error('message', E_USER_NOTICE);
29+
$this->assertIsArray(error_get_last());
30+
}
2331
}

tests/end-to-end/event/_files/SuppressedUserWarningTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010
namespace PHPUnit\TestFixture\Event;
1111

12+
use function error_get_last;
1213
use function trigger_error;
1314
use PHPUnit\Framework\TestCase;
1415

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

2122
@trigger_error('message', E_USER_WARNING);
2223
}
24+
25+
public function testSuppressedUserWarningErrorGetLast(): void
26+
{
27+
$this->assertNull(error_get_last());
28+
@trigger_error('message', E_USER_WARNING);
29+
$this->assertIsArray(error_get_last());
30+
}
2331
}

tests/end-to-end/event/_files/UserErrorTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,10 @@ public function testUserError(): void
2020

2121
trigger_error('message', E_USER_ERROR);
2222
}
23+
24+
public function testUserErrorMustAbortExecution(): void
25+
{
26+
trigger_error('message', E_USER_ERROR);
27+
$this->assertTrue(false);
28+
}
2329
}

tests/end-to-end/event/_files/UserNoticeTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010
namespace PHPUnit\TestFixture\Event;
1111

12+
use function error_get_last;
1213
use function trigger_error;
1314
use PHPUnit\Framework\TestCase;
1415

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

2122
trigger_error('message', E_USER_NOTICE);
2223
}
24+
25+
public function testUserNoticeErrorGetLast(): void
26+
{
27+
$this->assertNull(error_get_last());
28+
trigger_error('message', E_USER_NOTICE);
29+
$this->assertIsArray(error_get_last());
30+
}
2331
}

tests/end-to-end/event/_files/UserWarningTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010
namespace PHPUnit\TestFixture\Event;
1111

12+
use function error_get_last;
1213
use function trigger_error;
1314
use PHPUnit\Framework\TestCase;
1415

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

2122
trigger_error('message', E_USER_WARNING);
2223
}
24+
25+
public function testUserWarningErrorGetLast(): void
26+
{
27+
$this->assertNull(error_get_last());
28+
trigger_error('message', E_USER_WARNING);
29+
$this->assertIsArray(error_get_last());
30+
}
2331
}

tests/end-to-end/event/deprecations-can-be-ignored-using-attribute.phpt

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ unlink($traceFile);
2121
--EXPECTF--
2222
PHPUnit Started (PHPUnit %s using %s)
2323
Test Runner Configured
24-
Test Suite Loaded (2 tests)
24+
Test Suite Loaded (4 tests)
2525
Event Facade Sealed
2626
Test Runner Started
2727
Test Suite Sorted
28-
Test Runner Execution Started (2 tests)
29-
Test Suite Started (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest, 2 tests)
28+
Test Runner Execution Started (4 tests)
29+
Test Suite Started (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest, 4 tests)
3030
Test Preparation Started (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testOne)
3131
Test Prepared (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testOne)
3232
Test Triggered Test-Ignored Deprecation (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testOne)
@@ -41,7 +41,33 @@ message
4141
Assertion Succeeded (Constraint: is true, Value: true)
4242
Test Passed (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testTwo)
4343
Test Finished (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testTwo)
44-
Test Suite Finished (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest, 2 tests)
44+
Test Preparation Started (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testOneErrorGetLast)
45+
Test Prepared (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testOneErrorGetLast)
46+
Assertion Succeeded (Constraint: is null, Value: {enable export of objects to see this value})
47+
Test Triggered Test-Ignored Deprecation (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testOneErrorGetLast)
48+
message
49+
Assertion Succeeded (Constraint: is of type array, Value: Array &0 [
50+
'type' => 16384,
51+
'message' => 'message',
52+
'file' => '%s%e_files%eIgnoreDeprecationsTest.php',
53+
'line' => %d,
54+
])
55+
Test Passed (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testOneErrorGetLast)
56+
Test Finished (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testOneErrorGetLast)
57+
Test Preparation Started (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testTwoErrorGetLast)
58+
Test Prepared (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testTwoErrorGetLast)
59+
Assertion Succeeded (Constraint: is null, Value: {enable export of objects to see this value})
60+
Test Triggered Deprecation (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testTwoErrorGetLast)
61+
message
62+
Assertion Succeeded (Constraint: is of type array, Value: Array &0 [
63+
'type' => 16384,
64+
'message' => 'message',
65+
'file' => '%s%e_files%eIgnoreDeprecationsTest.php',
66+
'line' => %d,
67+
])
68+
Test Passed (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testTwoErrorGetLast)
69+
Test Finished (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testTwoErrorGetLast)
70+
Test Suite Finished (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest, 4 tests)
4571
Test Runner Execution Finished
4672
Test Runner Finished
4773
PHPUnit Finished (Shell Exit Code: 0)

tests/end-to-end/event/suppressed-user-notice.phpt

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,33 @@ unlink($traceFile);
2121
--EXPECTF--
2222
PHPUnit Started (PHPUnit %s using %s)
2323
Test Runner Configured
24-
Test Suite Loaded (1 test)
24+
Test Suite Loaded (2 tests)
2525
Event Facade Sealed
2626
Test Runner Started
2727
Test Suite Sorted
28-
Test Runner Execution Started (1 test)
29-
Test Suite Started (PHPUnit\TestFixture\Event\SuppressedUserNoticeTest, 1 test)
28+
Test Runner Execution Started (2 tests)
29+
Test Suite Started (PHPUnit\TestFixture\Event\SuppressedUserNoticeTest, 2 tests)
3030
Test Preparation Started (PHPUnit\TestFixture\Event\SuppressedUserNoticeTest::testSuppressedUserNotice)
3131
Test Prepared (PHPUnit\TestFixture\Event\SuppressedUserNoticeTest::testSuppressedUserNotice)
3232
Assertion Succeeded (Constraint: is true, Value: true)
3333
Test Triggered Suppressed Notice (PHPUnit\TestFixture\Event\SuppressedUserNoticeTest::testSuppressedUserNotice)
3434
message
3535
Test Passed (PHPUnit\TestFixture\Event\SuppressedUserNoticeTest::testSuppressedUserNotice)
3636
Test Finished (PHPUnit\TestFixture\Event\SuppressedUserNoticeTest::testSuppressedUserNotice)
37-
Test Suite Finished (PHPUnit\TestFixture\Event\SuppressedUserNoticeTest, 1 test)
37+
Test Preparation Started (PHPUnit\TestFixture\Event\SuppressedUserNoticeTest::testSuppressedUserNoticeErrorGetLast)
38+
Test Prepared (PHPUnit\TestFixture\Event\SuppressedUserNoticeTest::testSuppressedUserNoticeErrorGetLast)
39+
Assertion Succeeded (Constraint: is null, Value: {enable export of objects to see this value})
40+
Test Triggered Suppressed Notice (PHPUnit\TestFixture\Event\SuppressedUserNoticeTest::testSuppressedUserNoticeErrorGetLast)
41+
message
42+
Assertion Succeeded (Constraint: is of type array, Value: Array &0 [
43+
'type' => 1024,
44+
'message' => 'message',
45+
'file' => '%s%e_files%eSuppressedUserNoticeTest.php',
46+
'line' => %d,
47+
])
48+
Test Passed (PHPUnit\TestFixture\Event\SuppressedUserNoticeTest::testSuppressedUserNoticeErrorGetLast)
49+
Test Finished (PHPUnit\TestFixture\Event\SuppressedUserNoticeTest::testSuppressedUserNoticeErrorGetLast)
50+
Test Suite Finished (PHPUnit\TestFixture\Event\SuppressedUserNoticeTest, 2 tests)
3851
Test Runner Execution Finished
3952
Test Runner Finished
4053
PHPUnit Finished (Shell Exit Code: 0)

tests/end-to-end/event/suppressed-user-warning.phpt

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,33 @@ unlink($traceFile);
2121
--EXPECTF--
2222
PHPUnit Started (PHPUnit %s using %s)
2323
Test Runner Configured
24-
Test Suite Loaded (1 test)
24+
Test Suite Loaded (2 tests)
2525
Event Facade Sealed
2626
Test Runner Started
2727
Test Suite Sorted
28-
Test Runner Execution Started (1 test)
29-
Test Suite Started (PHPUnit\TestFixture\Event\SuppressedUserWarningTest, 1 test)
28+
Test Runner Execution Started (2 tests)
29+
Test Suite Started (PHPUnit\TestFixture\Event\SuppressedUserWarningTest, 2 tests)
3030
Test Preparation Started (PHPUnit\TestFixture\Event\SuppressedUserWarningTest::testSuppressedUserWarning)
3131
Test Prepared (PHPUnit\TestFixture\Event\SuppressedUserWarningTest::testSuppressedUserWarning)
3232
Assertion Succeeded (Constraint: is true, Value: true)
3333
Test Triggered Suppressed Warning (PHPUnit\TestFixture\Event\SuppressedUserWarningTest::testSuppressedUserWarning)
3434
message
3535
Test Passed (PHPUnit\TestFixture\Event\SuppressedUserWarningTest::testSuppressedUserWarning)
3636
Test Finished (PHPUnit\TestFixture\Event\SuppressedUserWarningTest::testSuppressedUserWarning)
37-
Test Suite Finished (PHPUnit\TestFixture\Event\SuppressedUserWarningTest, 1 test)
37+
Test Preparation Started (PHPUnit\TestFixture\Event\SuppressedUserWarningTest::testSuppressedUserWarningErrorGetLast)
38+
Test Prepared (PHPUnit\TestFixture\Event\SuppressedUserWarningTest::testSuppressedUserWarningErrorGetLast)
39+
Assertion Succeeded (Constraint: is null, Value: {enable export of objects to see this value})
40+
Test Triggered Suppressed Warning (PHPUnit\TestFixture\Event\SuppressedUserWarningTest::testSuppressedUserWarningErrorGetLast)
41+
message
42+
Assertion Succeeded (Constraint: is of type array, Value: Array &0 [
43+
'type' => 512,
44+
'message' => 'message',
45+
'file' => '%s%e_files%eSuppressedUserWarningTest.php',
46+
'line' => %d,
47+
])
48+
Test Passed (PHPUnit\TestFixture\Event\SuppressedUserWarningTest::testSuppressedUserWarningErrorGetLast)
49+
Test Finished (PHPUnit\TestFixture\Event\SuppressedUserWarningTest::testSuppressedUserWarningErrorGetLast)
50+
Test Suite Finished (PHPUnit\TestFixture\Event\SuppressedUserWarningTest, 2 tests)
3851
Test Runner Execution Finished
3952
Test Runner Finished
4053
PHPUnit Finished (Shell Exit Code: 0)

0 commit comments

Comments
 (0)