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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357
|
From: William Desportes <williamdes@wdes.fr>
Date: Sun, 13 Apr 2025 14:58:08 +0200
Subject: PHPUnit 10+ compatibility fixes
Origin: vendor
Forwarded: no
---
src/Phing/Task/Ext/PhpUnit/PHPUnitTask.php | 7 +++++--
tests/Phing/Test/Filter/StripPhpCommentsTest.php | 1 -
tests/Phing/Test/IntrospectionHelperTest.php | 1 +
tests/Phing/Test/Io/WindowsFileSystemTest.php | 1 +
tests/Phing/Test/Task/Ext/Analyzer/PhpDependTaskTest.php | 1 +
tests/Phing/Test/Task/Ext/Analyzer/SonarTaskTest.php | 1 -
tests/Phing/Test/Task/Ext/Git/GitArchiveTaskTest.php | 1 +
tests/Phing/Test/Task/Ext/Git/GitBaseTest.php | 1 +
tests/Phing/Test/Task/Ext/Git/GitBranchTaskTest.php | 1 +
tests/Phing/Test/Task/Ext/Git/GitCheckoutTaskTest.php | 1 +
tests/Phing/Test/Task/Ext/Git/GitCloneTaskTest.php | 1 +
tests/Phing/Test/Task/Ext/Git/GitDescribeTaskTest.php | 1 +
tests/Phing/Test/Task/Ext/Git/GitGcTaskTest.php | 1 +
tests/Phing/Test/Task/Ext/Git/GitInitTaskTest.php | 1 +
tests/Phing/Test/Task/Ext/Git/GitLogTaskTest.php | 1 +
tests/Phing/Test/Task/Ext/Git/GitMergeTaskTest.php | 1 +
tests/Phing/Test/Task/Ext/Git/GitPullTaskTest.php | 1 +
tests/Phing/Test/Task/Ext/Git/GitPushTaskTest.php | 1 +
tests/Phing/Test/Task/Ext/Git/GitTagTaskTest.php | 1 +
tests/Phing/Test/Task/Optional/CoverageMergeTest.php | 1 +
tests/Phing/Test/Task/System/AttribTaskTest.php | 1 +
tests/Phing/Test/Task/System/ExecTaskTest.php | 3 ++-
tests/Phing/Test/Task/System/SymlinkTaskTest.php | 1 +
tests/Phing/Test/Type/Selector/ExecutableTest.php | 1 +
tests/Phing/Test/Type/Selector/SymlinkSelectorTest.php | 1 +
25 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/src/Phing/Task/Ext/PhpUnit/PHPUnitTask.php b/src/Phing/Task/Ext/PhpUnit/PHPUnitTask.php
index 0abea71..63ceabf 100644
--- a/src/Phing/Task/Ext/PhpUnit/PHPUnitTask.php
+++ b/src/Phing/Task/Ext/PhpUnit/PHPUnitTask.php
@@ -27,6 +27,7 @@ use Phing\Io\LogWriter;
use Phing\Io\File;
use Phing\Task;
use PHPUnit\Framework\TestSuite;
+use PHPUnit\Framework\TestCase;
use PHPUnit\TextUI\XmlConfiguration\Loader;
use ReflectionException;
use ReflectionClass;
@@ -463,7 +464,7 @@ class PHPUnitTask extends Task
}
$this->loadPHPUnit();
- $suite = new \PHPUnit\Framework\TestSuite('AllTests');
+ $suite = \PHPUnit\Framework\TestSuite::empty('AllTests');
$autoloadSave = spl_autoload_functions();
if ($this->bootstrap) {
@@ -700,7 +701,9 @@ class PHPUnitTask extends Task
protected function appendBatchTestToTestSuite(BatchTest $batchTest, $suite)
{
foreach ($batchTest->elements() as $element) {
- $testClass = new $element();
+ // First argument is the test name
+ $testClass = new $element($element);
+
if (!($testClass instanceof TestSuite)) {
$testClass = new ReflectionClass($element);
}
diff --git a/tests/Phing/Test/Filter/StripPhpCommentsTest.php b/tests/Phing/Test/Filter/StripPhpCommentsTest.php
index e56f606..42efe2b 100644
--- a/tests/Phing/Test/Filter/StripPhpCommentsTest.php
+++ b/tests/Phing/Test/Filter/StripPhpCommentsTest.php
@@ -49,7 +49,6 @@ class StripPhpCommentsTest extends BuildFileTest
/**
* @throws IOException
- * @requires OSFAMILY Windows|Linux
*/
public function testStripPhpComments(): void
{
diff --git a/tests/Phing/Test/IntrospectionHelperTest.php b/tests/Phing/Test/IntrospectionHelperTest.php
index fa1c435..a78b594 100644
--- a/tests/Phing/Test/IntrospectionHelperTest.php
+++ b/tests/Phing/Test/IntrospectionHelperTest.php
@@ -111,6 +111,7 @@ class IntrospectionHelperTest extends TestCase
* @requires PHP >= 8
* @return void
*/
+ #[\PHPUnit\Framework\Attributes\RequiresPhp('>= 8')]
public function testUnionTypeOnSetterDoesNotCrashIH(): void
{
$clz = eval('return new class {
diff --git a/tests/Phing/Test/Io/WindowsFileSystemTest.php b/tests/Phing/Test/Io/WindowsFileSystemTest.php
index 5257f2d..002be74 100644
--- a/tests/Phing/Test/Io/WindowsFileSystemTest.php
+++ b/tests/Phing/Test/Io/WindowsFileSystemTest.php
@@ -30,6 +30,7 @@ use Phing\Io\WindowsFileSystem;
*
* @internal
*/
+#[\PHPUnit\Framework\Attributes\RequiresOperatingSystemFamily('Windows')]
class WindowsFileSystemTest extends AbstractWinFileSystemTestCase
{
protected function createFileSystem(): WindowsFileSystem
diff --git a/tests/Phing/Test/Task/Ext/Analyzer/PhpDependTaskTest.php b/tests/Phing/Test/Task/Ext/Analyzer/PhpDependTaskTest.php
index d088b3e..389fec3 100644
--- a/tests/Phing/Test/Task/Ext/Analyzer/PhpDependTaskTest.php
+++ b/tests/Phing/Test/Task/Ext/Analyzer/PhpDependTaskTest.php
@@ -30,6 +30,7 @@ use Phing\Test\Support\BuildFileTest;
* @internal
* @requires PHP < 8.1
*/
+#[\PHPUnit\Framework\Attributes\RequiresPhp('< 8.1')]
class PhpDependTaskTest extends BuildFileTest
{
public function setUp(): void
diff --git a/tests/Phing/Test/Task/Ext/Analyzer/SonarTaskTest.php b/tests/Phing/Test/Task/Ext/Analyzer/SonarTaskTest.php
index ff3039c..a2383ed 100644
--- a/tests/Phing/Test/Task/Ext/Analyzer/SonarTaskTest.php
+++ b/tests/Phing/Test/Task/Ext/Analyzer/SonarTaskTest.php
@@ -27,7 +27,6 @@ use Phing\Test\Support\BuildFileTest;
/**
* @author Bernhard Mendl <mail@bernhard-mendl.de>
*
- * @requires OSFAMILY Windows|Linux
*
* @internal
*/
diff --git a/tests/Phing/Test/Task/Ext/Git/GitArchiveTaskTest.php b/tests/Phing/Test/Task/Ext/Git/GitArchiveTaskTest.php
index 256c402..b1a3233 100644
--- a/tests/Phing/Test/Task/Ext/Git/GitArchiveTaskTest.php
+++ b/tests/Phing/Test/Task/Ext/Git/GitArchiveTaskTest.php
@@ -29,6 +29,7 @@ use Phing\Test\Support\BuildFileTest;
*
* @internal
*/
+#[\PHPUnit\Framework\Attributes\RequiresOperatingSystemFamily('Linux')]
class GitArchiveTaskTest extends BuildFileTest
{
public function setUp(): void
diff --git a/tests/Phing/Test/Task/Ext/Git/GitBaseTest.php b/tests/Phing/Test/Task/Ext/Git/GitBaseTest.php
index 90dcb4e..e7acee8 100644
--- a/tests/Phing/Test/Task/Ext/Git/GitBaseTest.php
+++ b/tests/Phing/Test/Task/Ext/Git/GitBaseTest.php
@@ -29,6 +29,7 @@ use Phing\Test\Support\BuildFileTest;
*
* @internal
*/
+#[\PHPUnit\Framework\Attributes\RequiresOperatingSystemFamily('Linux')]
class GitBaseTest extends BuildFileTest
{
protected $mock;
diff --git a/tests/Phing/Test/Task/Ext/Git/GitBranchTaskTest.php b/tests/Phing/Test/Task/Ext/Git/GitBranchTaskTest.php
index d023ced..b8b1aa6 100644
--- a/tests/Phing/Test/Task/Ext/Git/GitBranchTaskTest.php
+++ b/tests/Phing/Test/Task/Ext/Git/GitBranchTaskTest.php
@@ -28,6 +28,7 @@ use Phing\Test\Support\BuildFileTest;
*
* @internal
*/
+#[\PHPUnit\Framework\Attributes\RequiresOperatingSystemFamily('Linux')]
class GitBranchTaskTest extends BuildFileTest
{
public function setUp(): void
diff --git a/tests/Phing/Test/Task/Ext/Git/GitCheckoutTaskTest.php b/tests/Phing/Test/Task/Ext/Git/GitCheckoutTaskTest.php
index 08e996b..321d275 100644
--- a/tests/Phing/Test/Task/Ext/Git/GitCheckoutTaskTest.php
+++ b/tests/Phing/Test/Task/Ext/Git/GitCheckoutTaskTest.php
@@ -28,6 +28,7 @@ use Phing\Test\Support\BuildFileTest;
*
* @internal
*/
+#[\PHPUnit\Framework\Attributes\RequiresOperatingSystemFamily('Linux')]
class GitCheckoutTaskTest extends BuildFileTest
{
public function setUp(): void
diff --git a/tests/Phing/Test/Task/Ext/Git/GitCloneTaskTest.php b/tests/Phing/Test/Task/Ext/Git/GitCloneTaskTest.php
index d3e9979..83197af 100644
--- a/tests/Phing/Test/Task/Ext/Git/GitCloneTaskTest.php
+++ b/tests/Phing/Test/Task/Ext/Git/GitCloneTaskTest.php
@@ -28,6 +28,7 @@ use Phing\Test\Support\BuildFileTest;
*
* @internal
*/
+#[\PHPUnit\Framework\Attributes\RequiresOperatingSystemFamily('Linux')]
class GitCloneTaskTest extends BuildFileTest
{
public function setUp(): void
diff --git a/tests/Phing/Test/Task/Ext/Git/GitDescribeTaskTest.php b/tests/Phing/Test/Task/Ext/Git/GitDescribeTaskTest.php
index b9f9d2d..2de47c9 100644
--- a/tests/Phing/Test/Task/Ext/Git/GitDescribeTaskTest.php
+++ b/tests/Phing/Test/Task/Ext/Git/GitDescribeTaskTest.php
@@ -27,6 +27,7 @@ use Phing\Test\Support\BuildFileTest;
*
* @internal
*/
+#[\PHPUnit\Framework\Attributes\RequiresOperatingSystemFamily('Linux')]
class GitDescribeTaskTest extends BuildFileTest
{
public function setUp(): void
diff --git a/tests/Phing/Test/Task/Ext/Git/GitGcTaskTest.php b/tests/Phing/Test/Task/Ext/Git/GitGcTaskTest.php
index 07ca6c3..9313ae9 100644
--- a/tests/Phing/Test/Task/Ext/Git/GitGcTaskTest.php
+++ b/tests/Phing/Test/Task/Ext/Git/GitGcTaskTest.php
@@ -28,6 +28,7 @@ use Phing\Test\Support\BuildFileTest;
*
* @internal
*/
+#[\PHPUnit\Framework\Attributes\RequiresOperatingSystemFamily('Linux')]
class GitGcTaskTest extends BuildFileTest
{
public function setUp(): void
diff --git a/tests/Phing/Test/Task/Ext/Git/GitInitTaskTest.php b/tests/Phing/Test/Task/Ext/Git/GitInitTaskTest.php
index 3fec6f7..e61f587 100644
--- a/tests/Phing/Test/Task/Ext/Git/GitInitTaskTest.php
+++ b/tests/Phing/Test/Task/Ext/Git/GitInitTaskTest.php
@@ -28,6 +28,7 @@ use Phing\Test\Support\BuildFileTest;
*
* @internal
*/
+#[\PHPUnit\Framework\Attributes\RequiresOperatingSystemFamily('Linux')]
class GitInitTaskTest extends BuildFileTest
{
public function setUp(): void
diff --git a/tests/Phing/Test/Task/Ext/Git/GitLogTaskTest.php b/tests/Phing/Test/Task/Ext/Git/GitLogTaskTest.php
index 888ddae..5590962 100644
--- a/tests/Phing/Test/Task/Ext/Git/GitLogTaskTest.php
+++ b/tests/Phing/Test/Task/Ext/Git/GitLogTaskTest.php
@@ -28,6 +28,7 @@ use Phing\Test\Support\BuildFileTest;
*
* @internal
*/
+#[\PHPUnit\Framework\Attributes\RequiresOperatingSystemFamily('Linux')]
class GitLogTaskTest extends BuildFileTest
{
private $testCommits = [
diff --git a/tests/Phing/Test/Task/Ext/Git/GitMergeTaskTest.php b/tests/Phing/Test/Task/Ext/Git/GitMergeTaskTest.php
index ac2d11c..e299c04 100644
--- a/tests/Phing/Test/Task/Ext/Git/GitMergeTaskTest.php
+++ b/tests/Phing/Test/Task/Ext/Git/GitMergeTaskTest.php
@@ -28,6 +28,7 @@ use Phing\Test\Support\BuildFileTest;
*
* @internal
*/
+#[\PHPUnit\Framework\Attributes\RequiresOperatingSystemFamily('Linux')]
class GitMergeTaskTest extends BuildFileTest
{
public function setUp(): void
diff --git a/tests/Phing/Test/Task/Ext/Git/GitPullTaskTest.php b/tests/Phing/Test/Task/Ext/Git/GitPullTaskTest.php
index 311f519..feefaf2 100644
--- a/tests/Phing/Test/Task/Ext/Git/GitPullTaskTest.php
+++ b/tests/Phing/Test/Task/Ext/Git/GitPullTaskTest.php
@@ -28,6 +28,7 @@ use Phing\Test\Support\BuildFileTest;
*
* @internal
*/
+#[\PHPUnit\Framework\Attributes\RequiresOperatingSystemFamily('Linux')]
class GitPullTaskTest extends BuildFileTest
{
public function setUp(): void
diff --git a/tests/Phing/Test/Task/Ext/Git/GitPushTaskTest.php b/tests/Phing/Test/Task/Ext/Git/GitPushTaskTest.php
index 63ddb75..c302878 100644
--- a/tests/Phing/Test/Task/Ext/Git/GitPushTaskTest.php
+++ b/tests/Phing/Test/Task/Ext/Git/GitPushTaskTest.php
@@ -28,6 +28,7 @@ use Phing\Test\Support\BuildFileTest;
*
* @internal
*/
+#[\PHPUnit\Framework\Attributes\RequiresOperatingSystemFamily('Linux')]
class GitPushTaskTest extends BuildFileTest
{
public function setUp(): void
diff --git a/tests/Phing/Test/Task/Ext/Git/GitTagTaskTest.php b/tests/Phing/Test/Task/Ext/Git/GitTagTaskTest.php
index 2bb9742..80d9b3c 100644
--- a/tests/Phing/Test/Task/Ext/Git/GitTagTaskTest.php
+++ b/tests/Phing/Test/Task/Ext/Git/GitTagTaskTest.php
@@ -28,6 +28,7 @@ use Phing\Test\Support\BuildFileTest;
*
* @internal
*/
+#[\PHPUnit\Framework\Attributes\RequiresOperatingSystemFamily('Linux')]
class GitTagTaskTest extends BuildFileTest
{
public function setUp(): void
diff --git a/tests/Phing/Test/Task/Optional/CoverageMergeTest.php b/tests/Phing/Test/Task/Optional/CoverageMergeTest.php
index dcda7f0..2f3eaf2 100644
--- a/tests/Phing/Test/Task/Optional/CoverageMergeTest.php
+++ b/tests/Phing/Test/Task/Optional/CoverageMergeTest.php
@@ -28,6 +28,7 @@ use Phing\Test\Support\BuildFileTest;
*
* @internal
*/
+#[\PHPUnit\Framework\Attributes\RequiresPhpExtension('xdebug')]
class CoverageMergeTest extends BuildFileTest
{
public function setUp(): void
diff --git a/tests/Phing/Test/Task/System/AttribTaskTest.php b/tests/Phing/Test/Task/System/AttribTaskTest.php
index b60d645..56871d2 100644
--- a/tests/Phing/Test/Task/System/AttribTaskTest.php
+++ b/tests/Phing/Test/Task/System/AttribTaskTest.php
@@ -31,6 +31,7 @@ use Phing\Test\Support\BuildFileTest;
*
* @internal
*/
+#[\PHPUnit\Framework\Attributes\RequiresOperatingSystemFamily('Linux')]
class AttribTaskTest extends BuildFileTest
{
public function setUp(): void
diff --git a/tests/Phing/Test/Task/System/ExecTaskTest.php b/tests/Phing/Test/Task/System/ExecTaskTest.php
index 33facf5..2a28931 100644
--- a/tests/Phing/Test/Task/System/ExecTaskTest.php
+++ b/tests/Phing/Test/Task/System/ExecTaskTest.php
@@ -214,8 +214,9 @@ class ExecTaskTest extends BuildFileTest
}
/**
- * @requires OS Linux|Darwin
+ * @requires OSFAMILY Linux
*/
+ #[\PHPUnit\Framework\Attributes\RequiresOperatingSystemFamily('Linux')]
public function testChangeToDir(): void
{
$this->executeTarget(__FUNCTION__);
diff --git a/tests/Phing/Test/Task/System/SymlinkTaskTest.php b/tests/Phing/Test/Task/System/SymlinkTaskTest.php
index 4ca09ce..25c2ed8 100644
--- a/tests/Phing/Test/Task/System/SymlinkTaskTest.php
+++ b/tests/Phing/Test/Task/System/SymlinkTaskTest.php
@@ -30,6 +30,7 @@ use Phing\Test\Support\BuildFileTest;
*
* @internal
*/
+#[\PHPUnit\Framework\Attributes\RequiresOperatingSystem('Linux')]
class SymlinkTaskTest extends BuildFileTest
{
public function setUp(): void
diff --git a/tests/Phing/Test/Type/Selector/ExecutableTest.php b/tests/Phing/Test/Type/Selector/ExecutableTest.php
index 2c46bc1..2c1010e 100644
--- a/tests/Phing/Test/Type/Selector/ExecutableTest.php
+++ b/tests/Phing/Test/Type/Selector/ExecutableTest.php
@@ -31,6 +31,7 @@ use Phing\Test\Support\BuildFileTest;
*
* @internal
*/
+#[\PHPUnit\Framework\Attributes\RequiresOperatingSystem('Linux')]
class ExecutableTest extends BuildFileTest
{
public function setUp(): void
diff --git a/tests/Phing/Test/Type/Selector/SymlinkSelectorTest.php b/tests/Phing/Test/Type/Selector/SymlinkSelectorTest.php
index 319a343..df21d6b 100644
--- a/tests/Phing/Test/Type/Selector/SymlinkSelectorTest.php
+++ b/tests/Phing/Test/Type/Selector/SymlinkSelectorTest.php
@@ -31,6 +31,7 @@ use Phing\Test\Support\BuildFileTest;
*
* @internal
*/
+#[\PHPUnit\Framework\Attributes\RequiresOperatingSystem('Linux')]
class SymlinkSelectorTest extends BuildFileTest
{
public function setUp(): void
|