Skip to content

Commit 99f0d82

Browse files
authored
Merge pull request #67 from ruudk/drop-php80
Drop PHP 8.0, require PHP 8.1 minimum, use PHPUnit 10
2 parents 08c23de + fd51821 commit 99f0d82

File tree

6 files changed

+33
-32
lines changed

6 files changed

+33
-32
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ jobs:
1515
fail-fast: false
1616
matrix:
1717
php-version:
18-
- "8.0"
1918
- "8.1"
2019
- "8.2"
2120
dependencies:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ composer.phar
55
phpunit.xml
66
.php_cs.cache
77
.phpunit.result.cache
8+
.phpunit.cache

composer.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,11 @@
2323
"overblog/promise-adapter": "self.version"
2424
},
2525
"require": {
26-
"php": "^8.0"
26+
"php": "^8.1"
2727
},
2828
"require-dev": {
2929
"guzzlehttp/promises": "^1.5.0 || ^2.0.0",
30-
"phpunit/php-code-coverage": "^9.2.27",
31-
"phpunit/phpunit": "^9.6.11",
30+
"phpunit/phpunit": "^10.3",
3231
"react/promise": "^2.8.0",
3332
"webonyx/graphql-php": "^15.0"
3433
},

lib/promise-adapter/tests/AdapterTest.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,16 @@
1515
use Overblog\PromiseAdapter\Adapter\ReactPromiseAdapter;
1616
use Overblog\PromiseAdapter\Adapter\WebonyxGraphQLSyncPromiseAdapter;
1717
use Overblog\PromiseAdapter\PromiseAdapterInterface;
18+
use PHPUnit\Framework\Attributes\DataProvider;
1819

