Skip to content

Commit 10ba2eb

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into 4.6
Conflicts: tests/system/Autoloader/AutoloaderTest.php tests/system/CommonFunctionsTest.php tests/system/Config/ServicesTest.php
2 parents 60341c3 + 9c99605 commit 10ba2eb

27 files changed

+63
-156
lines changed

admin/framework/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"kint-php/kint": "^5.0.4",
2424
"mikey179/vfsstream": "^1.6",
2525
"nexusphp/cs-config": "^3.6",
26-
"phpunit/phpunit": "^10.5.16",
26+
"phpunit/phpunit": "^10.5.16 || ^11.2",
2727
"predis/predis": "^1.1 || ^2.0"
2828
},
2929
"suggest": {

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
"phpstan/extension-installer": "^1.4",
2626
"phpstan/phpstan": "^1.11",
2727
"phpstan/phpstan-strict-rules": "^1.6",
28-
"phpunit/phpcov": "^9.0.2",
29-
"phpunit/phpunit": "^10.5.16",
28+
"phpunit/phpcov": "^9.0.2 || ^10.0",
29+
"phpunit/phpunit": "^10.5.16 || ^11.2",
3030
"predis/predis": "^1.1 || ^2.0",
3131
"rector/rector": "1.2.2"
3232
},

tests/system/Autoloader/AutoloaderTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
use PHPUnit\Framework\Attributes\Group;
2727
use PHPUnit\Framework\Attributes\PreserveGlobalState;
2828
use PHPUnit\Framework\Attributes\RunInSeparateProcess;
29+
use PHPUnit\Framework\Attributes\WithoutErrorHandler;
2930
use UnnamespacedClass;
3031

