From: William Desportes <williamdes@wdes.fr>
Date: Sun, 13 Apr 2025 13:39:09 +0200
Subject: Update tests for newer PHPUnit versions

Origin: vendor
Forwarded: no
---
 .../Test/Io/AbstractWinFileSystemTestCase.php      | 34 +++++++++++--------
 tests/Phing/Test/Io/FileParserFactoryTest.php      |  3 +-
 tests/Phing/Test/Io/FileSystemTest.php             |  3 +-
 tests/Phing/Test/Io/FileUtilsTest.php              |  2 ++
 tests/Phing/Test/Io/IniFileParserTest.php          |  5 +--
 tests/Phing/Test/Listener/DefaultLoggerTest.php    |  7 +++-
 tests/Phing/Test/Listener/DisguiseLoggerTest.php   |  7 ++++
 tests/Phing/Test/Listener/MonologListenerTest.php  |  1 +
 tests/Phing/Test/Listener/SilentLoggerTest.php     |  2 ++
 .../Phing/Test/Listener/StatisticsListenerTest.php |  1 +
 .../Phing/Test/Listener/TimestampedLoggerTest.php  |  1 +
 tests/Phing/Test/Parser/LocationTest.php           |  6 ++--
 tests/Phing/Test/TargetTest.php                    |  6 ++--
 .../Phing/Test/Task/Ext/Svn/SvnRevertTaskTest.php  |  1 +
 .../Test/Task/Optional/WikiPublishTaskTest.php     | 36 ++++++++++++--------
 tests/Phing/Test/Task/System/FileSizeTaskTest.php  |  3 +-
 tests/Phing/Test/Task/System/MkdirTaskTest.php     | 14 ++++----
 tests/Phing/Test/Task/System/PropertyTaskTest.php  |  5 +--
 tests/Phing/Test/Task/System/VersionTaskTest.php   |  3 +-
 tests/Phing/Test/Type/DescriptionTest.php          |  5 +--
 .../Type/Selector/PosixPermissionsSelectorTest.php |  9 +++--
 tests/Phing/Test/Util/CharacterTest.php            |  5 +--
 tests/Phing/Test/Util/SizeHelperTest.php           | 12 ++++---
 tests/Phing/Test/Util/StringHelperTest.php         | 38 +++++++++++++++-------
 .../tasks/ext/phpunit/tests/provider_failTest.php  |  3 +-
 25 files changed, 143 insertions(+), 69 deletions(-)

diff --git a/tests/Phing/Test/Io/AbstractWinFileSystemTestCase.php b/tests/Phing/Test/Io/AbstractWinFileSystemTestCase.php
index e83f686..3898ecf 100644
--- a/tests/Phing/Test/Io/AbstractWinFileSystemTestCase.php
+++ b/tests/Phing/Test/Io/AbstractWinFileSystemTestCase.php
@@ -52,6 +52,7 @@ abstract class AbstractWinFileSystemTestCase extends TestCase
     /**
      * @dataProvider normaliseDataProvider
      */
+    #[\PHPUnit\Framework\Attributes\DataProvider('normaliseDataProvider')]
     public function testNormalise(string $expected, string $path): void
     {
         $normalisedPath = $this->fs->normalize($path);
@@ -59,7 +60,7 @@ abstract class AbstractWinFileSystemTestCase extends TestCase
         $this->assertSame($expected, $normalisedPath);
     }
 
