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
|
From: =?utf-8?q?David_Pr=C3=A9vot?= <taffit@debian.org>
Date: Tue, 18 Feb 2025 19:01:10 +0100
Subject: Modernize PHPUnit syntax
---
tests/CoroutineTest.php | 6 +++++-
tests/UtilsTest.php | 5 ++---
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/tests/CoroutineTest.php b/tests/CoroutineTest.php
index 333f09a..124a911 100644
--- a/tests/CoroutineTest.php
+++ b/tests/CoroutineTest.php
@@ -7,6 +7,8 @@ namespace GuzzleHttp\Promise\Tests;
use GuzzleHttp\Promise\Coroutine;
use GuzzleHttp\Promise\Promise;
use GuzzleHttp\Promise\PromiseInterface;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\RequiresPhpunit;
use PHPUnit\Framework\TestCase;
use ReflectionClass;
@@ -19,11 +21,12 @@ class CoroutineTest extends TestCase
}
/**
- * @dataProvider promiseInterfaceMethodProvider
*
* @param string $method
* @param array $args
*/
+ #[DataProvider('promiseInterfaceMethodProvider')]
+ #[RequiresPhpunit('< 12')]
public function testShouldProxyPromiseMethodsToResultPromise($method, $args = []): void
{
$coroutine = new Coroutine(function () { yield 0; });
@@ -53,6 +56,7 @@ class CoroutineTest extends TestCase
];
}
+ #[RequiresPhpunit('< 12')]
public function testShouldCancelResultPromiseAndOutsideCurrentPromise(): void
{
$coroutine = new Coroutine(function () { yield 0; });
diff --git a/tests/UtilsTest.php b/tests/UtilsTest.php
index 00c6f3c..110231e 100644
--- a/tests/UtilsTest.php
+++ b/tests/UtilsTest.php
@@ -12,6 +12,7 @@ use GuzzleHttp\Promise\PromiseInterface;
use GuzzleHttp\Promise\RejectedPromise;
use GuzzleHttp\Promise\RejectionException;
use GuzzleHttp\Promise\TaskQueue;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
class UtilsTest extends TestCase
@@ -304,9 +305,7 @@ class UtilsTest extends TestCase
$this->assertSame('ab', $result);
}
- /**
- * @dataProvider rejectsParentExceptionProvider
- */
+ #[DataProvider('rejectsParentExceptionProvider')]
public function testRejectsParentExceptionWhenException(PromiseInterface $promise): void
{
$promise->then(
|