Skip to content

Commit

Permalink
Merge pull request #71 from Art4/phpunit-10
Browse files Browse the repository at this point in the history
Update to PHPUnit 10
  • Loading branch information
Art4 committed Oct 13, 2023
2 parents fddfbad + 23e3043 commit f5cc92c
Show file tree
Hide file tree
Showing 42 changed files with 86 additions and 108 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.idea
.php-cs-fixer.cache
.phpunit.result.cache
.phpunit.cache
composer.phar
composer.lock
php-cs-fixer.phar
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.2",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^9"
"phpunit/phpunit": "^9 || ^10"
},
"autoload": {
"psr-4": {
Expand All @@ -31,6 +31,7 @@
}
},
"scripts": {
"coverage": "phpunit --coverage-html=\".phpunit.cache/code-coverage\"",
"phpstan": "phpstan analyze --memory-limit 512M --configuration .phpstan.neon",
"phpunit": "phpunit"
},
Expand Down
25 changes: 19 additions & 6 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" stopOnError="false" stopOnIncomplete="false" stopOnSkipped="false" bootstrap="vendor/autoload.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory suffix=".php">src/</directory>
</include>
</coverage>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.4/phpunit.xsd"
bootstrap="vendor/autoload.php"
cacheDirectory=".phpunit.cache"
colors="true"
beStrictAboutOutputDuringTests="true"
displayDetailsOnIncompleteTests="true"
displayDetailsOnSkippedTests="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnTestsThatTriggerErrors="true"
displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnTestsThatTriggerWarnings="true"
>
<coverage/>
<testsuites>
<testsuite name="all">
<directory suffix="Test.php">tests/Unit/</directory>
Expand All @@ -18,4 +26,9 @@
<directory suffix="Test.php">tests/Functional/</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">src/</directory>
</include>
</source>
</phpunit>
2 changes: 1 addition & 1 deletion tests/BC/AccessableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
namespace Art4\JsonApiClient\Tests\BC;

use Art4\JsonApiClient\Accessable;
use Art4\JsonApiClient\Tests\Fixtures\TestCase;
use PHPUnit\Framework\TestCase;

class AccessableTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/BC/ElementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
use Art4\JsonApiClient\Accessable;
use Art4\JsonApiClient\Element;
use Art4\JsonApiClient\Manager;
use Art4\JsonApiClient\Tests\Fixtures\TestCase;
use PHPUnit\Framework\TestCase;

class ElementTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/BC/Exception/ExceptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
namespace Art4\JsonApiClient\Tests\BC\Exception;

use Art4\JsonApiClient\Exception\Exception;
use Art4\JsonApiClient\Tests\Fixtures\TestCase;
use PHPUnit\Framework\TestCase;

class ExceptionTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/BC/FactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
namespace Art4\JsonApiClient\Tests\BC;

use Art4\JsonApiClient\Factory;
use Art4\JsonApiClient\Tests\Fixtures\TestCase;
use PHPUnit\Framework\TestCase;

class FactoryTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/BC/Input/InputTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
namespace Art4\JsonApiClient\Tests\BC\Input;

use Art4\JsonApiClient\Input\Input;
use Art4\JsonApiClient\Tests\Fixtures\TestCase;
use PHPUnit\Framework\TestCase;

class InputTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/BC/Input/RequestInputTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
namespace Art4\JsonApiClient\Tests\BC\Input;

use Art4\JsonApiClient\Input\RequestInput;
use Art4\JsonApiClient\Tests\Fixtures\TestCase;
use PHPUnit\Framework\TestCase;

class RequestInputTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/BC/ManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

use Art4\JsonApiClient\Input\Input;
use Art4\JsonApiClient\Manager;
use Art4\JsonApiClient\Tests\Fixtures\TestCase;
use PHPUnit\Framework\TestCase;

class ManagerTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/BC/Serializer/SerializerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

use Art4\JsonApiClient\Accessable;
use Art4\JsonApiClient\Serializer\Serializer;
use Art4\JsonApiClient\Tests\Fixtures\TestCase;
use PHPUnit\Framework\TestCase;

