Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

Bundle/EzPublishRestBundle/Features/Context/SubContext/Views.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Bundle\EzPublishRestBundle\Features\Context\SubContext;
8
9 use eZ\Publish\API\Repository\Values\Content\Query;
10 use eZ\Publish\API\Repository\Values\Content\Query\Criterion;
11 use eZ\Publish\API\Repository\Values\Content\Search\SearchHit;
12 use eZ\Publish\Core\REST\Client\Values\View;
13 use PHPUnit\Framework\Assert as Assertion;
14
18 trait Views
19 {
23 public function theViewContainsSearchHits()
24 {
26 $view = $this->getResponseObject();
27 Assertion::assertGreaterThan(1, count($view->result->searchHits));
28 }
29
33 public function theSearchHitsAreContentObjects()
34 {
36 $searchHits = $this->getResponseObject()->result->searchHits;
37 foreach ($searchHits as $searchHit) {
38 Assertion::assertInstanceOf('eZ\Publish\API\Repository\Values\Content\Content', $searchHit->valueObject);
39 }
40 }
41
45 public function iSetFieldToAQueryObject($field)
46 {
47 $this->requestObject->$field = new Query();
48 }
49
53 public function iSetTheFilterPropertyOfTheQuery($field)
54 {
55 // @todo this could be improved if setFieldToValue used PropertyAccessor.
56 $this->requestObject->contentQuery->$field = new Criterion\ContentTypeIdentifier('folder');
57 }
58 }
eZ\Publish\API\Repository\Values\Content\Query
This class is used to perform a Content query.
Definition: API/Repository/Values/Content/Query.php:15
eZ\Publish\API\Repository\Values\Content\Search\SearchHit
This class represents a SearchHit matching the query.
Definition: API/Repository/Values/Content/Search/SearchHit.php:15
eZ\Publish\Core\REST\Client\Values\View
Definition: Publish/Core/REST/Client/Values/View.php:19
eZ\Bundle\EzPublishRestBundle\Features\Context\SubContext
Definition: Authentication.php:7
eZ\Bundle\EzPublishRestBundle\Features\Context\SubContext\getResponseObject
getResponseObject()
Get the response object (if it's not converted do the conversion also).
Definition: EzRest.php:230
eZ\Publish\API\Repository\Values\Content\Query\Criterion
Definition: API/Repository/Values/Content/Query/Criterion/Ancestor.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.