-    public function normaliseDataProvider(): array
+    public static function normaliseDataProvider(): array
     {
         return [
             'alreadyNormal' => ['C:\\My Files\\file.txt', 'C:\\My Files\\file.txt'],
@@ -75,8 +76,9 @@ abstract class AbstractWinFileSystemTestCase extends TestCase
     }
 
     /**
-     * @dataProvider prefixLengthDataPRovider
+     * @dataProvider prefixLengthDataProvider
      */
+    #[\PHPUnit\Framework\Attributes\DataProvider('prefixLengthDataProvider')]
     public function testPrefixLength(int $expected, string $pathname): void
     {
         $length = $this->fs->prefixLength($pathname);
@@ -84,7 +86,7 @@ abstract class AbstractWinFileSystemTestCase extends TestCase
         $this->assertSame($expected, $length);
     }
 
-    public function prefixLengthDataProvider(): array
+    public static function prefixLengthDataProvider(): array
     {
         return [
             'absoluteLocal' => [3, 'D:\\My Files\\file.txt'],
@@ -101,6 +103,7 @@ abstract class AbstractWinFileSystemTestCase extends TestCase
     /**
      * @dataProvider resolveDataProvider
      */
+    #[\PHPUnit\Framework\Attributes\DataProvider('resolveDataProvider')]
     public function testResolve(string $expected, string $parent, string $child): void
     {
         $resolved = $this->fs->resolve($parent, $child);
@@ -108,7 +111,7 @@ abstract class AbstractWinFileSystemTestCase extends TestCase
         $this->assertSame($expected, $resolved);
     }
 
-    public function resolveDataProvider(): array
+    public static function resolveDataProvider(): array
     {
         return [
             'emptyParent' => ['My Files\\file.txt', '', 'My Files\\file.txt'],
@@ -123,18 +126,19 @@ abstract class AbstractWinFileSystemTestCase extends TestCase
     /**
      * @dataProvider resolveFileDataProvider
      */
-    public function testResolveFile(string $expected, string $path, string $prefix): void
+    #[\PHPUnit\Framework\Attributes\DataProvider('resolveFileDataProvider')]
+    public function testResolveFile(string $expected, string $path, int $prefix): void
     {
         $file = $this->getMockBuilder(File::class)->disableOriginalConstructor()->getMock();
-        $file->expects($this->any())->method('getPath')->will($this->returnValue($path));
-        $file->expects($this->any())->method('getPrefixLength')->will($this->returnValue($prefix));
+        $file->expects($this->any())->method('getPath')->willReturnMap([[$path]]);
+        $file->expects($this->any())->method('getPrefixLength')->willReturnMap([[$prefix]]);
 
         $resolved = $this->fs->resolveFile($file);
 
         $this->assertSame($expected, $resolved);
     }
 
-    public function resolveFileDataProvider(): array
+    public static function resolveFileDataProvider(): array
     {
         $cwd = getcwd();
         $driveLetter = '';
@@ -163,8 +167,8 @@ abstract class AbstractWinFileSystemTestCase extends TestCase
         $this->expectExceptionMessage('Unresolvable path: file.txt');
 
         $file = $this->getMockBuilder(File::class)->disableOriginalConstructor()->getMock();
-        $file->expects($this->any())->method('getPath')->will($this->returnValue('file.txt'));
-        $file->expects($this->any())->method('getPrefixLength')->will($this->returnValue(5));
+        $file->expects($this->any())->method('getPath')->willReturnMap([['file.txt']]);
+        $file->expects($this->any())->method('getPrefixLength')->willReturnMap([[5]]);
 
         $this->fs->resolveFile($file);
     }
@@ -179,6 +183,7 @@ abstract class AbstractWinFileSystemTestCase extends TestCase
     /**
      * @dataProvider fromURIPathDataProvider
      */
+    #[\PHPUnit\Framework\Attributes\DataProvider('fromURIPathDataProvider')]
     public function testFromURIPath(string $expected, string $path): void
     {
         $resultPath = $this->fs->fromURIPath($path);
@@ -186,7 +191,7 @@ abstract class AbstractWinFileSystemTestCase extends TestCase
         $this->assertSame($expected, $resultPath);
     }
 
-    public function fromURIPathDataProvider(): array
+    public static function fromURIPathDataProvider(): array
     {
         return [
             'singleLetter' => ['f', 'f'],
@@ -200,18 +205,19 @@ abstract class AbstractWinFileSystemTestCase extends TestCase
     /**
      * @dataProvider isAbsoluteDataProvider
      */
+    #[\PHPUnit\Framework\Attributes\DataProvider('isAbsoluteDataProvider')]
     public function testIsAbsolute(bool $expected, string $path, int $prefix): void
     {
         $file = $this->getMockBuilder(File::class)->disableOriginalConstructor()->getMock();
-        $file->expects($this->any())->method('getPath')->will($this->returnValue($path));
-        $file->expects($this->any())->method('getPrefixLength')->will($this->returnValue($prefix));
+        $file->expects($this->any())->method('getPath')->willReturnMap([[$path]]);
+        $file->expects($this->any())->method('getPrefixLength')->willReturnMap([[$prefix]]);
 
         $is = $this->fs->isAbsolute($file);
 
         $this->assertSame($expected, $is);
     }
 
-    public function isAbsoluteDataProvider(): array
+    public static function isAbsoluteDataProvider(): array
     {
         return [
             // Doesn't work for my current version of phpunit
diff --git a/tests/Phing/Test/Io/FileParserFactoryTest.php b/tests/Phing/Test/Io/FileParserFactoryTest.php
index d2a543c..9a46164 100644
--- a/tests/Phing/Test/Io/FileParserFactoryTest.php
+++ b/tests/Phing/Test/Io/FileParserFactoryTest.php
@@ -62,12 +62,13 @@ class FileParserFactoryTest extends TestCase
      * @param mixed $parserName
      * @param mixed $expectedType
      */
+    #[\PHPUnit\Framework\Attributes\DataProvider('parserTypeProvider')]
     public function testCreateParser($parserName, $expectedType): void
     {
         $this->assertInstanceOf($expectedType, $this->objectToTest->createParser($parserName));
     }
 
-    public function parserTypeProvider(): array
+    public static function parserTypeProvider(): array
     {
         return [
             ['properties', IniFileParser::class],
diff --git a/tests/Phing/Test/Io/FileSystemTest.php b/tests/Phing/Test/Io/FileSystemTest.php
index 5f9cf84..ced70e7 100644
--- a/tests/Phing/Test/Io/FileSystemTest.php
+++ b/tests/Phing/Test/Io/FileSystemTest.php
@@ -68,6 +68,7 @@ class FileSystemTest extends TestCase
      *
      * @throws IOException
      */
+    #[\PHPUnit\Framework\Attributes\DataProvider('fileSystemMappingsDataProvider')]
     public function testGetFileSystemReturnsCorrect($expectedFileSystemClass, $fsTypeKey): void
     {
         $this->resetFileSystem();
@@ -79,7 +80,7 @@ class FileSystemTest extends TestCase
         $this->assertInstanceOf($expectedFileSystemClass, $system);
     }
 
-    public function fileSystemMappingsDataProvider(): array
+    public static function fileSystemMappingsDataProvider(): array
     {
         return [
             [UnixFileSystem::class, 'UNIX'],
diff --git a/tests/Phing/Test/Io/FileUtilsTest.php b/tests/Phing/Test/Io/FileUtilsTest.php
index f99f649..f9c2758 100644
--- a/tests/Phing/Test/Io/FileUtilsTest.php
+++ b/tests/Phing/Test/Io/FileUtilsTest.php
@@ -51,6 +51,7 @@ class FileUtilsTest extends BuildFileTest
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function contentEquals(): void
     {
         $this->assertFalse($this->fu->contentEquals(new File(__FILE__), new File('does_not_exists')));
@@ -64,6 +65,7 @@ class FileUtilsTest extends BuildFileTest
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function copyFile(): void
     {
         $this->fu->copyFile(new File(__FILE__), new File('tmp/test.php'), $this->getProject());
diff --git a/tests/Phing/Test/Io/IniFileParserTest.php b/tests/Phing/Test/Io/IniFileParserTest.php
index b5a05cb..d9e5bb0 100644
--- a/tests/Phing/Test/Io/IniFileParserTest.php
+++ b/tests/Phing/Test/Io/IniFileParserTest.php
@@ -43,7 +43,7 @@ class IniFileParserTest extends TestCase
     }
 
     /**
-     * @dataProvider provideIniFiles
+     * @dataProvider provideIniFilesProvider
      * @covers       \IniFileParser::inVal
      * @covers       \IniFileParser::parseFile
      *
@@ -53,6 +53,7 @@ class IniFileParserTest extends TestCase
      * @throws IOException
      * @throws IOException
      */
+    #[\PHPUnit\Framework\Attributes\DataProvider('provideIniFilesProvider')]
     public function testParseFile($data, $expected): void
     {
         $file = $this->root->url() . '/test';
@@ -74,7 +75,7 @@ class IniFileParserTest extends TestCase
         $this->parser->parseFile($phingFile);
     }
 
-    public function provideIniFiles(): array
+    public static function provideIniFilesProvider(): array
     {
         return [
             [
diff --git a/tests/Phing/Test/Listener/DefaultLoggerTest.php b/tests/Phing/Test/Listener/DefaultLoggerTest.php
index ed65a76..53903c5 100644
--- a/tests/Phing/Test/Listener/DefaultLoggerTest.php
+++ b/tests/Phing/Test/Listener/DefaultLoggerTest.php
@@ -38,6 +38,7 @@ class DefaultLoggerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function throwableMessageOne(): void
     {
         $be = new BuildException('oops', new Location('build.xml', 1, 0));
@@ -47,6 +48,7 @@ class DefaultLoggerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function throwableMessageTwo(): void
     {
         $be = new BuildException('oops', new Location('build.xml', 1, 0));
@@ -61,6 +63,7 @@ class DefaultLoggerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function throwableMessageThree(): void
     {
         $be = new BuildException('oops', new Location('build.xml', 1, 0));
@@ -77,6 +80,7 @@ class DefaultLoggerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function buildFinished(): void
     {
         $event = new BuildEvent(new Project());
@@ -101,13 +105,14 @@ class DefaultLoggerTest extends TestCase
      *
      * @param mixed $seconds
      */
+    #[\PHPUnit\Framework\Attributes\DataProvider('formatTimeProvider')]
     public function testFormatTime($seconds, string $expectedText): void
     {
         $formattedText = DefaultLogger::formatTime($seconds);
         $this->assertSame($formattedText, $expectedText);
     }
 
-    public function formatTimeProvider(): array
+    public static function formatTimeProvider(): array
     {
         return [
             [0.0005, '0.0005 seconds'],
diff --git a/tests/Phing/Test/Listener/DisguiseLoggerTest.php b/tests/Phing/Test/Listener/DisguiseLoggerTest.php
index 80c23f9..b5f0eb1 100644
--- a/tests/Phing/Test/Listener/DisguiseLoggerTest.php
+++ b/tests/Phing/Test/Listener/DisguiseLoggerTest.php
@@ -22,6 +22,7 @@ class DisguiseLoggerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function maskOutput()
     {
         $event = new BuildEvent(new Project());
@@ -32,6 +33,7 @@ class DisguiseLoggerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function buildStarted()
     {
         $event = new BuildEvent(new Project());
@@ -42,6 +44,7 @@ class DisguiseLoggerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function buildFinished()
     {
         $event = new BuildEvent(new Project());
@@ -52,6 +55,7 @@ class DisguiseLoggerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function targetStarted()
     {
         $event = new BuildEvent(new Project());
@@ -62,6 +66,7 @@ class DisguiseLoggerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function targetFinished()
     {
         $event = new BuildEvent(new Project());
@@ -72,6 +77,7 @@ class DisguiseLoggerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function taskStarted()
     {
         $event = new BuildEvent(new Project());
@@ -82,6 +88,7 @@ class DisguiseLoggerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function taskFinished()
     {
         $event = new BuildEvent(new Project());
diff --git a/tests/Phing/Test/Listener/MonologListenerTest.php b/tests/Phing/Test/Listener/MonologListenerTest.php
index 5fef7a8..1033fd8 100644
--- a/tests/Phing/Test/Listener/MonologListenerTest.php
+++ b/tests/Phing/Test/Listener/MonologListenerTest.php
@@ -33,6 +33,7 @@ class MonologListenerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function buildStarted(): void
     {
         $listener = new MonologListener();
diff --git a/tests/Phing/Test/Listener/SilentLoggerTest.php b/tests/Phing/Test/Listener/SilentLoggerTest.php
index a52c841..47125c6 100644
--- a/tests/Phing/Test/Listener/SilentLoggerTest.php
+++ b/tests/Phing/Test/Listener/SilentLoggerTest.php
@@ -35,6 +35,7 @@ class SilentLoggerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function buildFinished(): void
     {
         $event = new BuildEvent(new Project());
@@ -46,6 +47,7 @@ class SilentLoggerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function buildFinishedException(): void
     {
         $event = new BuildEvent(new Project());
diff --git a/tests/Phing/Test/Listener/StatisticsListenerTest.php b/tests/Phing/Test/Listener/StatisticsListenerTest.php
index 1ad9f93..b46bd14 100644
--- a/tests/Phing/Test/Listener/StatisticsListenerTest.php
+++ b/tests/Phing/Test/Listener/StatisticsListenerTest.php
@@ -33,6 +33,7 @@ class StatisticsListenerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function buildFinished(): void
     {
         $event = new BuildEvent(new Project());
diff --git a/tests/Phing/Test/Listener/TimestampedLoggerTest.php b/tests/Phing/Test/Listener/TimestampedLoggerTest.php
index ea99f25..cf091e5 100644
--- a/tests/Phing/Test/Listener/TimestampedLoggerTest.php
+++ b/tests/Phing/Test/Listener/TimestampedLoggerTest.php
@@ -34,6 +34,7 @@ class TimestampedLoggerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function buildFinished(): void
     {
         $event = new BuildEvent(new Project());
diff --git a/tests/Phing/Test/Parser/LocationTest.php b/tests/Phing/Test/Parser/LocationTest.php
index 227e821..131b5f0 100644
--- a/tests/Phing/Test/Parser/LocationTest.php
+++ b/tests/Phing/Test/Parser/LocationTest.php
@@ -30,19 +30,21 @@ class LocationTest extends TestCase
 {
     /**
      * @test
-     * @dataProvider locations
+     * @dataProvider locationsProvider
      *
      * @param mixed $fileName
      * @param mixed $lineNumber
      * @param mixed $columnNumber
      */
+    #[\PHPUnit\Framework\Attributes\DataProvider('locationsProvider')]
+    #[\PHPUnit\Framework\Attributes\Test]
     public function location($fileName, $lineNumber, $columnNumber): void
     {
         $loc = new Location($fileName, $lineNumber, $columnNumber);
         $this->assertSame(sprintf('%s:%s:%s', $fileName, $lineNumber, $columnNumber), (string) $loc);
     }
 
-    public function locations(): array
+    public static function locationsProvider(): array
     {
         return [
             'normal' => ['test.php', 10, 20],
diff --git a/tests/Phing/Test/TargetTest.php b/tests/Phing/Test/TargetTest.php
index af4c51f..51c6cef 100644
--- a/tests/Phing/Test/TargetTest.php
+++ b/tests/Phing/Test/TargetTest.php
@@ -67,6 +67,7 @@ class TargetTest extends BuildFileTest
     /**
      * @dataProvider setDependsValidDataProvider
      */
+    #[\PHPUnit\Framework\Attributes\DataProvider('setDependsValidDataProvider')]
     public function testSetDependsValid(array $expectedDepends, string $depends): void
     {
         $this->target->setDepends($depends);
@@ -74,7 +75,7 @@ class TargetTest extends BuildFileTest
         $this->assertEquals($expectedDepends, $this->target->getDependencies());
     }
 
-    public function setDependsValidDataProvider(): array
+    public static function setDependsValidDataProvider(): array
     {
         return [
             [['target1'], 'target1'],
@@ -85,6 +86,7 @@ class TargetTest extends BuildFileTest
     /**
      * @dataProvider setDependsInvalidDataProvider
      */
+    #[\PHPUnit\Framework\Attributes\DataProvider('setDependsInvalidDataProvider')]
     public function testSetDependsInvalid(string $depends): void
     {
         $this->expectException(BuildException::class);
@@ -93,7 +95,7 @@ class TargetTest extends BuildFileTest
         $this->target->setDepends($depends);
     }
 
-    public function setDependsInvalidDataProvider(): array
+    public static function setDependsInvalidDataProvider(): array
     {
         return [
             [''],
diff --git a/tests/Phing/Test/Task/Ext/Svn/SvnRevertTaskTest.php b/tests/Phing/Test/Task/Ext/Svn/SvnRevertTaskTest.php
index 5bf7ebb..0d31bdc 100644
--- a/tests/Phing/Test/Task/Ext/Svn/SvnRevertTaskTest.php
+++ b/tests/Phing/Test/Task/Ext/Svn/SvnRevertTaskTest.php
@@ -38,6 +38,7 @@ class SvnRevertTaskTest extends AbstractSvnTaskTest
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function recursiveRevert(): void
     {
         $repository = PHING_TEST_BASE . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . 'svn';
diff --git a/tests/Phing/Test/Task/Optional/WikiPublishTaskTest.php b/tests/Phing/Test/Task/Optional/WikiPublishTaskTest.php
index 1cafb88..7cc4f6e 100644
--- a/tests/Phing/Test/Task/Optional/WikiPublishTaskTest.php
+++ b/tests/Phing/Test/Task/Optional/WikiPublishTaskTest.php
@@ -46,20 +46,30 @@ class WikiPublishTaskTest extends BuildFileTest
         $task->setContent('some content');
         $task->setMode('prepend');
 
-        $task->expects($this->exactly(4))
+        $callParams = [
+            ['action=login', ['lgname' => 'testUser', 'lgpassword' => 'testPassword']],
+            ['action=login', ['lgname' => 'testUser', 'lgpassword' => 'testPassword', 'lgtoken' => 'testLgToken']],
+            ['action=tokens&type=edit'],
+            ['action=edit&token=testEditToken%2B%2F', ['minor' => '', 'title' => 'some page', 'prependtext' => 'some content']]
+        ];
+        $returnResults = [
+            ['login' => ['result' => 'NeedToken', 'token' => 'testLgToken']],
+            ['login' => ['result' => 'Success']],
+            ['tokens' => ['edittoken' => 'testEditToken+/']],
+            ['edit' => ['result' => 'Success']]
+        ];
+
+        $task->expects($this->exactly(count($callParams)))
             ->method('callApi')
-            ->withConsecutive(
-                ['action=login', ['lgname' => 'testUser', 'lgpassword' => 'testPassword']],
-                ['action=login', ['lgname' => 'testUser', 'lgpassword' => 'testPassword', 'lgtoken' => 'testLgToken']],
-                ['action=tokens&type=edit'],
-                ['action=edit&token=testEditToken%2B%2F', ['minor' => '', 'title' => 'some page', 'prependtext' => 'some content']]
-            )
-            ->willReturnOnConsecutiveCalls(
-                ['login' => ['result' => 'NeedToken', 'token' => 'testLgToken']],
-                ['login' => ['result' => 'Success']],
-                ['tokens' => ['edittoken' => 'testEditToken+/']],
-                ['edit' => ['result' => 'Success']]
-            )
+            ->willReturnCallback(function (string $action, array|null $args) use ($callParams, $returnResults): array {
+                $index = array_find_key($callParams, function (array $value) use ($action, $args): bool {
+                   return $value[0] === $action && ($value[1] ?? null) === $args;
+                });
+                if (isset($callParams[$index])) {
+                    $this->assertSame($callParams[$index][1] ?? null, $args);
+                    return $returnResults[$index];
+                }
+            })
         ;
 
         $task->main();
diff --git a/tests/Phing/Test/Task/System/FileSizeTaskTest.php b/tests/Phing/Test/Task/System/FileSizeTaskTest.php
index 8a0dfcc..4fea702 100644
--- a/tests/Phing/Test/Task/System/FileSizeTaskTest.php
+++ b/tests/Phing/Test/Task/System/FileSizeTaskTest.php
@@ -51,6 +51,7 @@ class FileSizeTaskTest extends BuildFileTest
      * @param mixed $logInfo
      * @param mixed $expectedSize
      */
+    #[\PHPUnit\Framework\Attributes\DataProvider('unitAttributeProvider')]
     public function testUnitAttribute($dummySize, $filesizeUnit, $logVerbose, $logInfo, $expectedSize): void
     {
         $this->getProject()->setProperty('dummy.size', $dummySize);
@@ -61,7 +62,7 @@ class FileSizeTaskTest extends BuildFileTest
         $this->assertPropertyEquals('filesize', $expectedSize);
     }
 
-    public function unitAttributeProvider(): array
+    public static function unitAttributeProvider(): array
     {
         return [
             ['1K', 'b', '1024B', '1024B', 1024],
diff --git a/tests/Phing/Test/Task/System/MkdirTaskTest.php b/tests/Phing/Test/Task/System/MkdirTaskTest.php
index f65eda4..0b48e8a 100644
--- a/tests/Phing/Test/Task/System/MkdirTaskTest.php
+++ b/tests/Phing/Test/Task/System/MkdirTaskTest.php
@@ -54,6 +54,7 @@ class MkdirTaskTest extends BuildFileTest
      * @param mixed $umask
      * @param mixed $expectedDirMode
      */
+    #[\PHPUnit\Framework\Attributes\DataProvider('umaskIsHonouredWhenNotUsingModeArgumentDataProvider')]
     public function testUmaskIsHonouredWhenNotUsingModeArgument($umask, $expectedDirMode): void
     {
         if (0 !== $umask) {
@@ -65,7 +66,7 @@ class MkdirTaskTest extends BuildFileTest
         $this->assertFileModeIs(PHING_TEST_BASE . '/etc/tasks/system/tmp/a', $expectedDirMode);
     }
 
-    public function umaskIsHonouredWhenNotUsingModeArgumentDataProvider(): array
+    public static function umaskIsHonouredWhenNotUsingModeArgumentDataProvider(): array
     {
         return [
             [0000, 0777],
@@ -88,6 +89,7 @@ class MkdirTaskTest extends BuildFileTest
      * @param mixed $expectedModeA
      * @param mixed $expectedModeB
      */
+    #[\PHPUnit\Framework\Attributes\DataProvider('parentDirectoriesHaveDefaultPermissionsDataProvider')]
     public function testParentDirectoriesHaveDefaultPermissions($umask, $expectedModeA, $expectedModeB): void
     {
         if (0 !== $umask) {
@@ -100,18 +102,18 @@ class MkdirTaskTest extends BuildFileTest
         $this->assertFileModeIs(PHING_TEST_BASE . '/etc/tasks/system/tmp/a/b', $expectedModeB);
     }
 
-    public function parentDirectoriesHaveDefaultPermissionsDataProvider(): array
+    public static function parentDirectoriesHaveDefaultPermissionsDataProvider(): array
     {
         return [
             [
                 'umask' => 0000,
-                'expectedPermissionsOfA' => 0777,
-                'expectedPermissionsOfB' => 0555,
+                'expectedModeA' => 0777,
+                'expectedModeB' => 0555,
             ],
             [
                 'umask' => 0077,
-                'expectedPermissionsOfA' => 0700,
-                'expectedPermissionsOfB' => 0555,
+                'expectedModeA' => 0700,
+                'expectedModeB' => 0555,
             ],
         ];
     }
diff --git a/tests/Phing/Test/Task/System/PropertyTaskTest.php b/tests/Phing/Test/Task/System/PropertyTaskTest.php
index 3b924e5..b277366 100644
--- a/tests/Phing/Test/Task/System/PropertyTaskTest.php
+++ b/tests/Phing/Test/Task/System/PropertyTaskTest.php
@@ -85,7 +85,7 @@ class PropertyTaskTest extends BuildFileTest
         $this->assertEquals('World', $this->project->getProperty('filterchain.test'));
     }
 
-    public function circularDefinitionTargets(): array
+    public static function circularDefinitionTargetsProvider(): array
     {
         return [
             ['test3'],
@@ -95,10 +95,11 @@ class PropertyTaskTest extends BuildFileTest
     }
 
     /**
-     * @dataProvider circularDefinitionTargets
+     * @dataProvider circularDefinitionTargetsProvider
      *
      * @param mixed $target
      */
+    #[\PHPUnit\Framework\Attributes\DataProvider('circularDefinitionTargetsProvider')]
     public function testCircularDefinitionDetection($target): void
     {
         $this->expectException(BuildException::class);
diff --git a/tests/Phing/Test/Task/System/VersionTaskTest.php b/tests/Phing/Test/Task/System/VersionTaskTest.php
index dd6f882..05322aa 100644
--- a/tests/Phing/Test/Task/System/VersionTaskTest.php
+++ b/tests/Phing/Test/Task/System/VersionTaskTest.php
@@ -103,6 +103,7 @@ class VersionTaskTest extends BuildFileTest
      * @throws ReflectionException
      * @throws ReflectionException
      */
+    #[\PHPUnit\Framework\Attributes\DataProvider('versionProvider')]
     public function testGetVersionMethod($releaseType, $version, $expectedVersion): void
     {
         $versionTask = new VersionTask();
@@ -116,7 +117,7 @@ class VersionTaskTest extends BuildFileTest
         $this->assertSame($expectedVersion, $newVersion);
     }
 
-    public function versionProvider(): array
+    public static function versionProvider(): array
     {
         return [
             [VersionTask::RELEASETYPE_MAJOR, null, '1.0.0'],
diff --git a/tests/Phing/Test/Type/DescriptionTest.php b/tests/Phing/Test/Type/DescriptionTest.php
index e1b6ef2..82157fa 100644
--- a/tests/Phing/Test/Type/DescriptionTest.php
+++ b/tests/Phing/Test/Type/DescriptionTest.php
@@ -28,18 +28,19 @@ class DescriptionTest extends BuildFileTest
     /**
      * Test that the aaddText method appends text to description w/o any spaces.
      *
-     * @dataProvider getFiles
+     * @dataProvider getFilesProvider
      *
      * @param mixed $fileName
      * @param mixed $outcome
      */
+    #[\PHPUnit\Framework\Attributes\DataProvider('getFilesProvider')]
     public function test($fileName, $outcome): void
     {
         $this->configureProject(PHING_TEST_BASE . "/etc/types/{$fileName}.xml");
         $this->assertEquals($outcome, $this->getProject()->getDescription());
     }
 
-    public function getFiles(): array
+    public static function getFilesProvider(): array
     {
         return [
             'Single' => ['description1', 'Test Project Description'],
diff --git a/tests/Phing/Test/Type/Selector/PosixPermissionsSelectorTest.php b/tests/Phing/Test/Type/Selector/PosixPermissionsSelectorTest.php
index ec80c89..3d7b6d5 100644
--- a/tests/Phing/Test/Type/Selector/PosixPermissionsSelectorTest.php
+++ b/tests/Phing/Test/Type/Selector/PosixPermissionsSelectorTest.php
@@ -54,6 +54,7 @@ class PosixPermissionsSelectorTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function argumentRequired(): void
     {
         $this->expectException(BuildException::class);
@@ -65,6 +66,7 @@ class PosixPermissionsSelectorTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function isSelected(): void
     {
         $this->selector->setPermissions('rw-rw-r--');
@@ -85,6 +87,9 @@ class PosixPermissionsSelectorTest extends TestCase
      *
      * @param bool $throws
      */
+    #[\PHPUnit\Framework\Attributes\DataProvider('illegalArgumentProvider')]
+    #[\PHPUnit\Framework\Attributes\DataProvider('legalArgumentProvider')]
+    #[\PHPUnit\Framework\Attributes\Test]
     public function argument(string $permission, $throws = false): void
     {
         if ($throws) {
@@ -96,7 +101,7 @@ class PosixPermissionsSelectorTest extends TestCase
         $this->selector->setPermissions($permission);
     }
 
-    public function legalArgumentProvider(): array
+    public static function legalArgumentProvider(): array
     {
         return [
             'legal octal string' => ['750'],
@@ -104,7 +109,7 @@ class PosixPermissionsSelectorTest extends TestCase
         ];
     }
 
-    public function illegalArgumentProvider(): array
+    public static function illegalArgumentProvider(): array
     {
         return [
             ['855', true],
diff --git a/tests/Phing/Test/Util/CharacterTest.php b/tests/Phing/Test/Util/CharacterTest.php
index 332408c..bd6c90a 100644
--- a/tests/Phing/Test/Util/CharacterTest.php
+++ b/tests/Phing/Test/Util/CharacterTest.php
@@ -46,16 +46,17 @@ class CharacterTest extends TestCase
     }
 
     /**
-     * @dataProvider getChars
+     * @dataProvider getCharsProvider
      *
      * @param mixed $elem
      */
+    #[\PHPUnit\Framework\Attributes\DataProvider('getCharsProvider')]
     public function testIsChar($elem, bool $expected): void
     {
         $this->assertSame($this->char::isLetter($elem), $expected);
     }
 
-    public function getChars(): array
+    public static function getCharsProvider(): array
     {
         return [
             'more than 2' => ['as', false],
diff --git a/tests/Phing/Test/Util/SizeHelperTest.php b/tests/Phing/Test/Util/SizeHelperTest.php
index bb788d5..f01b758 100644
--- a/tests/Phing/Test/Util/SizeHelperTest.php
+++ b/tests/Phing/Test/Util/SizeHelperTest.php
@@ -34,13 +34,14 @@ class SizeHelperTest extends TestCase
      *
      * @param mixed $expectedBytes
      */
+    #[\PHPUnit\Framework\Attributes\DataProvider('fromHumanToBytesProvider')]
     public function testFromHumanToBytes(string $humanSize, $expectedBytes): void
     {
         $bytes = SizeHelper::fromHumanToBytes($humanSize);
         $this->assertSame($expectedBytes, $bytes);
     }
 
-    public function fromHumanToBytesProvider(): array
+    public static function fromHumanToBytesProvider(): array
     {
         return [
             ['1024', 1024.0],
@@ -89,6 +90,7 @@ class SizeHelperTest extends TestCase
     /**
      * @dataProvider invalidFromHumanToBytesProvider
      */
+    #[\PHPUnit\Framework\Attributes\DataProvider('invalidFromHumanToBytesProvider')]
     public function testInvalidFromHumanToBytes(string $human, string $message): void
     {
         $this->expectException(BuildException::class);
@@ -96,7 +98,7 @@ class SizeHelperTest extends TestCase
         SizeHelper::fromHumanToBytes($human);
     }
 
-    public function invalidFromHumanToBytesProvider(): array
+    public static function invalidFromHumanToBytesProvider(): array
     {
         return [
             ['', "Invalid size ''"],
@@ -115,13 +117,14 @@ class SizeHelperTest extends TestCase
     /**
      * @dataProvider fromBytesToProvider
      */
+    #[\PHPUnit\Framework\Attributes\DataProvider('fromBytesToProvider')]
     public function testFromBytesTo(int $bytes, string $unit, float $expected): void
     {
         $converted = SizeHelper::fromBytesTo($bytes, $unit);
         $this->assertSame($expected, $converted);
     }
 
-    public function fromBytesToProvider(): array
+    public static function fromBytesToProvider(): array
     {
         return [
             [1024, 'B', 1024],
@@ -164,6 +167,7 @@ class SizeHelperTest extends TestCase
     /**
      * @dataProvider invalidFromBytesToProvider
      */
+    #[\PHPUnit\Framework\Attributes\DataProvider('invalidFromBytesToProvider')]
     public function testInvalidFromBytesTo(string $unit, string $message): void
     {
         $this->expectException(BuildException::class);
@@ -171,7 +175,7 @@ class SizeHelperTest extends TestCase
         SizeHelper::fromBytesTo(1024, $unit);
     }
 
-    public function invalidFromBytesToProvider(): array
+    public static function invalidFromBytesToProvider(): array
     {
         return [
             ['', "Invalid unit ''"],
diff --git a/tests/Phing/Test/Util/StringHelperTest.php b/tests/Phing/Test/Util/StringHelperTest.php
index 54100ea..089126d 100644
--- a/tests/Phing/Test/Util/StringHelperTest.php
+++ b/tests/Phing/Test/Util/StringHelperTest.php
@@ -18,6 +18,7 @@ class StringHelperTest extends TestCase
      * @param mixed $candidate
      * @param mixed $expected
      */
+    #[\PHPUnit\Framework\Attributes\DataProvider('booleanValueProvider')]
     public function testBooleanValue($candidate, $expected)
     {
         $result = StringHelper::booleanValue($candidate);
@@ -25,7 +26,7 @@ class StringHelperTest extends TestCase
         $this->assertSame($expected, $result);
     }
 
-    public function booleanValueProvider(): array
+    public static function booleanValueProvider(): array
     {
         return [
             // True values
@@ -81,6 +82,7 @@ class StringHelperTest extends TestCase
      * @param string $candidate
      * @param bool   $expected
      */
+    #[\PHPUnit\Framework\Attributes\DataProvider('isBooleanProvider')]
     public function testIsBoolean($candidate, $expected)
     {
         $result = StringHelper::isBoolean($candidate);
@@ -88,7 +90,7 @@ class StringHelperTest extends TestCase
         $this->assertSame($expected, $result);
     }
 
-    public function isBooleanProvider()
+    public static function isBooleanProvider(): array
     {
         return [
             // Boolean values
@@ -146,13 +148,14 @@ class StringHelperTest extends TestCase
      * @param mixed $haystack
      * @param mixed $expected
      */
+    #[\PHPUnit\Framework\Attributes\DataProvider('startsWithProvider')]
     public function testStartsWith($needle, $haystack, $expected)
     {
         $result = StringHelper::startsWith($needle, $haystack);
         $this->assertSame($expected, $result);
     }
 
-    public function startsWithProvider()
+    public static function startsWithProvider(): array
     {
         return [
             // True
@@ -180,13 +183,14 @@ class StringHelperTest extends TestCase
      * @param mixed $haystack
      * @param mixed $expected
      */
+    #[\PHPUnit\Framework\Attributes\DataProvider('endsWithProvider')]
     public function testEndsWith($needle = 'o', $haystack = 'foo', $expected = true)
     {
         $result = StringHelper::endsWith($needle, $haystack);
         $this->assertSame($expected, $result);
     }
 
-    public function endsWithProvider()
+    public static function endsWithProvider(): array
     {
         return [
             // True
@@ -224,13 +228,14 @@ class StringHelperTest extends TestCase
      * @param mixed $end
      * @param mixed $expected
      */
+    #[\PHPUnit\Framework\Attributes\DataProvider('substringProvider')]
     public function testSubstring($string, $start, $end, $expected)
     {
         $result = StringHelper::substring($string, $start, $end);
         $this->assertSame($expected, $result);
     }
 
-    public function substringProvider()
+    public static function substringProvider(): array
     {
         return [
             ['FooBarBaz', 0, 0, 'F'],
@@ -255,19 +260,26 @@ class StringHelperTest extends TestCase
      * @param mixed $end
      * @param mixed $message
      */
+    #[\PHPUnit\Framework\Attributes\DataProvider('substringErrorProvider')]
     public function testSubstringError($string, $start, $end, $message)
     {
-        $this->expectError();
-        $this->expectErrorMessage($message);
+        $userError = '';
+        set_error_handler(static function (int $errno, string $errstr) use (&$userError): void {
+            $userError = $errstr;
+        }, E_USER_ERROR);
+
         StringHelper::substring($string, $start, $end);
+
+        $this->assertSame($message, $userError);
+        restore_error_handler();
     }
 
-    public function substringErrorProvider()
+    public static function substringErrorProvider(): array
     {
         return [
             ['FooBarBaz', -1, 1, 'substring(), Startindex out of bounds must be 0<n<9'],
-            ['FooBarBaz', -10, 100, 'substring(), Startindex out of bounds must be 0<n<9'],
-            ['FooBarBaz', 100, 1, 'substring(), Startindex out of bounds must be 0<n<9'],
+            ['FooBarBaz', -10, 100, 'substring(), Endindex out of bounds must be -10<n<8'],
+            ['FooBarBaz', 100, 1, 'substring(), Endindex out of bounds must be 100<n<8'],
             ['FooBarBaz', 0, 100, 'substring(), Endindex out of bounds must be 0<n<8'],
             ['FooBarBaz', 3, 1, 'substring(), Endindex out of bounds must be 3<n<8'],
         ];
@@ -280,13 +292,14 @@ class StringHelperTest extends TestCase
      * @param mixed $value
      * @param mixed $expected
      */
+    #[\PHPUnit\Framework\Attributes\DataProvider('isSlotVarProvider')]
     public function testIsSlotVar($value, $expected)
     {
         $result = StringHelper::isSlotVar($value);
         $this->assertSame($expected, $result);
     }
 
-    public function isSlotVarProvider()
+    public static function isSlotVarProvider(): array
     {
         return [
             // 1
@@ -316,13 +329,14 @@ class StringHelperTest extends TestCase
      * @param mixed $var
      * @param mixed $expected
      */
+    #[\PHPUnit\Framework\Attributes\DataProvider('slotVarProvider')]
     public function testSlotVar($var, $expected)
     {
         $result = StringHelper::slotVar($var);
         $this->assertSame($expected, $result);
     }
 
-    public function slotVarProvider()
+    public static function slotVarProvider(): array
     {
         return [
             ['%{slot.var}', 'slot.var'],
diff --git a/tests/etc/tasks/ext/phpunit/tests/provider_failTest.php b/tests/etc/tasks/ext/phpunit/tests/provider_failTest.php
index a60154a..e63da7f 100644
--- a/tests/etc/tasks/ext/phpunit/tests/provider_failTest.php
+++ b/tests/etc/tasks/ext/phpunit/tests/provider_failTest.php
@@ -17,12 +17,13 @@ class provider_failTest extends \PHPUnit\Framework\TestCase
      * @param mixed $v1
      * @param mixed $v2
      */
+    #[\PHPUnit\Framework\Attributes\DataProvider('provider')]
     public function testProvider($v1, $v2)
     {
         $this->assertEquals($v1, $v2);
     }
 
-    public function provider()
+    public static function provider(): array
     {
         return [
             [true, true],
