File: Fix-PHP-8-testing-code.patch

package info (click to toggle)
phing 3.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,548 kB
  • sloc: php: 59,817; xml: 9,767; sql: 78; makefile: 39; sh: 14
file content (38 lines) | stat: -rw-r--r-- 1,516 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
From: William Desportes <williamdes@wdes.fr>
Date: Sun, 13 Apr 2025 13:30:40 +0200
Subject: Fix PHP 8 testing code

Ref: https://github.com/sebastianbergmann/phpunit/issues/5062#issuecomment-1416362657
---
 .../Test/Task/System/Condition/HasFreeSpaceConditionTest.php | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/tests/Phing/Test/Task/System/Condition/HasFreeSpaceConditionTest.php b/tests/Phing/Test/Task/System/Condition/HasFreeSpaceConditionTest.php
index 831e11b..3156383 100644
--- a/tests/Phing/Test/Task/System/Condition/HasFreeSpaceConditionTest.php
+++ b/tests/Phing/Test/Task/System/Condition/HasFreeSpaceConditionTest.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Phing\Task\System\Condition;
 
 use Phing\Test\Support\BuildFileTest;
@@ -23,7 +25,15 @@ class HasFreeSpaceConditionTest extends BuildFileTest
 
     public function testInvalidPartition()
     {
-        $this->expectBuildExceptionContaining(__FUNCTION__, __FUNCTION__, 'disk_free_space(): No such file or directory');
+        $warning = '';
+        set_error_handler(static function (int $errno, string $errstr) use (&$warning): void {
+            $warning = $errstr;
+        }, E_WARNING);
+
+        $this->expectBuildExceptionContaining(__FUNCTION__, __FUNCTION__, 'Error while retrieving free space.');
+        $this->assertSame('disk_free_space(): No such file or directory', $warning);
+
+        restore_error_handler();
     }
 
     public function testEnoughSpace()