Allow PHP 8 and fix a test

This commit is contained in:
Toby Zerner 2021-01-16 17:59:10 +10:30
parent 5de690956f
commit 9755994539
4 changed files with 11 additions and 5 deletions

View File

@ -2,7 +2,7 @@
"name": "tobyz/json-api-server", "name": "tobyz/json-api-server",
"description": "A fully automated JSON:API server implementation in PHP.", "description": "A fully automated JSON:API server implementation in PHP.",
"require": { "require": {
"php": "^7.2", "php": "^7.2|^8.0",
"doctrine/inflector": "^1.3", "doctrine/inflector": "^1.3",
"json-api-php/json-api": "^2.2", "json-api-php/json-api": "^2.2",
"nyholm/psr7": "^1.3", "nyholm/psr7": "^1.3",
@ -31,9 +31,10 @@
} }
}, },
"require-dev": { "require-dev": {
"dms/phpunit-arraysubset-asserts": "^0.1.0", "dms/phpunit-arraysubset-asserts": "^0.2",
"helmich/phpunit-json-assert": "^3.0", "helmich/phpunit-json-assert": "^3.0",
"phpunit/phpunit": "^8.0" "phpspec/prophecy-phpunit": "^2.0",
"phpunit/phpunit": "^9.0"
}, },
"scripts": { "scripts": {
"test": "phpunit" "test": "phpunit"

View File

@ -249,7 +249,7 @@ class Index
continue; continue;
} }
if (isset($filters[$name]) && evaluate($filters[$name]->getVisible(), [$this->context])) { if (isset($filters[$name]) && evaluate($filters[$name]->getVisible(), [$context])) {
$filters[$name]->getCallback()($query, $value, $context); $filters[$name]->getCallback()($query, $value, $context);
continue; continue;
} }

View File

@ -11,6 +11,7 @@
namespace Tobyz\Tests\JsonApiServer\feature; namespace Tobyz\Tests\JsonApiServer\feature;
use Prophecy\PhpUnit\ProphecyTrait;
use Tobyz\JsonApiServer\Adapter\AdapterInterface; use Tobyz\JsonApiServer\Adapter\AdapterInterface;
use Tobyz\JsonApiServer\Exception\ForbiddenException; use Tobyz\JsonApiServer\Exception\ForbiddenException;
use Tobyz\JsonApiServer\JsonApi; use Tobyz\JsonApiServer\JsonApi;
@ -21,6 +22,8 @@ use Tobyz\Tests\JsonApiServer\MockAdapter;
class CreateTest extends AbstractTestCase class CreateTest extends AbstractTestCase
{ {
use ProphecyTrait;
/** /**
* @var JsonApi * @var JsonApi
*/ */

View File

@ -11,7 +11,7 @@
namespace Tobyz\Tests\JsonApiServer\feature; namespace Tobyz\Tests\JsonApiServer\feature;
use Psr\Http\Message\ServerRequestInterface; use Prophecy\PhpUnit\ProphecyTrait;
use Tobyz\JsonApiServer\Adapter\AdapterInterface; use Tobyz\JsonApiServer\Adapter\AdapterInterface;
use Tobyz\JsonApiServer\Exception\ForbiddenException; use Tobyz\JsonApiServer\Exception\ForbiddenException;
use Tobyz\JsonApiServer\JsonApi; use Tobyz\JsonApiServer\JsonApi;
@ -22,6 +22,8 @@ use Tobyz\Tests\JsonApiServer\MockAdapter;
class DeleteTest extends AbstractTestCase class DeleteTest extends AbstractTestCase
{ {
use ProphecyTrait;
/** /**
* @var JsonApi * @var JsonApi
*/ */