diff --git a/composer.json b/composer.json index 42d22ee..5191058 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "tobyz/json-api-server", "description": "A fully automated JSON:API server implementation in PHP.", "require": { - "php": "^7.2", + "php": "^7.2|^8.0", "doctrine/inflector": "^1.3", "json-api-php/json-api": "^2.2", "nyholm/psr7": "^1.3", @@ -31,9 +31,10 @@ } }, "require-dev": { - "dms/phpunit-arraysubset-asserts": "^0.1.0", + "dms/phpunit-arraysubset-asserts": "^0.2", "helmich/phpunit-json-assert": "^3.0", - "phpunit/phpunit": "^8.0" + "phpspec/prophecy-phpunit": "^2.0", + "phpunit/phpunit": "^9.0" }, "scripts": { "test": "phpunit" diff --git a/src/Endpoint/Index.php b/src/Endpoint/Index.php index e4ad427..29ae018 100644 --- a/src/Endpoint/Index.php +++ b/src/Endpoint/Index.php @@ -249,7 +249,7 @@ class Index 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); continue; } diff --git a/tests/feature/CreateTest.php b/tests/feature/CreateTest.php index b70605e..db82dc9 100644 --- a/tests/feature/CreateTest.php +++ b/tests/feature/CreateTest.php @@ -11,6 +11,7 @@ namespace Tobyz\Tests\JsonApiServer\feature; +use Prophecy\PhpUnit\ProphecyTrait; use Tobyz\JsonApiServer\Adapter\AdapterInterface; use Tobyz\JsonApiServer\Exception\ForbiddenException; use Tobyz\JsonApiServer\JsonApi; @@ -21,6 +22,8 @@ use Tobyz\Tests\JsonApiServer\MockAdapter; class CreateTest extends AbstractTestCase { + use ProphecyTrait; + /** * @var JsonApi */ diff --git a/tests/feature/DeleteTest.php b/tests/feature/DeleteTest.php index cef40dd..11bed6c 100644 --- a/tests/feature/DeleteTest.php +++ b/tests/feature/DeleteTest.php @@ -11,7 +11,7 @@ namespace Tobyz\Tests\JsonApiServer\feature; -use Psr\Http\Message\ServerRequestInterface; +use Prophecy\PhpUnit\ProphecyTrait; use Tobyz\JsonApiServer\Adapter\AdapterInterface; use Tobyz\JsonApiServer\Exception\ForbiddenException; use Tobyz\JsonApiServer\JsonApi; @@ -22,6 +22,8 @@ use Tobyz\Tests\JsonApiServer\MockAdapter; class DeleteTest extends AbstractTestCase { + use ProphecyTrait; + /** * @var JsonApi */