diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 1ba23a0a..4ac266fb 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,29 +1,13 @@ - - - - ./tests - - - - - ./src - - + + + + ./tests + + + + + ./src + + diff --git a/tests/Api/ProjectsTest.php b/tests/Api/ProjectsTest.php index 7fd019bf..3599bb00 100644 --- a/tests/Api/ProjectsTest.php +++ b/tests/Api/ProjectsTest.php @@ -2082,7 +2082,7 @@ protected function getMultipleProjectsDataWithNamespace() ]; } - public function possibleAccessLevels() + public static function possibleAccessLevels(): array { return [ [10], diff --git a/tests/Api/RepositoriesTest.php b/tests/Api/RepositoriesTest.php index 54cf1c5e..bb3075e2 100644 --- a/tests/Api/RepositoriesTest.php +++ b/tests/Api/RepositoriesTest.php @@ -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' => [ diff --git a/tests/Api/TagsTest.php b/tests/Api/TagsTest.php index 25946aeb..a13730d4 100644 --- a/tests/Api/TagsTest.php +++ b/tests/Api/TagsTest.php @@ -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 [ [ diff --git a/tests/Api/TestCase.php b/tests/Api/TestCase.php index 59bc8fb2..7234af3c 100644 --- a/tests/Api/TestCase.php +++ b/tests/Api/TestCase.php @@ -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()) @@ -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(); } diff --git a/tests/Api/UsersTest.php b/tests/Api/UsersTest.php index 04f3e1d6..18635737 100644 --- a/tests/Api/UsersTest.php +++ b/tests/Api/UsersTest.php @@ -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], diff --git a/tests/HttpClient/Util/QueryStringBuilderTest.php b/tests/HttpClient/Util/QueryStringBuilderTest.php index df3326ee..ddcc5cb0 100644 --- a/tests/HttpClient/Util/QueryStringBuilderTest.php +++ b/tests/HttpClient/Util/QueryStringBuilderTest.php @@ -14,6 +14,7 @@ namespace Gitlab\Tests\HttpClient\Util; +use Generator; use Gitlab\HttpClient\Util\QueryStringBuilder; use PHPUnit\Framework\TestCase; @@ -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' => [ [ diff --git a/vendor-bin/phpunit/composer.json b/vendor-bin/phpunit/composer.json index c8a184d5..59819b44 100644 --- a/vendor-bin/phpunit/composer.json +++ b/vendor-bin/phpunit/composer.json @@ -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"