Skip to content

Commit 37533bb

Browse files
Support PHPUnit 10
1 parent 208c4a9 commit 37533bb

File tree

8 files changed

+20
-35
lines changed

8 files changed

+20
-35
lines changed

phpunit.xml.dist

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,13 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit backupGlobals="false"
3-
backupStaticAttributes="false"
4-
beStrictAboutTestsThatDoNotTestAnything="true"
5-
beStrictAboutOutputDuringTests="true"
6-
bootstrap="vendor/autoload.php"
7-
colors="true"
8-
convertDeprecationsToExceptions="true"
9-
convertErrorsToExceptions="true"
10-
convertNoticesToExceptions="true"
11-
convertWarningsToExceptions="true"
12-
failOnRisky="true"
13-
failOnWarning="true"
14-
processIsolation="false"
15-
stopOnError="false"
16-
stopOnFailure="false"
17-
verbose="true"
18-
>
19-
<testsuites>
20-
<testsuite name="Test Suite">
21-
<directory suffix="Test.php">./tests</directory>
22-
</testsuite>
23-
</testsuites>
24-
<coverage processUncoveredFiles="true">
25-
<include>
26-
<directory suffix=".php">./src</directory>
27-
</include>
28-
</coverage>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" beStrictAboutTestsThatDoNotTestAnything="true" beStrictAboutOutputDuringTests="true" bootstrap="vendor/autoload.php" colors="true" failOnRisky="true" failOnWarning="true" processIsolation="false" stopOnError="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd">
3+
<testsuites>
4+
<testsuite name="Test Suite">
5+
<directory suffix="Test.php">./tests</directory>
6+
</testsuite>
7+
</testsuites>
8+
<coverage>
9+
<include>
10+
<directory suffix=".php">./src</directory>
11+
</include>
12+
</coverage>
2913
</phpunit>

tests/Api/ProjectsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2082,7 +2082,7 @@ protected function getMultipleProjectsDataWithNamespace()
20822082
];
20832083
}
20842084

2085-
public function possibleAccessLevels()
2085+
public static function possibleAccessLevels(): array
20862086
{
20872087
return [
20882088
[10],

tests/Api/RepositoriesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ public function shouldGetCommitRefsWithParams(string $type, array $expectedArray
380380
$this->assertEquals($expectedArray, $api->commitRefs(1, 'abcd1234', ['type' => $type]));
381381
}
382382

383-
public function dataGetCommitRefsWithParams()
383+
public static function dataGetCommitRefsWithParams(): array
384384
{
385385
return [
386386
'type_tag' => [

tests/Api/TagsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public function shouldUpdateRelease(string $releaseName, string $description, ar
140140
$this->assertEquals($expectedResult, $api->updateRelease(1, $releaseName, $params));
141141
}
142142

143-
public function releaseDataProvider()
143+
public static function releaseDataProvider(): array
144144
{
145145
return [
146146
[

tests/Api/TestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ abstract protected function getApiClass();
3333
protected function getApiMock(array $methods = [])
3434
{
3535
$httpClient = $this->getMockBuilder(ClientInterface::class)
36-
->setMethods(['sendRequest'])
36+
->onlyMethods(['sendRequest'])
3737
->getMock();
3838
$httpClient
3939
->expects($this->any())
@@ -42,7 +42,7 @@ protected function getApiMock(array $methods = [])
4242
$client = Client::createWithHttpClient($httpClient);
4343

4444
return $this->getMockBuilder($this->getApiClass())
45-
->setMethods(\array_merge(['getAsResponse', 'get', 'post', 'postRaw', 'patch', 'delete', 'put', 'head'], $methods))
45+
->onlyMethods(\array_merge(['getAsResponse', 'get', 'post', 'delete', 'put'], $methods))
4646
->setConstructorArgs([$client, null])
4747
->getMock();
4848
}

tests/Api/UsersTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ public function shouldGetOwnedUsersProjects(): void
259259
$this->assertEquals($expectedArray, $api->usersProjects(1, ['owned' => true]));
260260
}
261261

262-
public function possibleAccessLevels()
262+
public static function possibleAccessLevels(): array
263263
{
264264
return [
265265
[10],

tests/HttpClient/Util/QueryStringBuilderTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
namespace Gitlab\Tests\HttpClient\Util;
1616

17+
use Generator;
1718
use Gitlab\HttpClient\Util\QueryStringBuilder;
1819
use PHPUnit\Framework\TestCase;
1920

@@ -30,7 +31,7 @@ public function testBuild(array $query, string $expected): void
3031
$this->assertSame(\sprintf('?%s', $expected), QueryStringBuilder::build($query));
3132
}
3233

33-
public function queryStringProvider()
34+
public static function queryStringProvider(): Generator
3435
{
3536
yield 'indexed array' => [
3637
[

vendor-bin/phpunit/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"require": {
33
"php": "^7.4.15 || ^8.0.2",
4-
"phpunit/phpunit": "^9.5.12"
4+
"phpunit/phpunit": "^9.6.3 || ^10.0.12"
55
},
66
"config": {
77
"preferred-install": "dist"

0 commit comments

Comments
 (0)