1920
class AdapterTest extends \PHPUnit\Framework\TestCase
2021
{
2122
/**
22-
* @dataProvider AdapterDataProvider
2323
* @param string $promiseClass
2424
* @param PromiseAdapterInterface $Adapter
2525
* @param string $context
2626
*/
27+
#[DataProvider('AdapterDataProvider')]
2728
public function testCreate(PromiseAdapterInterface $Adapter, $context, $promiseClass)
2829
{
2930
$promise = $Adapter->create($resolve, $reject);
@@ -34,10 +35,10 @@ public function testCreate(PromiseAdapterInterface $Adapter, $context, $promiseC
3435
}
3536

3637
/**
37-
* @dataProvider AdapterDataProvider
3838
* @param PromiseAdapterInterface $Adapter
3939
* @param $message
4040
*/
41+
#[DataProvider('AdapterDataProvider')]
4142
public function testResolveCreatedPromise(PromiseAdapterInterface $Adapter, $message)
4243
{
4344
$promise = $Adapter->create($resolve, $reject);
@@ -49,10 +50,10 @@ public function testResolveCreatedPromise(PromiseAdapterInterface $Adapter, $mes
4950
}
5051

5152
/**
52-
* @dataProvider AdapterDataProvider
5353
* @param PromiseAdapterInterface $Adapter
5454
* @param string $context
5555
*/
56+
#[DataProvider('AdapterDataProvider')]
5657
public function testRejectCreatedPromise(PromiseAdapterInterface $Adapter, $context)
5758
{
5859
$promise = $Adapter->create($resolve, $reject);
@@ -65,11 +66,11 @@ public function testRejectCreatedPromise(PromiseAdapterInterface $Adapter, $cont
6566
}
6667

6768
/**
68-
* @dataProvider AdapterDataProvider
6969
* @param PromiseAdapterInterface $Adapter
7070
* @param string $context
7171
* @param string $promiseClass
7272
*/
73+
#[DataProvider('AdapterDataProvider')]
7374
public function testCreateAll(PromiseAdapterInterface $Adapter, $context, $promiseClass)
7475
{
7576
$values = ['A', 'B', 'C'];
@@ -82,11 +83,11 @@ public function testCreateAll(PromiseAdapterInterface $Adapter, $context, $promi
8283
}
8384

8485
/**
85-
* @dataProvider AdapterDataProvider
8686
* @param PromiseAdapterInterface $Adapter
8787
* @param string $context
8888
* @param string $promiseClass
8989
*/
90+
#[DataProvider('AdapterDataProvider')]
9091
public function testCreateFulfilled(PromiseAdapterInterface $Adapter, $context, $promiseClass)
9192
{
9293
$value = 'resolved!';
@@ -98,11 +99,11 @@ public function testCreateFulfilled(PromiseAdapterInterface $Adapter, $context,
9899
}
99100

100101
/**
101-
* @dataProvider AdapterDataProvider
102102
* @param PromiseAdapterInterface $Adapter
103103
* @param string $context
104104
* @param string $promiseClass
105105
*/
106+
#[DataProvider('AdapterDataProvider')]
106107
public function testCreatedRejected(PromiseAdapterInterface $Adapter, $context, $promiseClass)
107108
{
108109
$expectRejectionReason = new \Exception('Error!');
@@ -114,10 +115,10 @@ public function testCreatedRejected(PromiseAdapterInterface $Adapter, $context,
114115
}
115116

116117
/**
117-
* @dataProvider AdapterDataProvider
118118
* @param PromiseAdapterInterface $Adapter
119119
* @param string $context
120120
*/
121+
#[DataProvider('AdapterDataProvider')]
121122
public function testIsPromise(PromiseAdapterInterface $Adapter, $context)
122123
{
123124
$promise = $Adapter->create();
@@ -128,10 +129,10 @@ public function testIsPromise(PromiseAdapterInterface $Adapter, $context)
128129
}
129130

130131
/**
131-
* @dataProvider AdapterDataProvider
132132
* @param PromiseAdapterInterface $Adapter
133133
* @param string $context
134134
*/
135+
#[DataProvider('AdapterDataProvider')]
135136
public function testAwaitWithoutPromise(PromiseAdapterInterface $Adapter, $context)
136137
{
137138
$expected = 'expected value';
@@ -148,10 +149,9 @@ public function testAwaitWithoutPromise(PromiseAdapterInterface $Adapter, $conte
148149
}
149150

150151
/**
151-
* @dataProvider AdapterDataProvider
152152
* @param PromiseAdapterInterface $Adapter
153-
*
154153
*/
154+
#[DataProvider('AdapterDataProvider')]
155155
public function testAwaitWithUnwrap(PromiseAdapterInterface $Adapter)
156156
{
157157
$this->expectException(\Exception::class);
@@ -164,9 +164,9 @@ public function testAwaitWithUnwrap(PromiseAdapterInterface $Adapter)
164164
}
165165

166166
/**
167-
* @dataProvider AdapterDataProvider
168167
* @param PromiseAdapterInterface $Adapter
169168
*/
169+
#[DataProvider('AdapterDataProvider')]
170170
public function testAwaitWithInvalidPromise(PromiseAdapterInterface $Adapter)
171171
{
172172
$this->expectException(\InvalidArgumentException::class);
@@ -176,9 +176,9 @@ public function testAwaitWithInvalidPromise(PromiseAdapterInterface $Adapter)
176176
}
177177

178178
/**
179-
* @dataProvider AdapterDataProvider
180179
* @param PromiseAdapterInterface $Adapter
181180
*/
181+
#[DataProvider('AdapterDataProvider')]
182182
public function testCancel(PromiseAdapterInterface $Adapter)
183183
{
184184
$this->expectException(\Exception::class);
@@ -193,9 +193,9 @@ public function testCancel(PromiseAdapterInterface $Adapter)
193193
}
194194

195195
/**
196-
* @dataProvider AdapterDataProvider
197196
* @param PromiseAdapterInterface $Adapter
198197
*/
198+
#[DataProvider('AdapterDataProvider')]
199199
public function testCancelInvalidPromise(PromiseAdapterInterface $Adapter)
200200
{
201201
$this->expectException(\Exception::class);
@@ -208,7 +208,7 @@ public function testCancelInvalidPromise(PromiseAdapterInterface $Adapter)
208208
$Adapter->cancel(new \stdClass());
209209
}
210210

211-
public function AdapterDataProvider()
211+
public static function AdapterDataProvider()
212212
{
213213
return [
214214
[new GuzzleHttpPromiseAdapter(), 'guzzle', 'GuzzleHttp\\Promise\\PromiseInterface'],

phpunit.xml.dist

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!-- http://phpunit.de/manual/4.1/en/appendixes.configuration.html -->
3-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" backupGlobals="false" colors="true" bootstrap="./vendor/autoload.php" convertDeprecationsToExceptions="false">
4-
<coverage>
5-
<include>
6-
<directory>./src</directory>
7-
<directory>./lib/promise-adapter/src</directory>
8-
</include>
9-
<exclude>
10-
<directory>./vendor</directory>
11-
<directory>./tests</directory>
12-
<directory>./lib/promise-adapter/tests</directory>
13-
</exclude>
14-
</coverage>
3+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd" backupGlobals="false" colors="true" bootstrap="./vendor/autoload.php" cacheDirectory=".phpunit.cache">
4+
<coverage/>
155
<php>
166
<ini name="error_reporting" value="-1"/>
177
</php>
@@ -21,4 +11,15 @@
2111
<directory>./lib/promise-adapter/tests</directory>
2212
</testsuite>
2313
</testsuites>
14+
<source>
15+
<include>
16+
<directory>./src</directory>
17+
<directory>./lib/promise-adapter/src</directory>
18+
</include>
19+
<exclude>
20+
<directory>./vendor</directory>
21+
<directory>./tests</directory>
22+
<directory>./lib/promise-adapter/tests</directory>
23+
</exclude>
24+
</source>
2425
</phpunit>

tests/Functional/Webonyx/GraphQL/TestCase.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@
1818
use GraphQL\GraphQL;
1919
use Overblog\DataLoader\DataLoader;
2020
use Overblog\PromiseAdapter\PromiseAdapterInterface;
21+
use PHPUnit\Framework\Attributes\DataProvider;
2122

2223
abstract class TestCase extends \PHPUnit\Framework\TestCase
2324
{
2425
private static $fixtures = null;
2526

26-
public function getFixtures()
27+
public static function getFixtures()
2728
{
2829
if (null === self::$fixtures) {
2930
$fixturesFiles = self::listFiles(__DIR__.'/fixtures');
@@ -64,11 +65,11 @@ private static function listFiles($dir, &$results = [])
6465
}
6566

6667
/**
67-
* @dataProvider getFixtures
6868
* @param array $expectedMetrics
6969
* @param string $query
7070
* @param array $expectedResponse
7171
*/
72+
#[DataProvider('getFixtures')]
7273
public function testExecute(array $expectedMetrics, $query, array $expectedResponse)
7374
{
7475
$metrics = [

0 commit comments

Comments
 (0)