-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! IBX-6773: Bookmarks for non-accessible contents cause exceptio…
…n: Added filter query test
- Loading branch information
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
...rsistence/Legacy/Tests/Filter/CriterionQueryBuilder/Location/BookmarkQueryBuilderTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace eZ\Publish\Core\Persistence\Legacy\Tests\Filter\CriterionQueryBuilder\Location; | ||
|
||
use eZ\Publish\API\Repository\Values\Content\Query\Criterion; | ||
use eZ\Publish\Core\Persistence\Legacy\Filter\CriterionQueryBuilder\Location\BookmarkQueryBuilder; | ||
use eZ\Publish\Core\Persistence\Legacy\Tests\Filter\BaseCriterionVisitorQueryBuilderTestCase; | ||
|
||
/** | ||
* @covers \eZ\Publish\Core\Persistence\Legacy\Filter\CriterionQueryBuilder\Location\BookmarkQueryBuilder::buildQueryConstraint | ||
* @covers \eZ\Publish\Core\Persistence\Legacy\Filter\CriterionQueryBuilder\Location\BookmarkQueryBuilder::accepts | ||
*/ | ||
final class BookmarkQueryBuilderTest extends BaseCriterionVisitorQueryBuilderTestCase | ||
{ | ||
public function getFilteringCriteriaQueryData(): iterable | ||
{ | ||
yield 'Bookmarks locations for user_id=14' => [ | ||
new Criterion\Bookmark(14), | ||
'bookmark.user_id = :dcValue1', | ||
['dcValue1' => 14], | ||
]; | ||
|
||
yield 'Bookmarks locations for user_id=14 OR user_id=7' => [ | ||
new Criterion\LogicalOr( | ||
[ | ||
new Criterion\Bookmark(14), | ||
new Criterion\Bookmark(7), | ||
] | ||
), | ||
'(bookmark.user_id = :dcValue1) OR (bookmark.user_id = :dcValue2)', | ||
['dcValue1' => 14, 'dcValue2' => 7], | ||
]; | ||
} | ||
|
||
protected function getCriterionQueryBuilders(): iterable | ||
{ | ||
return [new BookmarkQueryBuilder()]; | ||
} | ||
} |