|
| 1 | +<?php |
| 2 | + |
| 3 | +/** |
| 4 | + * @copyright Copyright (C) Ibexa AS. All rights reserved. |
| 5 | + * @license For full copyright and license information view LICENSE file distributed with this source code. |
| 6 | + */ |
| 7 | +declare(strict_types=1); |
| 8 | + |
| 9 | +namespace eZ\Publish\Core\Persistence\Legacy\Tests\Filter\CriterionQueryBuilder\Location; |
| 10 | + |
| 11 | +use eZ\Publish\API\Repository\Values\Content\Query\Criterion; |
| 12 | +use eZ\Publish\Core\Persistence\Legacy\Filter\CriterionQueryBuilder\Location\BookmarkQueryBuilder; |
| 13 | +use eZ\Publish\Core\Persistence\Legacy\Tests\Filter\BaseCriterionVisitorQueryBuilderTestCase; |
| 14 | + |
| 15 | +/** |
| 16 | + * @covers \eZ\Publish\Core\Persistence\Legacy\Filter\CriterionQueryBuilder\Location\BookmarkQueryBuilder::buildQueryConstraint |
| 17 | + * @covers \eZ\Publish\Core\Persistence\Legacy\Filter\CriterionQueryBuilder\Location\BookmarkQueryBuilder::accepts |
| 18 | + */ |
| 19 | +final class BookmarkQueryBuilderTest extends BaseCriterionVisitorQueryBuilderTestCase |
| 20 | +{ |
| 21 | + public function getFilteringCriteriaQueryData(): iterable |
| 22 | + { |
| 23 | + yield 'Bookmarks locations for user_id=14' => [ |
| 24 | + new Criterion\Bookmark(14), |
| 25 | + 'bookmark.user_id = :dcValue1', |
| 26 | + ['dcValue1' => 14], |
| 27 | + ]; |
| 28 | + |
| 29 | + yield 'Bookmarks locations for user_id=14 OR user_id=7' => [ |
| 30 | + new Criterion\LogicalOr( |
| 31 | + [ |
| 32 | + new Criterion\Bookmark(14), |
| 33 | + new Criterion\Bookmark(7), |
| 34 | + ] |
| 35 | + ), |
| 36 | + '(bookmark.user_id = :dcValue1) OR (bookmark.user_id = :dcValue2)', |
| 37 | + ['dcValue1' => 14, 'dcValue2' => 7], |
| 38 | + ]; |
| 39 | + } |
| 40 | + |
| 41 | + protected function getCriterionQueryBuilders(): iterable |
| 42 | + { |
| 43 | + return [new BookmarkQueryBuilder()]; |
| 44 | + } |
| 45 | +} |
0 commit comments