class SerializerTest extends TestCase
{
Expand Down
31 changes: 19 additions & 12 deletions tests/Fixtures/HelperTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

namespace Art4\JsonApiClient\Tests\Fixtures;

use Art4\JsonApiClient\Accessable;
use Art4\JsonApiClient\Factory;
use Art4\JsonApiClient\Manager;
use Art4\JsonApiClient\Tests\Fixtures\Factory as FixtureFactory;
Expand All @@ -28,12 +29,18 @@
*/
trait HelperTrait
{
protected Manager $manager;

protected Factory $factory;

protected Accessable $parent;

/**
* Json Values Provider
*
* @see http://json.org/
*/
public function jsonValuesProvider()
public static function jsonValuesProvider(): array
{
return [
[new \stdClass()],
Expand All @@ -53,9 +60,9 @@ public function jsonValuesProvider()
*
* @see http://json.org/
*/
public function jsonValuesProviderWithoutObject()
public static function jsonValuesProviderWithoutObject(): array
{
$data = $this->jsonValuesProvider();
$data = static::jsonValuesProvider();

unset($data[0]);

Expand All @@ -67,9 +74,9 @@ public function jsonValuesProviderWithoutObject()
*
* @see http://json.org/
*/
public function jsonValuesProviderWithoutArray()
public static function jsonValuesProviderWithoutArray(): array
{
$data = $this->jsonValuesProvider();
$data = static::jsonValuesProvider();

unset($data[1]);

Expand All @@ -81,9 +88,9 @@ public function jsonValuesProviderWithoutArray()
*
* @see http://json.org/
*/
public function jsonValuesProviderWithoutString()
public static function jsonValuesProviderWithoutString(): array
{
$data = $this->jsonValuesProvider();
$data = static::jsonValuesProvider();

unset($data[2]);

Expand All @@ -95,9 +102,9 @@ public function jsonValuesProviderWithoutString()
*
* @see http://json.org/
*/
public function jsonValuesProviderWithoutObjectAndString()
public static function jsonValuesProviderWithoutObjectAndString(): array
{
$data = $this->jsonValuesProvider();
$data = static::jsonValuesProvider();

unset($data[0]);
unset($data[2]);
Expand All @@ -110,7 +117,7 @@ public function jsonValuesProviderWithoutObjectAndString()
*
* @see http://json.org/
*/
public function jsonValuesAsStringProvider()
public static function jsonValuesAsStringProvider(): array
{
return [
['{}'],
Expand All @@ -130,9 +137,9 @@ public function jsonValuesAsStringProvider()
*
* @see http://json.org/
*/
public function jsonValuesAsStringProviderWithoutObject()
public static function jsonValuesAsStringProviderWithoutObject(): array
{
$data = $this->jsonValuesAsStringProvider();
$data = static::jsonValuesAsStringProvider();

unset($data[0]);

Expand Down
45 changes: 0 additions & 45 deletions tests/Fixtures/TestCase.php

This file was deleted.

3 changes: 2 additions & 1 deletion tests/Functional/DotNotationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
use Art4\JsonApiClient\Manager\ErrorAbortManager;
use Art4\JsonApiClient\Tests\Fixtures\HelperTrait;
use Art4\JsonApiClient\V1\Factory;
use PHPUnit\Framework\TestCase;

class DotNotationTest extends \Art4\JsonApiClient\Tests\Fixtures\TestCase
class DotNotationTest extends TestCase
{
use HelperTrait;

Expand Down
3 changes: 2 additions & 1 deletion tests/Functional/ErrorParsingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@

use Art4\JsonApiClient\Helper\Parser;
use Art4\JsonApiClient\Tests\Fixtures\HelperTrait;
use PHPUnit\Framework\TestCase;

class ErrorParsingTest extends \Art4\JsonApiClient\Tests\Fixtures\TestCase
class ErrorParsingTest extends TestCase
{
use HelperTrait;

Expand Down
6 changes: 3 additions & 3 deletions tests/Functional/ParsingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@
use Art4\JsonApiClient\Helper\Parser;
use Art4\JsonApiClient\Input\ResponseStringInput;
use Art4\JsonApiClient\Manager\ErrorAbortManager;
use Art4\JsonApiClient\Serializer\ArraySerializer;
use Art4\JsonApiClient\Tests\Fixtures\HelperTrait;
use Art4\JsonApiClient\V1\Factory;
use PHPUnit\Framework\TestCase;

class ParsingTest extends \Art4\JsonApiClient\Tests\Fixtures\TestCase
class ParsingTest extends TestCase
{
use HelperTrait;

/**
* Provide Parser
*/
public function createParserProvider()
public static function createParserProvider(): array
{
$errorAbortManagerParser = function ($string) {
$manager = new ErrorAbortManager(new Factory());
Expand Down
4 changes: 2 additions & 2 deletions tests/Functional/SerializerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
use Art4\JsonApiClient\Manager\ErrorAbortManager;
use Art4\JsonApiClient\Serializer\ArraySerializer;
use Art4\JsonApiClient\Tests\Fixtures\HelperTrait;
use Art4\JsonApiClient\Tests\Fixtures\TestCase;
use Art4\JsonApiClient\V1\Factory;
use PHPUnit\Framework\TestCase;

class SerializerTest extends TestCase
{
Expand All @@ -34,7 +34,7 @@ class SerializerTest extends TestCase
/**
* Provide JSON API data
*/
public function jsonapiDataProvider()
public static function jsonapiDataProvider(): array
{
$path = str_replace('/', \DIRECTORY_SEPARATOR, __DIR__ . '/../files/');
$files = [];
Expand Down
3 changes: 1 addition & 2 deletions tests/Unit/Helper/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@
namespace Art4\JsonApiClient\Tests\Unit\Helper;

use Art4\JsonApiClient\Exception\InputException;
use Art4\JsonApiClient\Exception\ValidationException;
use Art4\JsonApiClient\Helper\Parser;
use Art4\JsonApiClient\Tests\Fixtures\TestCase;
use Art4\JsonApiClient\V1\Document;
use PHPUnit\Framework\TestCase;

class ParserTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Input/RequestStringInputTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
use Art4\JsonApiClient\Exception\InputException;
use Art4\JsonApiClient\Input\RequestStringInput;
use Art4\JsonApiClient\Tests\Fixtures\HelperTrait;
use Art4\JsonApiClient\Tests\Fixtures\TestCase;
use PHPUnit\Framework\TestCase;

class RequestStringInputTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Input/ResponseStringInputTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
use Art4\JsonApiClient\Exception\InputException;
use Art4\JsonApiClient\Input\ResponseStringInput;
use Art4\JsonApiClient\Tests\Fixtures\HelperTrait;
use Art4\JsonApiClient\Tests\Fixtures\TestCase;
use PHPUnit\Framework\TestCase;

class ResponseStringInputTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Manager/ErrorAbortManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

use Art4\JsonApiClient\Factory;
use Art4\JsonApiClient\Manager\ErrorAbortManager;
use Art4\JsonApiClient\Tests\Fixtures\TestCase;
use PHPUnit\Framework\TestCase;

class ErrorAbortManagerTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Serializer/ArraySerializerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

use Art4\JsonApiClient\Accessable;
use Art4\JsonApiClient\Serializer\ArraySerializer;
use Art4\JsonApiClient\Tests\Fixtures\TestCase;
use PHPUnit\Framework\TestCase;

class ArraySerializerTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/V1/AttributesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
use Art4\JsonApiClient\Exception\AccessException;
use Art4\JsonApiClient\Exception\ValidationException;
use Art4\JsonApiClient\Tests\Fixtures\HelperTrait;
use Art4\JsonApiClient\Tests\Fixtures\TestCase;
use Art4\JsonApiClient\V1\Attributes;
use PHPUnit\Framework\TestCase;

class AttributesTest extends TestCase
{
Expand Down
Loading

0 comments on commit f5cc92c

Please sign in to comment.