Skip to content

Commit

Permalink
Support PHPUnit 10
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamCampbell committed Mar 6, 2023
1 parent 208c4a9 commit 37533bb
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 35 deletions.
38 changes: 11 additions & 27 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,29 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutOutputDuringTests="true"
bootstrap="vendor/autoload.php"
colors="true"
convertDeprecationsToExceptions="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
failOnRisky="true"
failOnWarning="true"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
verbose="true"
>
<testsuites>
<testsuite name="Test Suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</include>
</coverage>
<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">
<testsuites>
<testsuite name="Test Suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<coverage>
<include>
<directory suffix=".php">./src</directory>
</include>
</coverage>
</phpunit>
2 changes: 1 addition & 1 deletion tests/Api/ProjectsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2082,7 +2082,7 @@ protected function getMultipleProjectsDataWithNamespace()
];
}

public function possibleAccessLevels()
public static function possibleAccessLevels(): array
{
return [
[10],
Expand Down
2 changes: 1 addition & 1 deletion tests/Api/RepositoriesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ public function shouldGetCommitRefsWithParams(string $type, array $expectedArray
$this->assertEquals($expectedArray, $api->commitRefs(1, 'abcd1234', ['type' => $type]));
}

public function dataGetCommitRefsWithParams()
public static function dataGetCommitRefsWithParams(): array
{
return [
'type_tag' => [
Expand Down
2 changes: 1 addition & 1 deletion tests/Api/TagsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public function shouldUpdateRelease(string $releaseName, string $description, ar
$this->assertEquals($expectedResult, $api->updateRelease(1, $releaseName, $params));
}

public function releaseDataProvider()
public static function releaseDataProvider(): array
{
return [
[
Expand Down
4 changes: 2 additions & 2 deletions tests/Api/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ abstract protected function getApiClass();
protected function getApiMock(array $methods = [])
{
$httpClient = $this->getMockBuilder(ClientInterface::class)
->setMethods(['sendRequest'])
->onlyMethods(['sendRequest'])
->getMock();
$httpClient
->expects($this->any())
Expand All @@ -42,7 +42,7 @@ protected function getApiMock(array $methods = [])
$client = Client::createWithHttpClient($httpClient);

return $this->getMockBuilder($this->getApiClass())
->setMethods(\array_merge(['getAsResponse', 'get', 'post', 'postRaw', 'patch', 'delete', 'put', 'head'], $methods))
->onlyMethods(\array_merge(['getAsResponse', 'get', 'post', 'delete', 'put'], $methods))
->setConstructorArgs([$client, null])
->getMock();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Api/UsersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ public function shouldGetOwnedUsersProjects(): void
$this->assertEquals($expectedArray, $api->usersProjects(1, ['owned' => true]));
}

public function possibleAccessLevels()
public static function possibleAccessLevels(): array
{
return [
[10],
Expand Down
3 changes: 2 additions & 1 deletion tests/HttpClient/Util/QueryStringBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

namespace Gitlab\Tests\HttpClient\Util;

use Generator;
use Gitlab\HttpClient\Util\QueryStringBuilder;
use PHPUnit\Framework\TestCase;

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

public function queryStringProvider()
public static function queryStringProvider(): Generator
{
yield 'indexed array' => [
[
Expand Down
2 changes: 1 addition & 1 deletion vendor-bin/phpunit/composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"require": {
"php": "^7.4.15 || ^8.0.2",
"phpunit/phpunit": "^9.5.12"
"phpunit/phpunit": "^9.6.3 || ^10.0.12"
},
"config": {
"preferred-install": "dist"
Expand Down

0 comments on commit 37533bb

Please sign in to comment.