3132
/**
@@ -394,12 +395,9 @@ public function testAutoloaderLoadsNonClassFiles(): void
394395

395396
#[PreserveGlobalState(false)]
396397
#[RunInSeparateProcess]
398+
#[WithoutErrorHandler]
397399
public function testLoadHelpers(): void
398400
{
399-
// Workaround for errors on PHPUnit 10 and PHP 8.3.
400-
// See https://github.com/sebastianbergmann/phpunit/issues/5403#issuecomment-1906810619
401-
restore_error_handler();
402-
403401
$config = new Autoload();
404402
$config->helpers[] = 'form';
405403

tests/system/CodeIgniterTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
use PHPUnit\Framework\Attributes\DataProvider;
3434
use PHPUnit\Framework\Attributes\Group;
3535
use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;
36+
use PHPUnit\Framework\Attributes\WithoutErrorHandler;
3637
use Tests\Support\Filters\Customfilter;
3738
use Tests\Support\Filters\RedirectFilter;
3839

@@ -47,15 +48,12 @@ final class CodeIgniterTest extends CIUnitTestCase
4748
private CodeIgniter $codeigniter;
4849
protected $routes;
4950

51+
#[WithoutErrorHandler]
5052
protected function setUp(): void
5153
{
5254
parent::setUp();
5355
$this->resetServices();
5456

55-
// Workaround for errors on PHPUnit 10 and PHP 8.3.
56-
// See https://github.com/sebastianbergmann/phpunit/issues/5403#issuecomment-1906810619
57-
restore_error_handler();
58-
5957
$_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1';
6058

6159
$this->codeigniter = new MockCodeIgniter(new App());

tests/system/Commands/GenerateKeyTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use PHPUnit\Framework\Attributes\Group;
2020
use PHPUnit\Framework\Attributes\PreserveGlobalState;
2121
use PHPUnit\Framework\Attributes\RunInSeparateProcess;
22+
use PHPUnit\Framework\Attributes\WithoutErrorHandler;
2223

2324
/**
2425
* @internal
@@ -31,6 +32,7 @@ final class GenerateKeyTest extends CIUnitTestCase
3132
private string $envPath;
3233
private string $backupEnvPath;
3334

35+
#[WithoutErrorHandler]
3436
protected function setUp(): void
3537
{
3638
parent::setUp();
@@ -43,10 +45,6 @@ protected function setUp(): void
4345
}
4446

4547
$this->resetEnvironment();
46-
47-
// Workaround for errors on PHPUnit 10 and PHP 8.3.
48-
// See https://github.com/sebastianbergmann/phpunit/issues/5403#issuecomment-1906810619
49-
restore_error_handler();
5048
}
5149

5250
protected function tearDown(): void

tests/system/CommonFunctionsSendTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,20 @@
1717
use PHPUnit\Framework\Attributes\Group;
1818
use PHPUnit\Framework\Attributes\PreserveGlobalState;
1919
use PHPUnit\Framework\Attributes\RunInSeparateProcess;
20+
use PHPUnit\Framework\Attributes\WithoutErrorHandler;
2021

2122
/**
2223
* @internal
2324
*/
2425
#[Group('SeparateProcess')]
2526
final class CommonFunctionsSendTest extends CIUnitTestCase
2627
{
28+
#[WithoutErrorHandler]
2729
protected function setUp(): void
2830
{
2931
parent::setUp();
3032

3133
unset($_ENV['foo'], $_SERVER['foo']);
32-
33-
// Workaround for errors on PHPUnit 10 and PHP 8.3.
34-
// See https://github.com/sebastianbergmann/phpunit/issues/5403#issuecomment-1906810619
35-
restore_error_handler();
3634
}
3735

3836
/**

tests/system/CommonFunctionsTest.php

Lines changed: 10 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
use PHPUnit\Framework\Attributes\Group;
4848
use PHPUnit\Framework\Attributes\PreserveGlobalState;
4949
use PHPUnit\Framework\Attributes\RunInSeparateProcess;
50+
use PHPUnit\Framework\Attributes\WithoutErrorHandler;
5051
use stdClass;
5152
use Tests\Support\Models\JobModel;
5253

@@ -274,25 +275,19 @@ public function testEscapeRecursiveArrayRaw(): void
274275

275276
#[PreserveGlobalState(false)]
276277
#[RunInSeparateProcess]
278+
#[WithoutErrorHandler]
277279
public function testSessionInstance(): void
278280
{
279-
// Workaround for errors on PHPUnit 10 and PHP 8.3.
280-
// See https://github.com/sebastianbergmann/phpunit/issues/5403#issuecomment-1906810619
281-
restore_error_handler();
282-
283281
$this->injectSessionMock();
284282

285283
$this->assertInstanceOf(Session::class, session());
286284
}
287285

288286
#[PreserveGlobalState(false)]
289287
#[RunInSeparateProcess]
288+
#[WithoutErrorHandler]
290289
public function testSessionVariable(): void
291290
{
292-
// Workaround for errors on PHPUnit 10 and PHP 8.3.
293-
// See https://github.com/sebastianbergmann/phpunit/issues/5403#issuecomment-1906810619
294-
restore_error_handler();
295-
296291
$this->injectSessionMock();
297292

298293
$_SESSION['notbogus'] = 'Hi there';
@@ -302,12 +297,9 @@ public function testSessionVariable(): void
302297

303298
#[PreserveGlobalState(false)]
304299
#[RunInSeparateProcess]
300+
#[WithoutErrorHandler]
305301
public function testSessionVariableNotThere(): void
306302
{
307-
// Workaround for errors on PHPUnit 10 and PHP 8.3.
308-
// See https://github.com/sebastianbergmann/phpunit/issues/5403#issuecomment-1906810619
309-
restore_error_handler();
310-
311303
$this->injectSessionMock();
312304

313305
$_SESSION['bogus'] = 'Hi there';
@@ -428,12 +420,9 @@ public function testModelExistsAbsoluteClassname(): void
428420

429421
#[PreserveGlobalState(false)]
430422
#[RunInSeparateProcess]
423+
#[WithoutErrorHandler]
431424
public function testOldInput(): void
432425
{
433-
// Workaround for errors on PHPUnit 10 and PHP 8.3.
434-
// See https://github.com/sebastianbergmann/phpunit/issues/5403#issuecomment-1906810619
435-
restore_error_handler();
436-
437426
$this->injectSessionMock();
438427
// setup from RedirectResponseTest...
439428
$_SERVER['REQUEST_METHOD'] = 'GET';
@@ -465,12 +454,9 @@ public function testOldInput(): void
465454

466455
#[PreserveGlobalState(false)]
467456
#[RunInSeparateProcess]
457+
#[WithoutErrorHandler]
468458
public function testOldInputSerializeData(): void
469459
{
470-
// Workaround for errors on PHPUnit 10 and PHP 8.3.
471-
// See https://github.com/sebastianbergmann/phpunit/issues/5403#issuecomment-1906810619
472-
restore_error_handler();
473-
474460
$this->injectSessionMock();
475461
// setup from RedirectResponseTest...
476462
$_SERVER['REQUEST_METHOD'] = 'GET';
@@ -503,12 +489,9 @@ public function testOldInputSerializeData(): void
503489
*/
504490
#[PreserveGlobalState(false)]
505491
#[RunInSeparateProcess]
492+
#[WithoutErrorHandler]
506493
public function testOldInputArray(): void
507494
{
508-
// Workaround for errors on PHPUnit 10 and PHP 8.3.
509-
// See https://github.com/sebastianbergmann/phpunit/issues/5403#issuecomment-1906810619
510-
restore_error_handler();
511-
512495
$this->injectSessionMock();
513496
// setup from RedirectResponseTest...
514497
$_SERVER['REQUEST_METHOD'] = 'GET';
@@ -622,12 +605,9 @@ public function testRedirectResponseCookies1(): void
622605

623606
#[PreserveGlobalState(false)]
624607
#[RunInSeparateProcess]
608+
#[WithoutErrorHandler]
625609
public function testTrace(): void
626610
{
627-
// Workaround for errors on PHPUnit 10 and PHP 8.3.
628-
// See https://github.com/sebastianbergmann/phpunit/issues/5403#issuecomment-1906810619
629-
restore_error_handler();
630-
631611
ob_start();
632612
trace();
633613
$content = ob_get_clean();
@@ -647,12 +627,9 @@ public function testViewNotSaveData(): void
647627

648628
#[PreserveGlobalState(false)]
649629
#[RunInSeparateProcess]
630+
#[WithoutErrorHandler]
650631
public function testForceHttpsNullRequestAndResponse(): void
651632
{
652-
// Workaround for errors on PHPUnit 10 and PHP 8.3.
653-
// See https://github.com/sebastianbergmann/phpunit/issues/5403#issuecomment-1906810619
654-
restore_error_handler();
655-
656633
$this->assertNull(Services::response()->header('Location'));
657634

658635
Services::response()->setCookie('force', 'cookie');
@@ -763,12 +740,9 @@ public function testDWithCSP(): void
763740

764741
#[PreserveGlobalState(false)]
765742
#[RunInSeparateProcess]
743+
#[WithoutErrorHandler]
766744
public function testTraceWithCSP(): void
767745
{
768-
// Workaround for errors on PHPUnit 10 and PHP 8.3.
769-
// See https://github.com/sebastianbergmann/phpunit/issues/5403#issuecomment-1906810619
770-
restore_error_handler();
771-
772746
$this->resetServices();
773747

774748
/** @var App $config */
@@ -780,11 +754,6 @@ public function testTraceWithCSP(): void
780754

781755
Kint::$cli_detection = false;
782756

783-
// Workaround for errors on PHPUnit 10 and PHP 8.3.
784-
// See https://github.com/sebastianbergmann/phpunit/issues/5403#issuecomment-1906810619
785-
// `$app->initialize()` sets error handler.
786-
restore_error_handler();
787-
788757
$this->expectOutputRegex('/<style class="kint-rich-style" nonce="[0-9a-z]{24}">/u');
789758
trace();
790759
}

tests/system/Config/BaseConfigTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use PHPUnit\Framework\Attributes\Group;
2222
use PHPUnit\Framework\Attributes\PreserveGlobalState;
2323
use PHPUnit\Framework\Attributes\RunInSeparateProcess;
24+
use PHPUnit\Framework\Attributes\WithoutErrorHandler;
2425
use PHPUnit\Framework\MockObject\MockObject;
2526
use RegistrarConfig;
2627
use SimpleConfig;
@@ -35,6 +36,7 @@ final class BaseConfigTest extends CIUnitTestCase
3536
{
3637
private string $fixturesFolder;
3738

39+
#[WithoutErrorHandler]
3840
protected function setUp(): void
3941
{
4042
parent::setUp();
@@ -54,10 +56,6 @@ protected function setUp(): void
5456
}
5557

5658
BaseConfig::reset();
57-
58-
// Workaround for errors on PHPUnit 10 and PHP 8.3.
59-
// See https://github.com/sebastianbergmann/phpunit/issues/5403#issuecomment-1906810619
60-
restore_error_handler();
6159
}
6260

6361
protected function tearDown(): void

tests/system/Config/DotEnvTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use PHPUnit\Framework\Attributes\Group;
2222
use PHPUnit\Framework\Attributes\PreserveGlobalState;
2323
use PHPUnit\Framework\Attributes\RunInSeparateProcess;
24+
use PHPUnit\Framework\Attributes\WithoutErrorHandler;
2425
use TypeError;
2526

2627
/**
@@ -34,6 +35,7 @@ final class DotEnvTest extends CIUnitTestCase
3435
private string $path;
3536
private string $fixturesFolder;
3637

38+
#[WithoutErrorHandler]
3739
protected function setUp(): void
3840
{
3941
parent::setUp();
@@ -46,10 +48,6 @@ protected function setUp(): void
4648
$file = 'unreadable.env';
4749
$path = rtrim($this->fixturesFolder, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $file;
4850
chmod($path, 0644);
49-
50-
// Workaround for errors on PHPUnit 10 and PHP 8.3.
51-
// See https://github.com/sebastianbergmann/phpunit/issues/5403#issuecomment-1906810619
52-
restore_error_handler();
5351
}
5452

5553
protected function tearDown(): void

tests/system/Config/ServicesTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
use PHPUnit\Framework\Attributes\Group;
5555
use PHPUnit\Framework\Attributes\PreserveGlobalState;
5656
use PHPUnit\Framework\Attributes\RunInSeparateProcess;
57+
use PHPUnit\Framework\Attributes\WithoutErrorHandler;
5758
use Tests\Support\Config\Services;
5859

5960
/**
@@ -64,15 +65,12 @@ final class ServicesTest extends CIUnitTestCase
6465
{
6566
private array $original;
6667

68+
#[WithoutErrorHandler]
6769
protected function setUp(): void
6870
{
6971
parent::setUp();
7072

7173
$this->original = $_SERVER;
72-
73-
// Workaround for errors on PHPUnit 10 and PHP 8.3.
74-
// See https://github.com/sebastianbergmann/phpunit/issues/5403#issuecomment-1906810619
75-
restore_error_handler();
7674
}
7775

7876
protected function tearDown(): void

0 commit comments

Comments
 (0)