diff --git a/src/Context/FieldResolver.php b/src/Context/FieldResolver.php index edeea5b..de2cb3b 100644 --- a/src/Context/FieldResolver.php +++ b/src/Context/FieldResolver.php @@ -56,7 +56,7 @@ class FieldResolver { * Example: * 'field_author.entity.field_first_name' -> 'author.firstName'. * - * @param string $field_name + * @param string $internal_field_name * The Drupal field name to map to a public field name. * * @return string diff --git a/src/Controller/EntityResource.php b/src/Controller/EntityResource.php index 3536e6c..a3c3b43 100644 --- a/src/Controller/EntityResource.php +++ b/src/Controller/EntityResource.php @@ -614,6 +614,7 @@ class EntityResource { else { $pagination = new OffsetPage(OffsetPage::DEFAULT_OFFSET, OffsetPage::SIZE_MAX); } + // Add one extra element to the page to see if there are more pages needed. $query->range($pagination->offset(), $pagination->size() + 1); $query->addMetaData('pager_size', (int) $pagination->size()); diff --git a/src/Query/EntityCondition.php b/src/Query/EntityCondition.php index d1c2672..88e59a4 100644 --- a/src/Query/EntityCondition.php +++ b/src/Query/EntityCondition.php @@ -2,6 +2,11 @@ namespace Drupal\jsonapi\Query; +/** + * A condition object for the EntityQuery. + * + * @internal + */ class EntityCondition { /** diff --git a/src/Query/EntityConditionGroup.php b/src/Query/EntityConditionGroup.php index 2723565..e7a2db2 100644 --- a/src/Query/EntityConditionGroup.php +++ b/src/Query/EntityConditionGroup.php @@ -2,6 +2,11 @@ namespace Drupal\jsonapi\Query; +/** + * A condition group for the EntityQuery. + * + * @internal + */ class EntityConditionGroup { /** diff --git a/src/Query/Filter.php b/src/Query/Filter.php index 78880f6..925862e 100644 --- a/src/Query/Filter.php +++ b/src/Query/Filter.php @@ -6,6 +6,11 @@ use Drupal\Core\Entity\Query\QueryInterface; use Drupal\jsonapi\Query\EntityCondition; use Drupal\jsonapi\Query\EntityConditionGroup; +/** + * Gathers information about the filter parameter. + * + * @internal + */ class Filter { /** diff --git a/src/Query/Sort.php b/src/Query/Sort.php index da8dd9d..14f9c0d 100644 --- a/src/Query/Sort.php +++ b/src/Query/Sort.php @@ -2,6 +2,11 @@ namespace Drupal\jsonapi\Query; +/** + * Gathers information about the sort parameter. + * + * @internal + */ class Sort { /** diff --git a/tests/src/Kernel/Context/FieldResolverTest.php b/tests/src/Kernel/Context/FieldResolverTest.php index 932c1aa..30a04a5 100644 --- a/tests/src/Kernel/Context/FieldResolverTest.php +++ b/tests/src/Kernel/Context/FieldResolverTest.php @@ -171,10 +171,9 @@ class FieldResolverTest extends JsonapiKernelTestBase { * Expects an error when an invalid field is provided. * * @covers ::resolveInternal - * - * @expectedException \Symfony\Component\HttpKernel\Exception\BadRequestHttpException */ public function testResolveInternalError() { + $this->expectException(BadRequestHttpException::class); $original = 'host.fail!!.deep'; $not_expected = 'host.entity.fail!!.entity.deep'; diff --git a/tests/src/Unit/LinkManager/LinkManagerTest.php b/tests/src/Unit/LinkManager/LinkManagerTest.php index a9503a9..2a43b52 100644 --- a/tests/src/Unit/LinkManager/LinkManagerTest.php +++ b/tests/src/Unit/LinkManager/LinkManagerTest.php @@ -11,6 +11,7 @@ use Symfony\Cmf\Component\Routing\ChainRouterInterface; use Symfony\Cmf\Component\Routing\RouteObjectInterface; use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; /** * @coversDefaultClass \Drupal\jsonapi\LinkManager\LinkManager @@ -134,10 +135,10 @@ class LinkManagerTest extends UnitTestCase { * Test errors. * * @covers ::getPagerLinks - * @expectedException \Symfony\Component\HttpKernel\Exception\BadRequestHttpException * @dataProvider getPagerLinksErrorProvider */ public function testGetPagerLinksError($offset, $size, $has_next_page, $total, $include_count, array $pages) { + $this->expectException(BadRequestHttpException::class); $this->testGetPagerLinks($offset, $size, $has_next_page, $total, $include_count, $pages); }