From 986b0a464f9c94aa503767148acd953ad6e5e04b Mon Sep 17 00:00:00 2001 From: oskroblin Skroblin Date: Mon, 15 Jan 2024 15:14:56 +0100 Subject: [PATCH] feat: Reorg storage naming --- ...eyValueStorage.php => ArrayKeyStorage.php} | 5 +- ...rrayFilterStorage.php => ArrayStorage.php} | 57 +- src/Common/Aggregation/AggregateStorage.php | 10 - src/Common/Aggregation/Aggregation.php | 8 + src/Common/Aggregation/AggregationAware.php | 21 + .../Aggregation/AggregationCriteria.php | 21 - .../{FilterCriteria.php => Criteria.php} | 12 +- src/Common/Filter/FilterAware.php | 10 + src/Common/Filter/FilterStorage.php | 16 - src/Common/Filter/Paging/Limit.php | 10 + src/Common/Filter/Paging/Page.php | 5 +- .../Filter/{FilterResult.php => Result.php} | 2 +- .../{KeyValueStorage.php => KeyAware.php} | 2 +- src/Common/Schema/Field.php | 5 +- src/Common/Schema/SchemaUtil.php | 9 +- src/Common/Search/InterpretedTerm.php | 8 - src/Common/Search/SearchAware.php | 12 + src/Common/Search/SearchCriteria.php | 32 - src/Common/Search/SearchStorage.php | 12 - src/Common/Search/SearchTerm.php | 2 +- src/Common/Total.php | 10 + ...alueStorage.php => DynamoDBKeyStorage.php} | 5 +- src/Meilisearch/MeilisearchStorage.php | 21 +- ...ValueStorage.php => MongoDBKeyStorage.php} | 5 +- ...DBFilterStorage.php => MongoDBStorage.php} | 27 +- ...eyValueStorage.php => MySQLKeyStorage.php} | 5 +- ...ySQLFilterStorage.php => MySQLStorage.php} | 32 +- ...ilterStorage.php => OpenSearchStorage.php} | 42 +- ...eyValueStorage.php => RedisKeyStorage.php} | 5 +- tests/Array/ArrayFilterStorageTest.php | 11 +- tests/Array/ArrayKeyValueStorageTest.php | 11 +- tests/Common/FilterStorageTestBase.php | 902 +++++++++--------- tests/Common/KeyValueStorageTestBase.php | 5 +- .../DynamoDB/DynamoDBKeyValueStorageTest.php | 11 +- ...chStorage.php => LiveMeilisearchAware.php} | 12 +- tests/Meilisearch/MeilisearchStorageTest.php | 555 +++++------ tests/MongoDB/MongoDBFilterStorageTest.php | 11 +- tests/MongoDB/MongoDBKeyValueStorageTest.php | 11 +- tests/MySQL/MySQLFilterStorageTest.php | 15 +- tests/MySQL/MySQLKeyValueStorageTest.php | 11 +- tests/Opensearch/OpenSearchStorageTest.php | 14 +- ...rStorage.php => OpensearchLiveStorage.php} | 13 +- tests/Redis/RedisKeyValueStorageTest.php | 11 +- 43 files changed, 1014 insertions(+), 990 deletions(-) rename src/Array/{ArrayKeyValueStorage.php => ArrayKeyStorage.php} (88%) rename src/Array/{ArrayFilterStorage.php => ArrayStorage.php} (89%) delete mode 100644 src/Common/Aggregation/AggregateStorage.php create mode 100644 src/Common/Aggregation/Aggregation.php create mode 100644 src/Common/Aggregation/AggregationAware.php delete mode 100644 src/Common/Aggregation/AggregationCriteria.php rename src/Common/Filter/{FilterCriteria.php => Criteria.php} (63%) create mode 100644 src/Common/Filter/FilterAware.php delete mode 100644 src/Common/Filter/FilterStorage.php create mode 100644 src/Common/Filter/Paging/Limit.php rename src/Common/Filter/{FilterResult.php => Result.php} (86%) rename src/Common/KeyValue/{KeyValueStorage.php => KeyAware.php} (91%) delete mode 100644 src/Common/Search/InterpretedTerm.php create mode 100644 src/Common/Search/SearchAware.php delete mode 100644 src/Common/Search/SearchCriteria.php delete mode 100644 src/Common/Search/SearchStorage.php create mode 100644 src/Common/Total.php rename src/DynamoDB/{DynamoDBKeyValueStorage.php => DynamoDBKeyStorage.php} (96%) rename src/MongoDB/{MongoDBKeyValueStorage.php => MongoDBKeyStorage.php} (95%) rename src/MongoDB/{MongoDBFilterStorage.php => MongoDBStorage.php} (92%) rename src/MySQL/{MySQLKeyValueStorage.php => MySQLKeyStorage.php} (95%) rename src/MySQL/{MySQLFilterStorage.php => MySQLStorage.php} (94%) rename src/Opensearch/{OpenSearchFilterStorage.php => OpenSearchStorage.php} (93%) rename src/Redis/{RedisKeyValueStorage.php => RedisKeyStorage.php} (93%) rename tests/Meilisearch/{LiveMeilisearchStorage.php => LiveMeilisearchAware.php} (75%) rename tests/Opensearch/{OpensearchLiveFilterStorage.php => OpensearchLiveStorage.php} (70%) diff --git a/src/Array/ArrayKeyValueStorage.php b/src/Array/ArrayKeyStorage.php similarity index 88% rename from src/Array/ArrayKeyValueStorage.php rename to src/Array/ArrayKeyStorage.php index 12e7316..e33b5ed 100644 --- a/src/Array/ArrayKeyValueStorage.php +++ b/src/Array/ArrayKeyStorage.php @@ -4,9 +4,10 @@ use Shopware\Storage\Common\Document\Document; use Shopware\Storage\Common\Document\Documents; -use Shopware\Storage\Common\KeyValue\KeyValueStorage; +use Shopware\Storage\Common\KeyValue\KeyAware; +use Shopware\Storage\Common\Storage; -class ArrayKeyValueStorage implements KeyValueStorage +class ArrayKeyStorage implements KeyAware, Storage { /** * @var array diff --git a/src/Array/ArrayFilterStorage.php b/src/Array/ArrayStorage.php similarity index 89% rename from src/Array/ArrayFilterStorage.php rename to src/Array/ArrayStorage.php index a01d5ef..7d619cd 100644 --- a/src/Array/ArrayFilterStorage.php +++ b/src/Array/ArrayStorage.php @@ -4,9 +4,10 @@ use Shopware\Storage\Common\Document\Document; use Shopware\Storage\Common\Document\Documents; -use Shopware\Storage\Common\Filter\FilterStorage; -use Shopware\Storage\Common\Filter\FilterCriteria; -use Shopware\Storage\Common\Filter\FilterResult; +use Shopware\Storage\Common\Filter\FilterAware; +use Shopware\Storage\Common\Filter\Criteria; +use Shopware\Storage\Common\Filter\Paging\Limit; +use Shopware\Storage\Common\Filter\Result; use Shopware\Storage\Common\Filter\Operator\AndOperator; use Shopware\Storage\Common\Filter\Operator\NandOperator; use Shopware\Storage\Common\Filter\Operator\NorOperator; @@ -25,12 +26,15 @@ use Shopware\Storage\Common\Filter\Type\Not; use Shopware\Storage\Common\Filter\Type\Prefix; use Shopware\Storage\Common\Filter\Type\Suffix; +use Shopware\Storage\Common\KeyValue\KeyAware; use Shopware\Storage\Common\Schema\FieldType; use Shopware\Storage\Common\Schema\Schema; use Shopware\Storage\Common\Schema\SchemaUtil; +use Shopware\Storage\Common\Storage; use Shopware\Storage\Common\StorageContext; +use Shopware\Storage\Common\Total; -class ArrayFilterStorage implements FilterStorage +class ArrayStorage extends ArrayKeyStorage implements FilterAware { /** * @var array @@ -44,6 +48,26 @@ public function setup(): void $this->storage = []; } + public function get(string $key): ?Document + { + return $this->storage[$key] ?? null; + } + + public function mget(array $keys): Documents + { + $documents = new Documents(); + + foreach ($keys as $key) { + if (!isset($this->storage[$key])) { + continue; + } + + $documents->set($key, $this->storage[$key]); + } + + return $documents; + } + public function remove(array $keys): void { foreach ($keys as $key) { @@ -58,12 +82,12 @@ public function store(Documents $documents): void } } - public function filter(FilterCriteria $criteria, StorageContext $context): FilterResult + public function filter(Criteria $criteria, StorageContext $context): Result { $filtered = $this->storage; - if ($criteria->keys) { - $filtered = array_filter($filtered, fn($key) => in_array($key, $criteria->keys, true), ARRAY_FILTER_USE_KEY); + if ($criteria->primaries) { + $filtered = array_filter($filtered, fn($key) => in_array($key, $criteria->primaries, true), ARRAY_FILTER_USE_KEY); } if ($criteria->filters) { @@ -77,16 +101,21 @@ public function filter(FilterCriteria $criteria, StorageContext $context): Filte $total = count($filtered); if ($criteria->paging instanceof Page) { - $filtered = array_slice($filtered, ($criteria->paging->page - 1) * $criteria->limit); + $filtered = array_slice($filtered, ($criteria->paging->page - 1) * $criteria->paging->limit, $criteria->paging->limit); + } elseif ($criteria->paging instanceof Limit) { + $filtered = array_slice($filtered, 0, $criteria->paging->limit); } - if ($criteria->limit) { - $filtered = array_slice($filtered, 0, $criteria->limit); + switch ($criteria->total) { + case Total::NONE: + $total = null; + break; + case Total::EXACT: + case Total::MORE: + break; } - $total = $criteria->total ? $total : null; - - return new FilterResult(elements: $filtered, total: $total); + return new Result(elements: $filtered, total: $total); } /** @@ -311,7 +340,7 @@ private function resolveAccessor(string $accessor, mixed $value): mixed * @param Document[] $filtered * @return Document[] */ - private function sort(array $filtered, FilterCriteria $criteria, StorageContext $context): array + private function sort(array $filtered, Criteria $criteria, StorageContext $context): array { $filtered = array_values($filtered); diff --git a/src/Common/Aggregation/AggregateStorage.php b/src/Common/Aggregation/AggregateStorage.php deleted file mode 100644 index 4fac191..0000000 --- a/src/Common/Aggregation/AggregateStorage.php +++ /dev/null @@ -1,10 +0,0 @@ - $keys - * @param array $filters - */ - public function __construct( - public ?SearchTerm $term = null, - public array $filters = [], - public array $keys = [] - ) {} -} diff --git a/src/Common/Filter/FilterCriteria.php b/src/Common/Filter/Criteria.php similarity index 63% rename from src/Common/Filter/FilterCriteria.php rename to src/Common/Filter/Criteria.php index d2061ba..8a2e604 100644 --- a/src/Common/Filter/FilterCriteria.php +++ b/src/Common/Filter/Criteria.php @@ -5,19 +5,21 @@ use Shopware\Storage\Common\Filter\Operator\Operator; use Shopware\Storage\Common\Filter\Paging\Paging; use Shopware\Storage\Common\Filter\Type\Filter; +use Shopware\Storage\Common\Search\SearchTerm; +use Shopware\Storage\Common\Total; -class FilterCriteria +class Criteria { /** - * @param array $keys + * @param array $primaries * @param array $sorting * @param array $filters */ public function __construct( + public ?SearchTerm $term = null, public ?Paging $paging = null, - public ?int $limit = null, - public ?array $keys = null, - public bool $total = false, + public ?array $primaries = null, + public Total $total = Total::NONE, public array $sorting = [], public array $filters = [] ) {} diff --git a/src/Common/Filter/FilterAware.php b/src/Common/Filter/FilterAware.php new file mode 100644 index 0000000..0d54cff --- /dev/null +++ b/src/Common/Filter/FilterAware.php @@ -0,0 +1,10 @@ + $keys diff --git a/src/Common/Schema/Field.php b/src/Common/Schema/Field.php index b32244d..9b89fb8 100644 --- a/src/Common/Schema/Field.php +++ b/src/Common/Schema/Field.php @@ -6,12 +6,13 @@ class Field { /** * @param array $fields + * @param array{translated?: bool, searchable?: bool, sortable?: bool, filterable?: bool} $options */ public function __construct( public string $name, public string $type, - public bool $translated = false, - public array $fields = [] + public array $options = [], + public array $fields = [], ) { // map fields to use the field name as array key $this->fields = array_combine( diff --git a/src/Common/Schema/SchemaUtil.php b/src/Common/Schema/SchemaUtil.php index bd457c6..da69d96 100644 --- a/src/Common/Schema/SchemaUtil.php +++ b/src/Common/Schema/SchemaUtil.php @@ -57,7 +57,7 @@ public static function translated(Schema $schema, string $accessor): bool { $schema = self::fieldSchema(schema: $schema, accessor: $accessor); - return $schema->translated; + return $schema->options['translated'] ?? false; } public static function type(Schema $schema, string $accessor): string @@ -72,12 +72,7 @@ public static function fieldSchema(Schema $schema, string $accessor): Field $property = self::property(accessor: $accessor); if ($property === 'key') { - return new Field( - name: 'key', - type: FieldType::STRING, - translated: false, - fields: [], - ); + return new Field(name: 'key', type: FieldType::STRING); } $field = $schema->fields[$property] ?? null; diff --git a/src/Common/Search/InterpretedTerm.php b/src/Common/Search/InterpretedTerm.php deleted file mode 100644 index 35f97c7..0000000 --- a/src/Common/Search/InterpretedTerm.php +++ /dev/null @@ -1,8 +0,0 @@ -|null - */ - public ?array $keys = null, - public bool $total = false, - /** - * @var Sorting[] - */ - public array $sorting = [], - /** - * @var array - */ - public array $filters = [] - ) {} -} diff --git a/src/Common/Search/SearchStorage.php b/src/Common/Search/SearchStorage.php deleted file mode 100644 index 0c9f6b8..0000000 --- a/src/Common/Search/SearchStorage.php +++ /dev/null @@ -1,12 +0,0 @@ -paging instanceof Page) { $params['page'] = $criteria->paging->page; - $params['hitsPerPage'] = $criteria->limit; - } elseif ($criteria->limit !== null) { - $params['limit'] = $criteria->limit; + $params['hitsPerPage'] = $criteria->paging->limit; } $filters = $criteria->filters; - if ($criteria->keys !== null) { - $filters[] = new Any(field: 'key', value: $criteria->keys); + if ($criteria->primaries !== null) { + $filters[] = new Any(field: 'key', value: $criteria->primaries); } if (!empty($filters)) { @@ -72,7 +71,7 @@ public function filter(FilterCriteria $criteria, StorageContext $context): Filte $documents[] = new Document(key: $key, data: $hit); } - return new FilterResult( + return new Result( elements: $documents ); } diff --git a/src/MongoDB/MongoDBKeyValueStorage.php b/src/MongoDB/MongoDBKeyStorage.php similarity index 95% rename from src/MongoDB/MongoDBKeyValueStorage.php rename to src/MongoDB/MongoDBKeyStorage.php index 2cf8bf5..5c6b606 100644 --- a/src/MongoDB/MongoDBKeyValueStorage.php +++ b/src/MongoDB/MongoDBKeyStorage.php @@ -7,9 +7,10 @@ use MongoDB\Collection; use Shopware\Storage\Common\Document\Document; use Shopware\Storage\Common\Document\Documents; -use Shopware\Storage\Common\KeyValue\KeyValueStorage; +use Shopware\Storage\Common\KeyValue\KeyAware; +use Shopware\Storage\Common\Storage; -class MongoDBKeyValueStorage implements KeyValueStorage +class MongoDBKeyStorage implements KeyAware, Storage { public function __construct( private readonly string $database, diff --git a/src/MongoDB/MongoDBFilterStorage.php b/src/MongoDB/MongoDBStorage.php similarity index 92% rename from src/MongoDB/MongoDBFilterStorage.php rename to src/MongoDB/MongoDBStorage.php index b1aedbf..7b134c9 100644 --- a/src/MongoDB/MongoDBFilterStorage.php +++ b/src/MongoDB/MongoDBStorage.php @@ -6,9 +6,10 @@ use MongoDB\Collection; use Shopware\Storage\Common\Document\Document; use Shopware\Storage\Common\Document\Documents; -use Shopware\Storage\Common\Filter\FilterCriteria; -use Shopware\Storage\Common\Filter\FilterResult; -use Shopware\Storage\Common\Filter\FilterStorage; +use Shopware\Storage\Common\Filter\Criteria; +use Shopware\Storage\Common\Filter\Paging\Limit; +use Shopware\Storage\Common\Filter\Result; +use Shopware\Storage\Common\Filter\FilterAware; use Shopware\Storage\Common\Filter\Operator\AndOperator; use Shopware\Storage\Common\Filter\Operator\NandOperator; use Shopware\Storage\Common\Filter\Operator\NorOperator; @@ -30,9 +31,10 @@ use Shopware\Storage\Common\Filter\Type\Suffix; use Shopware\Storage\Common\Schema\Schema; use Shopware\Storage\Common\Schema\SchemaUtil; +use Shopware\Storage\Common\Storage; use Shopware\Storage\Common\StorageContext; -class MongoDBFilterStorage implements FilterStorage +class MongoDBStorage implements Storage, FilterAware { public function __construct( private readonly string $database, @@ -67,18 +69,17 @@ public function store(Documents $documents): void $this->collection()->insertMany(array_values($items)); } - public function filter(FilterCriteria $criteria, StorageContext $context): FilterResult + public function filter(Criteria $criteria, StorageContext $context): Result { $query = []; $options = []; if ($criteria->paging instanceof Page) { - $options['skip'] = ($criteria->paging->page - 1) * $criteria->limit; - } - - if ($criteria->limit) { - $options['limit'] = $criteria->limit; + $options['skip'] = ($criteria->paging->page - 1) * $criteria->paging->limit; + $options['limit'] = $criteria->paging->limit; + } elseif ($criteria->paging instanceof Limit) { + $options['limit'] = $criteria->paging->limit; } if ($criteria->sorting) { @@ -89,8 +90,8 @@ public function filter(FilterCriteria $criteria, StorageContext $context): Filte }, $criteria->sorting); } - if ($criteria->keys) { - $query['_key'] = ['$in' => $criteria->keys]; + if ($criteria->primaries) { + $query['_key'] = ['$in' => $criteria->primaries]; } if ($criteria->filters) { $filters = $this->parseFilters($criteria->filters, $context); @@ -127,7 +128,7 @@ public function filter(FilterCriteria $criteria, StorageContext $context): Filte ); } - return new FilterResult($result, null); + return new Result($result, null); } private function collection(): Collection diff --git a/src/MySQL/MySQLKeyValueStorage.php b/src/MySQL/MySQLKeyStorage.php similarity index 95% rename from src/MySQL/MySQLKeyValueStorage.php rename to src/MySQL/MySQLKeyStorage.php index 055d04c..7e7a0b2 100644 --- a/src/MySQL/MySQLKeyValueStorage.php +++ b/src/MySQL/MySQLKeyStorage.php @@ -6,10 +6,11 @@ use Doctrine\DBAL\Connection; use Shopware\Storage\Common\Document\Document; use Shopware\Storage\Common\Document\Documents; -use Shopware\Storage\Common\KeyValue\KeyValueStorage; +use Shopware\Storage\Common\KeyValue\KeyAware; +use Shopware\Storage\Common\Storage; use Shopware\Storage\MySQL\Util\MultiInsert; -class MySQLKeyValueStorage implements KeyValueStorage +class MySQLKeyStorage implements KeyAware, Storage { public function __construct( private readonly Connection $connection, diff --git a/src/MySQL/MySQLFilterStorage.php b/src/MySQL/MySQLStorage.php similarity index 94% rename from src/MySQL/MySQLFilterStorage.php rename to src/MySQL/MySQLStorage.php index 6f306ae..ff78405 100644 --- a/src/MySQL/MySQLFilterStorage.php +++ b/src/MySQL/MySQLStorage.php @@ -7,9 +7,10 @@ use Doctrine\DBAL\Query\QueryBuilder; use Shopware\Storage\Common\Document\Document; use Shopware\Storage\Common\Document\Documents; -use Shopware\Storage\Common\Filter\FilterCriteria; -use Shopware\Storage\Common\Filter\FilterResult; -use Shopware\Storage\Common\Filter\FilterStorage; +use Shopware\Storage\Common\Filter\Criteria; +use Shopware\Storage\Common\Filter\Paging\Limit; +use Shopware\Storage\Common\Filter\Result; +use Shopware\Storage\Common\Filter\FilterAware; use Shopware\Storage\Common\Filter\Operator\AndOperator; use Shopware\Storage\Common\Filter\Operator\NandOperator; use Shopware\Storage\Common\Filter\Operator\NorOperator; @@ -31,11 +32,13 @@ use Shopware\Storage\Common\Schema\FieldType; use Shopware\Storage\Common\Schema\Schema; use Shopware\Storage\Common\Schema\SchemaUtil; +use Shopware\Storage\Common\Storage; use Shopware\Storage\Common\StorageContext; +use Shopware\Storage\Common\Total; use Shopware\Storage\Common\Util\Uuid; use Shopware\Storage\MySQL\Util\MultiInsert; -class MySQLFilterStorage implements FilterStorage +class MySQLStorage implements Storage, FilterAware { public function __construct( private readonly Connection $connection, @@ -71,24 +74,23 @@ public function store(Documents $documents): void $queue->execute(); } - public function filter(FilterCriteria $criteria, StorageContext $context): FilterResult + public function filter(Criteria $criteria, StorageContext $context): Result { $query = $this->connection->createQueryBuilder(); $query->select('root.*'); $query->from($this->schema->source, 'root'); - if ($criteria->limit) { - $query->setMaxResults($criteria->limit); - } - if ($criteria->paging instanceof Page) { - $query->setFirstResult(($criteria->paging->page - 1) * $criteria->limit); + $query->setFirstResult(($criteria->paging->page - 1) * $criteria->paging->limit); + $query->setMaxResults($criteria->paging->limit); + } elseif ($criteria->paging instanceof Limit) { + $query->setMaxResults($criteria->paging->limit); } - if ($criteria->keys) { + if ($criteria->primaries) { $query->andWhere('`key` IN (:keys)'); - $query->setParameter('keys', $criteria->keys, Connection::PARAM_STR_ARRAY); + $query->setParameter('keys', $criteria->primaries, Connection::PARAM_STR_ARRAY); } if ($criteria->sorting) { @@ -111,7 +113,7 @@ public function filter(FilterCriteria $criteria, StorageContext $context): Filte $documents = $this->hydrate($data); - return new FilterResult( + return new Result( elements: $documents, total: $this->getTotal($query, $criteria) ); @@ -264,9 +266,9 @@ private function isJson(string $field): bool return $translated || in_array($type, [FieldType::OBJECT, FieldType::LIST, FieldType::OBJECT_LIST], true); } - private function getTotal(QueryBuilder $query, FilterCriteria $criteria): ?int + private function getTotal(QueryBuilder $query, Criteria $criteria): ?int { - if (!$criteria->total) { + if ($criteria->total === Total::NONE) { return null; } diff --git a/src/Opensearch/OpenSearchFilterStorage.php b/src/Opensearch/OpenSearchStorage.php similarity index 93% rename from src/Opensearch/OpenSearchFilterStorage.php rename to src/Opensearch/OpenSearchStorage.php index 238c10e..735ecf9 100644 --- a/src/Opensearch/OpenSearchFilterStorage.php +++ b/src/Opensearch/OpenSearchStorage.php @@ -15,9 +15,10 @@ use OpenSearchDSL\Sort\FieldSort; use Shopware\Storage\Common\Document\Document; use Shopware\Storage\Common\Document\Documents; -use Shopware\Storage\Common\Filter\FilterCriteria; -use Shopware\Storage\Common\Filter\FilterResult; -use Shopware\Storage\Common\Filter\FilterStorage; +use Shopware\Storage\Common\Filter\Criteria; +use Shopware\Storage\Common\Filter\Paging\Limit; +use Shopware\Storage\Common\Filter\Result; +use Shopware\Storage\Common\Filter\FilterAware; use Shopware\Storage\Common\Filter\Operator\AndOperator; use Shopware\Storage\Common\Filter\Operator\NandOperator; use Shopware\Storage\Common\Filter\Operator\NorOperator; @@ -39,9 +40,11 @@ use Shopware\Storage\Common\Schema\FieldType; use Shopware\Storage\Common\Schema\Schema; use Shopware\Storage\Common\Schema\SchemaUtil; +use Shopware\Storage\Common\Storage; use Shopware\Storage\Common\StorageContext; +use Shopware\Storage\Common\Total; -class OpenSearchFilterStorage implements FilterStorage +class OpenSearchStorage implements Storage, FilterAware { public function __construct(private readonly Client $client, private readonly Schema $schema) {} @@ -90,24 +93,23 @@ public function store(Documents $documents): void } public function filter( - FilterCriteria $criteria, + Criteria $criteria, StorageContext $context - ): FilterResult { + ): Result { $search = new Search(); if ($criteria->paging instanceof Page) { - $search->setFrom(($criteria->paging->page - 1) * $criteria->limit); + $search->setFrom(($criteria->paging->page - 1) * $criteria->paging->limit); + $search->setSize($criteria->paging->limit); + } elseif ($criteria->paging instanceof Limit) { + $search->setSize($criteria->paging->limit); } - if ($criteria->limit) { - $search->setSize($criteria->limit); - } - - if ($criteria->keys) { + if ($criteria->primaries) { $search->addQuery( new TermsQuery( field: '_id', - terms: $criteria->keys + terms: $criteria->primaries ) ); } @@ -135,12 +137,14 @@ public function filter( $parsed = $search->toArray(); - $result = $this->client->search([ + $params = [ 'index' => $this->schema->source, '_source' => true, - 'track_total_hits' => $criteria->total, + 'track_total_hits' => $criteria->total !== Total::NONE, 'body' => $parsed - ]); + ]; + + $result = $this->client->search($params); $documents = []; foreach ($result['hits']['hits'] as $hit) { @@ -150,7 +154,7 @@ public function filter( ); } - return new FilterResult( + return new Result( elements: $documents, total: $this->getTotal($criteria, $result), ); @@ -259,9 +263,9 @@ private function parse(Filter|Operator $filter, StorageContext $context): Builde /** * @param array $result */ - private function getTotal(FilterCriteria $criteria, array $result): int|null + private function getTotal(Criteria $criteria, array $result): int|null { - if (!$criteria->total) { + if ($criteria->total === Total::NONE) { return null; } diff --git a/src/Redis/RedisKeyValueStorage.php b/src/Redis/RedisKeyStorage.php similarity index 93% rename from src/Redis/RedisKeyValueStorage.php rename to src/Redis/RedisKeyStorage.php index 576d3c8..af78dca 100644 --- a/src/Redis/RedisKeyValueStorage.php +++ b/src/Redis/RedisKeyStorage.php @@ -4,9 +4,10 @@ use Shopware\Storage\Common\Document\Document; use Shopware\Storage\Common\Document\Documents; -use Shopware\Storage\Common\KeyValue\KeyValueStorage; +use Shopware\Storage\Common\KeyValue\KeyAware; +use Shopware\Storage\Common\Storage; -class RedisKeyValueStorage implements KeyValueStorage +class RedisKeyStorage implements Storage, KeyAware { public function __construct(private readonly \Redis $client) {} diff --git a/tests/Array/ArrayFilterStorageTest.php b/tests/Array/ArrayFilterStorageTest.php index 717cfd6..cb86505 100644 --- a/tests/Array/ArrayFilterStorageTest.php +++ b/tests/Array/ArrayFilterStorageTest.php @@ -2,17 +2,18 @@ namespace Shopware\StorageTests\Array; -use Shopware\Storage\Array\ArrayFilterStorage; -use Shopware\Storage\Common\Filter\FilterStorage; +use Shopware\Storage\Array\ArrayStorage; +use Shopware\Storage\Common\Filter\FilterAware; +use Shopware\Storage\Common\Storage; use Shopware\StorageTests\Common\FilterStorageTestBase; /** - * @covers \Shopware\Storage\Array\ArrayFilterStorage + * @covers \Shopware\Storage\Array\ArrayStorage */ class ArrayFilterStorageTest extends FilterStorageTestBase { - public function getStorage(): FilterStorage + public function getStorage(): FilterAware&Storage { - return new ArrayFilterStorage(schema: $this->getSchema()); + return new ArrayStorage(schema: $this->getSchema()); } } diff --git a/tests/Array/ArrayKeyValueStorageTest.php b/tests/Array/ArrayKeyValueStorageTest.php index 349098c..218746d 100644 --- a/tests/Array/ArrayKeyValueStorageTest.php +++ b/tests/Array/ArrayKeyValueStorageTest.php @@ -2,17 +2,18 @@ namespace Shopware\StorageTests\Array; -use Shopware\Storage\Array\ArrayKeyValueStorage; -use Shopware\Storage\Common\KeyValue\KeyValueStorage; +use Shopware\Storage\Array\ArrayKeyStorage; +use Shopware\Storage\Common\KeyValue\KeyAware; +use Shopware\Storage\Common\Storage; use Shopware\StorageTests\Common\KeyValueStorageTestBase; /** - * @covers \Shopware\Storage\Array\ArrayKeyValueStorage + * @covers \Shopware\Storage\Array\ArrayKeyStorage */ class ArrayKeyValueStorageTest extends KeyValueStorageTestBase { - public function getStorage(): KeyValueStorage + public function getStorage(): KeyAware&Storage { - return new ArrayKeyValueStorage(); + return new ArrayKeyStorage(); } } diff --git a/tests/Common/FilterStorageTestBase.php b/tests/Common/FilterStorageTestBase.php index 79f21ee..2baecd8 100644 --- a/tests/Common/FilterStorageTestBase.php +++ b/tests/Common/FilterStorageTestBase.php @@ -7,9 +7,9 @@ use Shopware\Storage\Common\Document\Document; use Shopware\Storage\Common\Document\Documents; use Shopware\Storage\Common\Exception\NotSupportedByEngine; -use Shopware\Storage\Common\Filter\FilterCriteria; -use Shopware\Storage\Common\Filter\FilterResult; -use Shopware\Storage\Common\Filter\FilterStorage; +use Shopware\Storage\Common\Filter\Criteria; +use Shopware\Storage\Common\Filter\Result; +use Shopware\Storage\Common\Filter\FilterAware; use Shopware\Storage\Common\Filter\Paging\Page; use Shopware\Storage\Common\Filter\Type\Any; use Shopware\Storage\Common\Filter\Type\Contains; @@ -25,16 +25,17 @@ use Shopware\Storage\Common\Schema\Field; use Shopware\Storage\Common\Schema\FieldType; use Shopware\Storage\Common\Schema\Schema; +use Shopware\Storage\Common\Storage; use Shopware\Storage\Common\StorageContext; abstract class FilterStorageTestBase extends TestCase { public const TEST_STORAGE = 'test_storage'; - abstract public function getStorage(): FilterStorage; + abstract public function getStorage(): FilterAware&Storage; #[DataProvider('storageProvider')] - final public function testStorage(Documents $input, FilterCriteria $criteria, FilterResult $expected): void + final public function testStorage(Documents $input, Criteria $criteria, Result $expected): void { $storage = $this->getStorage(); @@ -52,8 +53,8 @@ final public function testStorage(Documents $input, FilterCriteria $criteria, Fi #[DataProvider('debugProvider')] public function testDebug( Documents $input, - FilterCriteria $criteria, - FilterResult $expected + Criteria $criteria, + Result $expected ): void { $storage = $this->getStorage(); @@ -68,8 +69,8 @@ public static function debugProvider(): \Generator { yield 'Smoke test' => [ 'input' => new Documents(), - 'criteria' => new FilterCriteria(), - 'expected' => new FilterResult([]) + 'criteria' => new Criteria(), + 'expected' => new Result([]) ]; } @@ -86,13 +87,13 @@ final public function testRemove(Documents $input, array $remove, array $expecte $storage->remove($remove); - $criteria = new FilterCriteria( - keys: $input->keys() + $criteria = new Criteria( + primaries: $input->keys() ); $loaded = $storage->filter($criteria, new StorageContext(languages: ['en', 'de'])); - $expected = new FilterResult($expected); + $expected = new Result($expected); static::assertEquals($expected, $loaded); } @@ -144,44 +145,44 @@ final protected function getSchema(): Schema new Field('dateField', FieldType::DATETIME), new Field('listField', FieldType::LIST), - new Field('translatedString', FieldType::STRING, translated: true), - new Field('translatedText', FieldType::TEXT, translated: true), - new Field('translatedInt', FieldType::INT, translated: true), - new Field('translatedFloat', FieldType::FLOAT, translated: true), - new Field('translatedBool', FieldType::BOOL, translated: true), - new Field('translatedDate', FieldType::DATETIME, translated: true), - new Field('translatedList', FieldType::LIST, translated: true), + new Field('translatedString', FieldType::STRING, ['translated' => true]), + new Field('translatedText', FieldType::TEXT, ['translated' => true]), + new Field('translatedInt', FieldType::INT, ['translated' => true]), + new Field('translatedFloat', FieldType::FLOAT, ['translated' => true]), + new Field('translatedBool', FieldType::BOOL, ['translated' => true]), + new Field('translatedDate', FieldType::DATETIME, ['translated' => true]), + new Field('translatedList', FieldType::LIST, ['translated' => true]), - new Field('objectField', FieldType::OBJECT, false, [ + new Field('objectField', FieldType::OBJECT, [], [ new Field('foo', FieldType::STRING), new Field('fooInt', FieldType::INT), new Field('fooFloat', FieldType::FLOAT), new Field('fooBool', FieldType::BOOL), new Field('fooDate', FieldType::DATETIME), - new Field('translatedFoo', FieldType::STRING, translated: true), - new Field('translatedFooInt', FieldType::INT, translated: true), - new Field('translatedFooFloat', FieldType::FLOAT, translated: true), - new Field('translatedFooBool', FieldType::BOOL, translated: true), - new Field('translatedFooDate', FieldType::DATETIME, translated: true), - new Field('fooObj', FieldType::OBJECT, false, [ + new Field('translatedFoo', FieldType::STRING, ['translated' => true]), + new Field('translatedFooInt', FieldType::INT, ['translated' => true]), + new Field('translatedFooFloat', FieldType::FLOAT, ['translated' => true]), + new Field('translatedFooBool', FieldType::BOOL, ['translated' => true]), + new Field('translatedFooDate', FieldType::DATETIME, ['translated' => true]), + new Field('fooObj', FieldType::OBJECT, [], [ new Field('bar', FieldType::STRING), ]), ]), - new Field('objectListField', FieldType::OBJECT_LIST, false, [ + new Field('objectListField', FieldType::OBJECT_LIST, [], [ new Field('foo', FieldType::STRING), new Field('fooInt', FieldType::INT), new Field('fooFloat', FieldType::FLOAT), new Field('fooBool', FieldType::BOOL), new Field('fooDate', FieldType::DATETIME), - new Field('translatedFoo', FieldType::STRING, translated: true), - new Field('translatedFooInt', FieldType::INT, translated: true), - new Field('translatedFooFloat', FieldType::FLOAT, translated: true), - new Field('translatedFooBool', FieldType::BOOL, translated: true), - new Field('translatedFooDate', FieldType::DATETIME, translated: true), - new Field('fooObj', FieldType::OBJECT, false, [ + new Field('translatedFoo', FieldType::STRING, ['translated' => true]), + new Field('translatedFooInt', FieldType::INT, ['translated' => true]), + new Field('translatedFooFloat', FieldType::FLOAT, ['translated' => true]), + new Field('translatedFooBool', FieldType::BOOL, ['translated' => true]), + new Field('translatedFooDate', FieldType::DATETIME, ['translated' => true]), + new Field('fooObj', FieldType::OBJECT, [], [ new Field('bar', FieldType::STRING), - new Field('translatedBar', FieldType::STRING, translated: true), + new Field('translatedBar', FieldType::STRING, ['translated' => true]), ]), ]), ] @@ -192,8 +193,8 @@ final public static function storageProvider(): \Generator { yield 'Smoke test' => [ 'input' => new Documents(), - 'criteria' => new FilterCriteria(), - 'expected' => new FilterResult([]) + 'criteria' => new Criteria(), + 'expected' => new Result([]) ]; yield 'Test keys and values' => [ 'input' => new Documents([ @@ -201,10 +202,10 @@ final public static function storageProvider(): \Generator self::Document(key: 'key2'), self::Document(key: 'key3'), ]), - 'criteria' => new FilterCriteria( - keys: ['key1', 'key2'] + 'criteria' => new Criteria( + primaries: ['key1', 'key2'] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1'), self::document(key: 'key2'), ]) @@ -217,11 +218,10 @@ final public static function storageProvider(): \Generator self::document(key: 'key4'), self::document(key: 'key5'), ]), - 'criteria' => new FilterCriteria( - paging: new Page(2), - limit: 2 + 'criteria' => new Criteria( + paging: new Page(page: 2, limit: 2) ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key3'), self::document(key: 'key4'), ]) @@ -233,12 +233,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', stringField: 'bar'), self::document(key: 'key3', stringField: 'foo'), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'stringField', value: 'foo') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', stringField: 'foo'), self::document(key: 'key3', stringField: 'foo'), ]) @@ -249,12 +249,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', stringField: 'bar'), self::document(key: 'key3', stringField: 'baz'), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'stringField', value: ['foo', 'bar']) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', stringField: 'foo'), self::document(key: 'key2', stringField: 'bar'), ]) @@ -265,12 +265,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', stringField: 'bar'), self::document(key: 'key3', stringField: 'baz'), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'stringField', value: 'foo') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', stringField: 'bar'), self::document(key: 'key3', stringField: 'baz'), ]) @@ -281,12 +281,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', stringField: 'bar'), self::document(key: 'key3', stringField: 'baz'), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Neither(field: 'stringField', value: ['foo', 'bar']) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key3', stringField: 'baz'), ]) ]; @@ -296,12 +296,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', stringField: 'bar'), self::document(key: 'key3', stringField: 'baz'), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Contains(field: 'stringField', value: 'ba') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', stringField: 'bar'), self::document(key: 'key3', stringField: 'baz'), ]) @@ -312,12 +312,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', stringField: 'bar'), self::document(key: 'key3', stringField: 'baz'), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Prefix(field: 'stringField', value: 'ba') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', stringField: 'bar'), self::document(key: 'key3', stringField: 'baz'), ]) @@ -328,12 +328,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', stringField: 'bar'), self::document(key: 'key3', stringField: 'foo-bar'), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Suffix(field: 'stringField', value: 'bar') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', stringField: 'bar'), self::document(key: 'key3', stringField: 'foo-bar'), ]) @@ -344,12 +344,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', stringField: 'b'), self::document(key: 'key3', stringField: 'c'), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gte(field: 'stringField', value: 'b') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', stringField: 'b'), self::document(key: 'key3', stringField: 'c'), ]) @@ -360,12 +360,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', stringField: 'b'), self::document(key: 'key3', stringField: 'c'), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lte(field: 'stringField', value: 'b') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', stringField: 'a'), self::document(key: 'key2', stringField: 'b'), ]) @@ -376,12 +376,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', stringField: 'b'), self::document(key: 'key3', stringField: 'c'), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gt(field: 'stringField', value: 'b') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key3', stringField: 'c'), ]) ]; @@ -391,12 +391,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', stringField: 'b'), self::document(key: 'key3', stringField: 'c'), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lt(field: 'stringField', value: 'b') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', stringField: 'a'), ]) ]; @@ -407,13 +407,13 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', stringField: 'c'), self::document(key: 'key4', stringField: 'd'), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gte(field: 'stringField', value: 'b'), new Lte(field: 'stringField', value: 'c'), ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', stringField: 'b'), self::document(key: 'key3', stringField: 'c'), ]) @@ -424,12 +424,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', stringField: 'bar'), self::document(key: 'key3', stringField: null), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'stringField', value: null) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key3', stringField: null) ]) ]; @@ -439,12 +439,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', stringField: 'bar'), self::document(key: 'key3', stringField: null), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'stringField', value: null) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document('key1', stringField: 'foo'), self::document('key2', stringField: 'bar') ]) @@ -456,12 +456,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', textField: 'bar'), self::document(key: 'key3', textField: 'foo'), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'textField', value: 'foo') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', textField: 'foo'), self::document(key: 'key3', textField: 'foo'), ]) @@ -472,12 +472,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', textField: 'bar'), self::document(key: 'key3', textField: 'baz'), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'textField', value: ['foo', 'bar']) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', textField: 'foo'), self::document(key: 'key2', textField: 'bar'), ]) @@ -488,12 +488,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', textField: 'bar'), self::document(key: 'key3', textField: 'baz'), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'textField', value: 'foo') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', textField: 'bar'), self::document(key: 'key3', textField: 'baz'), ]) @@ -504,12 +504,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', textField: 'bar'), self::document(key: 'key3', textField: 'baz'), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Neither(field: 'textField', value: ['foo', 'bar']) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key3', textField: 'baz'), ]) ]; @@ -519,12 +519,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', textField: 'bar'), self::document(key: 'key3', textField: 'baz'), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Contains(field: 'textField', value: 'ba') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', textField: 'bar'), self::document(key: 'key3', textField: 'baz'), ]) @@ -535,12 +535,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', textField: 'bar'), self::document(key: 'key3', textField: 'baz'), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Prefix(field: 'textField', value: 'ba') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', textField: 'bar'), self::document(key: 'key3', textField: 'baz'), ]) @@ -551,12 +551,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', textField: 'bar'), self::document(key: 'key3', textField: 'foo-bar'), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Suffix(field: 'textField', value: 'bar') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', textField: 'bar'), self::document(key: 'key3', textField: 'foo-bar'), ]) @@ -567,12 +567,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', textField: 'b'), self::document(key: 'key3', textField: 'c'), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gte(field: 'textField', value: 'b') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', textField: 'b'), self::document(key: 'key3', textField: 'c'), ]) @@ -583,12 +583,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', textField: 'b'), self::document(key: 'key3', textField: 'c'), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lte(field: 'textField', value: 'b') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', textField: 'a'), self::document(key: 'key2', textField: 'b'), ]) @@ -599,12 +599,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', textField: 'b'), self::document(key: 'key3', textField: 'c'), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gt(field: 'textField', value: 'b') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key3', textField: 'c'), ]) ]; @@ -614,12 +614,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', textField: 'b'), self::document(key: 'key3', textField: 'c'), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lt(field: 'textField', value: 'b') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', textField: 'a'), ]) ]; @@ -630,13 +630,13 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', textField: 'c'), self::document(key: 'key4', textField: 'd'), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gte(field: 'textField', value: 'b'), new Lte(field: 'textField', value: 'c'), ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', textField: 'b'), self::document(key: 'key3', textField: 'c'), ]) @@ -648,12 +648,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', dateField: '2021-01-02 00:00:00.000'), self::document(key: 'key3', dateField: '2021-01-03 00:00:00.000'), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'dateField', value: '2021-01-02') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', dateField: '2021-01-02 00:00:00.000'), ]) ]; @@ -663,12 +663,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', dateField: '2021-01-02 00:00:00.000'), self::document(key: 'key3', dateField: '2021-01-03 00:00:00.000'), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'dateField', value: ['2021-01-01', '2021-01-02']) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', dateField: '2021-01-01 00:00:00.000'), self::document(key: 'key2', dateField: '2021-01-02 00:00:00.000'), ]) @@ -679,12 +679,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', dateField: '2021-01-02 00:00:00.000'), self::document(key: 'key3', dateField: '2021-01-03 00:00:00.000'), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'dateField', value: '2021-01-02') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', dateField: '2021-01-01 00:00:00.000'), self::document(key: 'key3', dateField: '2021-01-03 00:00:00.000'), ]) @@ -695,12 +695,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', dateField: '2021-01-02 00:00:00.000'), self::document(key: 'key3', dateField: '2021-01-03 00:00:00.000'), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Neither(field: 'dateField', value: ['2021-01-01', '2021-01-02']) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key3', dateField: '2021-01-03 00:00:00.000'), ]) ]; @@ -710,12 +710,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', dateField: '2021-01-02 00:00:00.000'), self::document(key: 'key3', dateField: '2021-01-03 00:00:00.000'), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gte(field: 'dateField', value: '2021-01-02') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', dateField: '2021-01-02 00:00:00.000'), self::document(key: 'key3', dateField: '2021-01-03 00:00:00.000'), ]) @@ -726,12 +726,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', dateField: '2021-01-02 00:00:00.000'), self::document(key: 'key3', dateField: '2021-01-03 00:00:00.000'), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lte(field: 'dateField', value: '2021-01-02') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', dateField: '2021-01-01 00:00:00.000'), self::document(key: 'key2', dateField: '2021-01-02 00:00:00.000'), ]) @@ -742,12 +742,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', dateField: '2021-01-02 00:00:00.000'), self::document(key: 'key3', dateField: '2021-01-03 00:00:00.000'), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gt(field: 'dateField', value: '2021-01-02') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key3', dateField: '2021-01-03 00:00:00.000'), ]) ]; @@ -757,12 +757,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', dateField: '2021-01-02 00:00:00.000'), self::document(key: 'key3', dateField: '2021-01-03 00:00:00.000'), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lt(field: 'dateField', value: '2021-01-02') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', dateField: '2021-01-01 00:00:00.000'), ]) ]; @@ -773,13 +773,13 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', dateField: '2021-01-03 00:00:00.000'), self::document(key: 'key4', dateField: '2021-01-04 00:00:00.000'), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gte(field: 'dateField', value: '2021-01-02'), new Lte(field: 'dateField', value: '2021-01-03'), ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', dateField: '2021-01-02 00:00:00.000'), self::document(key: 'key3', dateField: '2021-01-03 00:00:00.000'), ]) @@ -790,12 +790,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', dateField: '2021-01-02'), self::document(key: 'key3', dateField: null), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'dateField', value: null) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key3', dateField: null) ]) ]; @@ -805,12 +805,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', dateField: '2021-01-02 00:00:00.000'), self::document(key: 'key3', dateField: null), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'dateField', value: null) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document('key1', dateField: '2021-01-01 00:00:00.000'), self::document('key2', dateField: '2021-01-02 00:00:00.000') ]) @@ -822,12 +822,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', intField: 2), self::document(key: 'key3', intField: 3), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'intField', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', intField: 2), ]) ]; @@ -837,12 +837,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', intField: 2), self::document(key: 'key3', intField: 3), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'intField', value: [1, 2]) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', intField: 1), self::document(key: 'key2', intField: 2), ]) @@ -853,12 +853,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', intField: 2), self::document(key: 'key3', intField: 3), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'intField', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', intField: 1), self::document(key: 'key3', intField: 3), ]) @@ -869,12 +869,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', intField: 2), self::document(key: 'key3', intField: 3), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Neither(field: 'intField', value: [1, 2]) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key3', intField: 3), ]) ]; @@ -884,12 +884,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', intField: 2), self::document(key: 'key3', intField: 3), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gte(field: 'intField', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', intField: 2), self::document(key: 'key3', intField: 3), ]) @@ -900,12 +900,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', intField: 2), self::document(key: 'key3', intField: 3), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lte(field: 'intField', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', intField: 1), self::document(key: 'key2', intField: 2), ]) @@ -916,12 +916,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', intField: 2), self::document(key: 'key3', intField: 3), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gt(field: 'intField', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key3', intField: 3), ]) ]; @@ -931,12 +931,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', intField: 2), self::document(key: 'key3', intField: 3), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lt(field: 'intField', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', intField: 1), ]) ]; @@ -947,13 +947,13 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', intField: 3), self::document(key: 'key4', intField: 4), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gte(field: 'intField', value: 2), new Lte(field: 'intField', value: 3), ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', intField: 2), self::document(key: 'key3', intField: 3), ]) @@ -964,12 +964,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', intField: 2), self::document(key: 'key3', intField: null), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'intField', value: null) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key3', intField: null) ]) ]; @@ -979,12 +979,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', intField: 2), self::document(key: 'key3', intField: null), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'intField', value: null) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document('key1', intField: 1), self::document('key2', intField: 2) ]) @@ -996,12 +996,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', floatField: 2.2), self::document(key: 'key3', floatField: 3.3), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'floatField', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', floatField: 2.2), ]) ]; @@ -1011,12 +1011,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', floatField: 2.2), self::document(key: 'key3', floatField: 3.3), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'floatField', value: [1.1, 2.2]) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', floatField: 1.1), self::document(key: 'key2', floatField: 2.2), ]) @@ -1027,12 +1027,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', floatField: 2.2), self::document(key: 'key3', floatField: 3.3), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'floatField', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', floatField: 1.1), self::document(key: 'key3', floatField: 3.3), ]) @@ -1043,12 +1043,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', floatField: 2.2), self::document(key: 'key3', floatField: 3.3), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Neither(field: 'floatField', value: [1.1, 2.2]) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key3', floatField: 3.3), ]) ]; @@ -1058,12 +1058,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', floatField: 2.2), self::document(key: 'key3', floatField: 3.3), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gte(field: 'floatField', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', floatField: 2.2), self::document(key: 'key3', floatField: 3.3), ]) @@ -1074,12 +1074,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', floatField: 2.2), self::document(key: 'key3', floatField: 3.3), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lte(field: 'floatField', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', floatField: 1.1), self::document(key: 'key2', floatField: 2.2), ]) @@ -1090,12 +1090,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', floatField: 2.2), self::document(key: 'key3', floatField: 3.3), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gt(field: 'floatField', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key3', floatField: 3.3), ]) ]; @@ -1105,12 +1105,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', floatField: 2.2), self::document(key: 'key3', floatField: 3.3), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lt(field: 'floatField', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', floatField: 1.1), ]) ]; @@ -1121,13 +1121,13 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', floatField: 3.3), self::document(key: 'key4', floatField: 4.4), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gte(field: 'floatField', value: 2.2), new Lte(field: 'floatField', value: 3.3), ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', floatField: 2.2), self::document(key: 'key3', floatField: 3.3), ]) @@ -1138,12 +1138,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', floatField: 2.2), self::document(key: 'key3', floatField: null), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'floatField', value: null) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key3', floatField: null) ]) ]; @@ -1153,12 +1153,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', floatField: 2.2), self::document(key: 'key3', floatField: null), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'floatField', value: null) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document('key1', floatField: 1.1), self::document('key2', floatField: 2.2) ]) @@ -1170,12 +1170,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', boolField: false), self::document(key: 'key3', boolField: true), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'boolField', value: true) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', boolField: true), self::document(key: 'key3', boolField: true), ]) @@ -1186,12 +1186,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', boolField: false), self::document(key: 'key3', boolField: true), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'boolField', value: true) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', boolField: false), ]) ]; @@ -1202,12 +1202,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectField: ['foo' => 'baz']), self::document(key: 'key3', objectField: ['foo' => 'qux']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'objectField.foo', value: 'baz') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectField: ['foo' => 'baz']), ]) ]; @@ -1217,12 +1217,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectField: ['foo' => 'baz']), self::document(key: 'key3', objectField: ['foo' => 'qux']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'objectField.foo', value: ['baz', 'qux']) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectField: ['foo' => 'baz']), self::document(key: 'key3', objectField: ['foo' => 'qux']), ]) @@ -1233,12 +1233,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectField: ['foo' => 'baz']), self::document(key: 'key3', objectField: ['foo' => 'qux']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'objectField.foo', value: 'baz') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectField: ['foo' => 'bar']), self::document(key: 'key3', objectField: ['foo' => 'qux']), ]) @@ -1249,12 +1249,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectField: ['foo' => 'baz']), self::document(key: 'key3', objectField: ['foo' => 'qux']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Neither(field: 'objectField.foo', value: ['baz', 'qux']) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectField: ['foo' => 'bar']), ]) ]; @@ -1264,12 +1264,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectField: ['foo' => 'baz']), self::document(key: 'key3', objectField: ['foo' => 'qux']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Contains(field: 'objectField.foo', value: 'ba') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectField: ['foo' => 'bar']), self::document(key: 'key2', objectField: ['foo' => 'baz']), ]) @@ -1280,12 +1280,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectField: ['foo' => 'baz']), self::document(key: 'key3', objectField: ['foo' => 'qux']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gte(field: 'objectField.foo', value: 'baz') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectField: ['foo' => 'baz']), self::document(key: 'key3', objectField: ['foo' => 'qux']), ]) @@ -1296,12 +1296,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectField: ['foo' => 'baz']), self::document(key: 'key3', objectField: ['foo' => 'qux']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lte(field: 'objectField.foo', value: 'baz') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectField: ['foo' => 'bar']), self::document(key: 'key2', objectField: ['foo' => 'baz']), ]) @@ -1312,12 +1312,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectField: ['foo' => 'baz']), self::document(key: 'key3', objectField: ['foo' => 'qux']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gt(field: 'objectField.foo', value: 'baz') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key3', objectField: ['foo' => 'qux']), ]) ]; @@ -1327,12 +1327,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectField: ['foo' => 'baz']), self::document(key: 'key3', objectField: ['foo' => 'qux']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lt(field: 'objectField.foo', value: 'baz') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectField: ['foo' => 'bar']), ]) ]; @@ -1368,22 +1368,22 @@ final public static function storageProvider(): \Generator // self::document(key: 'key3', objectField: null), // ]) // ]; - yield 'Test object field null value not filter' => [ - 'input' => new Documents([ - self::document(key: 'key1', objectField: ['foo' => 'bar']), - self::document(key: 'key2', objectField: ['foo' => 'baz']), - self::document(key: 'key3', objectField: null), - ]), - 'criteria' => new FilterCriteria( - filters: [ - new Not(field: 'objectField.foo', value: null) - ] - ), - 'expected' => new FilterResult([ - self::document('key1', objectField: ['foo' => 'bar']), - self::document('key2', objectField: ['foo' => 'baz']) - ]) - ]; + // yield 'Test object field null value not filter' => [ + // 'input' => new Documents([ + // self::document(key: 'key1', objectField: ['foo' => 'bar']), + // self::document(key: 'key2', objectField: ['foo' => 'baz']), + // self::document(key: 'key3', objectField: null), + // ]), + // 'criteria' => new Criteria( + // filters: [ + // new Not(field: 'objectField.foo', value: null) + // ] + // ), + // 'expected' => new Result([ + // self::document('key1', objectField: ['foo' => 'bar']), + // self::document('key2', objectField: ['foo' => 'baz']) + // ]) + // ]; yield 'Test object field equals filter and int value' => [ 'input' => new Documents([ @@ -1391,12 +1391,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectField: ['fooInt' => 2]), self::document(key: 'key3', objectField: ['fooInt' => 3]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'objectField.fooInt', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectField: ['fooInt' => 2]), ]) ]; @@ -1406,12 +1406,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectField: ['fooInt' => 2]), self::document(key: 'key3', objectField: ['fooInt' => 3]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'objectField.fooInt', value: [1, 2]) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectField: ['fooInt' => 1]), self::document(key: 'key2', objectField: ['fooInt' => 2]), ]) @@ -1422,12 +1422,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectField: ['fooInt' => 2]), self::document(key: 'key3', objectField: ['fooInt' => 3]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'objectField.fooInt', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectField: ['fooInt' => 1]), self::document(key: 'key3', objectField: ['fooInt' => 3]), ]) @@ -1438,12 +1438,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectField: ['fooInt' => 2]), self::document(key: 'key3', objectField: ['fooInt' => 3]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Neither(field: 'objectField.fooInt', value: [1, 2]) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key3', objectField: ['fooInt' => 3]), ]) ]; @@ -1453,12 +1453,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectField: ['fooInt' => 2]), self::document(key: 'key3', objectField: ['fooInt' => 3]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gte(field: 'objectField.fooInt', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectField: ['fooInt' => 2]), self::document(key: 'key3', objectField: ['fooInt' => 3]), ]) @@ -1469,12 +1469,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectField: ['fooInt' => 2]), self::document(key: 'key3', objectField: ['fooInt' => 3]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lte(field: 'objectField.fooInt', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectField: ['fooInt' => 1]), self::document(key: 'key2', objectField: ['fooInt' => 2]), ]) @@ -1485,12 +1485,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectField: ['fooInt' => 2]), self::document(key: 'key3', objectField: ['fooInt' => 3]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gt(field: 'objectField.fooInt', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key3', objectField: ['fooInt' => 3]), ]) ]; @@ -1500,12 +1500,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectField: ['fooInt' => 2]), self::document(key: 'key3', objectField: ['fooInt' => 3]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lt(field: 'objectField.fooInt', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectField: ['fooInt' => 1]), ]) ]; @@ -1516,13 +1516,13 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', objectField: ['fooInt' => 3]), self::document(key: 'key4', objectField: ['fooInt' => 4]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gte(field: 'objectField.fooInt', value: 2), new Lte(field: 'objectField.fooInt', value: 3), ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectField: ['fooInt' => 2]), self::document(key: 'key3', objectField: ['fooInt' => 3]), ]) @@ -1534,12 +1534,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectField: ['fooFloat' => 2.2]), self::document(key: 'key3', objectField: ['fooFloat' => 3.3]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'objectField.fooFloat', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectField: ['fooFloat' => 2.2]), ]) ]; @@ -1549,12 +1549,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectField: ['fooFloat' => 2.2]), self::document(key: 'key3', objectField: ['fooFloat' => 3.3]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'objectField.fooFloat', value: [1.1, 2.2]) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectField: ['fooFloat' => 1.1]), self::document(key: 'key2', objectField: ['fooFloat' => 2.2]), ]) @@ -1565,12 +1565,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectField: ['fooFloat' => 2.2]), self::document(key: 'key3', objectField: ['fooFloat' => 3.3]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'objectField.fooFloat', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectField: ['fooFloat' => 1.1]), self::document(key: 'key3', objectField: ['fooFloat' => 3.3]), ]) @@ -1581,12 +1581,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectField: ['fooFloat' => 2.2]), self::document(key: 'key3', objectField: ['fooFloat' => 3.3]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Neither(field: 'objectField.fooFloat', value: [1.1, 2.2]) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key3', objectField: ['fooFloat' => 3.3]), ]) ]; @@ -1596,12 +1596,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectField: ['fooFloat' => 2.2]), self::document(key: 'key3', objectField: ['fooFloat' => 3.3]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gte(field: 'objectField.fooFloat', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectField: ['fooFloat' => 2.2]), self::document(key: 'key3', objectField: ['fooFloat' => 3.3]), ]) @@ -1612,12 +1612,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectField: ['fooFloat' => 2.2]), self::document(key: 'key3', objectField: ['fooFloat' => 3.3]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lte(field: 'objectField.fooFloat', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectField: ['fooFloat' => 1.1]), self::document(key: 'key2', objectField: ['fooFloat' => 2.2]), ]) @@ -1628,12 +1628,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectField: ['fooFloat' => 2.2]), self::document(key: 'key3', objectField: ['fooFloat' => 3.3]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gt(field: 'objectField.fooFloat', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key3', objectField: ['fooFloat' => 3.3]), ]) ]; @@ -1643,12 +1643,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectField: ['fooFloat' => 2.2]), self::document(key: 'key3', objectField: ['fooFloat' => 3.3]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lt(field: 'objectField.fooFloat', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectField: ['fooFloat' => 1.1]), ]) ]; @@ -1659,13 +1659,13 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', objectField: ['fooFloat' => 3.3]), self::document(key: 'key4', objectField: ['fooFloat' => 4.4]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gte(field: 'objectField.fooFloat', value: 2.2), new Lte(field: 'objectField.fooFloat', value: 3.3), ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectField: ['fooFloat' => 2.2]), self::document(key: 'key3', objectField: ['fooFloat' => 3.3]), ]) @@ -1677,12 +1677,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectField: ['fooDate' => '2021-01-02 00:00:00.000']), self::document(key: 'key3', objectField: ['fooDate' => '2021-01-03 00:00:00.000']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'objectField.fooDate', value: '2021-01-02') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectField: ['fooDate' => '2021-01-02 00:00:00.000']), ]) ]; @@ -1692,12 +1692,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectField: ['fooDate' => '2021-01-02 00:00:00.000']), self::document(key: 'key3', objectField: ['fooDate' => '2021-01-03 00:00:00.000']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'objectField.fooDate', value: ['2021-01-02', '2021-01-03']) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectField: ['fooDate' => '2021-01-02 00:00:00.000']), self::document(key: 'key3', objectField: ['fooDate' => '2021-01-03 00:00:00.000']), ]) @@ -1708,12 +1708,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectField: ['fooDate' => '2021-01-02 00:00:00.000']), self::document(key: 'key3', objectField: ['fooDate' => '2021-01-03 00:00:00.000']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'objectField.fooDate', value: '2021-01-02') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectField: ['fooDate' => '2021-01-01 00:00:00.000']), self::document(key: 'key3', objectField: ['fooDate' => '2021-01-03 00:00:00.000']), ]) @@ -1724,12 +1724,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectField: ['fooDate' => '2021-01-02 00:00:00.000']), self::document(key: 'key3', objectField: ['fooDate' => '2021-01-03 00:00:00.000']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Neither(field: 'objectField.fooDate', value: ['2021-01-02', '2021-01-03']) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectField: ['fooDate' => '2021-01-01 00:00:00.000']), ]) ]; @@ -1739,12 +1739,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectField: ['fooDate' => '2021-01-02 00:00:00.000']), self::document(key: 'key3', objectField: ['fooDate' => '2021-01-03 00:00:00.000']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gte(field: 'objectField.fooDate', value: '2021-01-02') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectField: ['fooDate' => '2021-01-02 00:00:00.000']), self::document(key: 'key3', objectField: ['fooDate' => '2021-01-03 00:00:00.000']), ]) @@ -1755,12 +1755,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectField: ['fooDate' => '2021-01-02 00:00:00.000']), self::document(key: 'key3', objectField: ['fooDate' => '2021-01-03 00:00:00.000']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lte(field: 'objectField.fooDate', value: '2021-01-02') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectField: ['fooDate' => '2021-01-01 00:00:00.000']), self::document(key: 'key2', objectField: ['fooDate' => '2021-01-02 00:00:00.000']), ]) @@ -1771,12 +1771,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectField: ['fooDate' => '2021-01-02 00:00:00.000']), self::document(key: 'key3', objectField: ['fooDate' => '2021-01-03 00:00:00.000']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gt(field: 'objectField.fooDate', value: '2021-01-02') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key3', objectField: ['fooDate' => '2021-01-03 00:00:00.000']), ]) ]; @@ -1786,12 +1786,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectField: ['fooDate' => '2021-01-02 00:00:00.000']), self::document(key: 'key3', objectField: ['fooDate' => '2021-01-03 00:00:00.000']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lt(field: 'objectField.fooDate', value: '2021-01-02') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectField: ['fooDate' => '2021-01-01 00:00:00.000']), ]) ]; @@ -1802,13 +1802,13 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', objectField: ['fooDate' => '2021-01-03 00:00:00.000']), self::document(key: 'key4', objectField: ['fooDate' => '2021-01-04 00:00:00.000']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gte(field: 'objectField.fooDate', value: '2021-01-02'), new Lte(field: 'objectField.fooDate', value: '2021-01-03'), ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectField: ['fooDate' => '2021-01-02 00:00:00.000']), self::document(key: 'key3', objectField: ['fooDate' => '2021-01-03 00:00:00.000']), ]) @@ -1820,12 +1820,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', listField: ['foo', 'baz']), self::document(key: 'key3', listField: ['foo', 'qux']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'listField', value: 'baz') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', listField: ['foo', 'baz']), ]) ]; @@ -1835,12 +1835,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', listField: ['foo', 'baz']), self::document(key: 'key3', listField: ['foo', 'qux']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'listField', value: ['baz', 'qux']) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', listField: ['foo', 'baz']), self::document(key: 'key3', listField: ['foo', 'qux']), ]) @@ -1851,12 +1851,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', listField: ['foo', 'baz']), self::document(key: 'key3', listField: ['foo', 'qux']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'listField', value: 'baz') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', listField: ['foo', 'bar']), self::document(key: 'key3', listField: ['foo', 'qux']), ]) @@ -1867,12 +1867,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', listField: ['foo', 'baz']), self::document(key: 'key3', listField: ['foo', 'qux']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Neither(field: 'listField', value: ['baz', 'qux']) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', listField: ['foo', 'bar']), ]) ]; @@ -1882,12 +1882,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', listField: ['foo', 'baz']), self::document(key: 'key3', listField: ['foo', 'qux']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Contains(field: 'listField', value: 'ba') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', listField: ['foo', 'bar']), self::document(key: 'key2', listField: ['foo', 'baz']), ]) @@ -1898,12 +1898,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', listField: [1, 3]), self::document(key: 'key3', listField: null), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'listField', value: null) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key3', listField: null) ]) ]; @@ -1913,12 +1913,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', listField: [1, 3]), self::document(key: 'key3', listField: null), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'listField', value: null) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document('key1', listField: [1, 2]), self::document('key2', listField: [1, 3]) ]) @@ -1930,12 +1930,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', listField: [1, 3]), self::document(key: 'key3', listField: [1, 4]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'listField', value: 3) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', listField: [1, 3]), ]) ]; @@ -1945,12 +1945,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', listField: [1, 3]), self::document(key: 'key3', listField: [1, 4]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'listField', value: [3, 4]) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', listField: [1, 3]), self::document(key: 'key3', listField: [1, 4]), ]) @@ -1961,12 +1961,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', listField: [1, 3]), self::document(key: 'key3', listField: [1, 4]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'listField', value: 3) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', listField: [1, 2]), self::document(key: 'key3', listField: [1, 4]), ]) @@ -1977,12 +1977,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', listField: [1, 3]), self::document(key: 'key3', listField: [1, 4]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Neither(field: 'listField', value: [3, 4]) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', listField: [1, 2]), ]) ]; @@ -1992,12 +1992,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', listField: [1.1, 3.3]), self::document(key: 'key3', listField: [1.1, 4.4]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'listField', value: 3.3) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', listField: [1.1, 3.3]), ]) ]; @@ -2007,12 +2007,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', listField: [1.1, 3.3]), self::document(key: 'key3', listField: [1.1, 4.4]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'listField', value: [3.3, 4.4]) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', listField: [1.1, 3.3]), self::document(key: 'key3', listField: [1.1, 4.4]), ]) @@ -2023,12 +2023,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', listField: [1.1, 3.3]), self::document(key: 'key3', listField: [1.1, 4.4]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'listField', value: 3.3) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', listField: [1.1, 2.2]), self::document(key: 'key3', listField: [1.1, 4.4]), ]) @@ -2039,12 +2039,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', listField: [1.1, 3.3]), self::document(key: 'key3', listField: [1.1, 4.4]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Neither(field: 'listField', value: [3.3, 4.4]) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', listField: [1.1, 2.2]), ]) ]; @@ -2054,12 +2054,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', listField: ['2021-01-01', '2021-01-03']), self::document(key: 'key3', listField: ['2021-01-01', '2021-01-04']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'listField', value: '2021-01-03') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', listField: ['2021-01-01', '2021-01-03']), ]) ]; @@ -2069,12 +2069,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', listField: ['2021-01-01', '2021-01-03']), self::document(key: 'key3', listField: ['2021-01-01', '2021-01-04']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'listField', value: ['2021-01-03', '2021-01-04']) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', listField: ['2021-01-01', '2021-01-03']), self::document(key: 'key3', listField: ['2021-01-01', '2021-01-04']), ]) @@ -2085,12 +2085,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', listField: ['2021-01-01', '2021-01-03']), self::document(key: 'key3', listField: ['2021-01-01', '2021-01-04']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'listField', value: '2021-01-03') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', listField: ['2021-01-01', '2021-01-02']), self::document(key: 'key3', listField: ['2021-01-01', '2021-01-04']), ]) @@ -2101,12 +2101,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', listField: ['2021-01-01', '2021-01-03']), self::document(key: 'key3', listField: ['2021-01-01', '2021-01-04']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Neither(field: 'listField', value: ['2021-01-03', '2021-01-04']) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', listField: ['2021-01-01', '2021-01-02']), ]) ]; @@ -2116,12 +2116,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', listField: ['2021-01-01', '2021-01-03']), self::document(key: 'key3', listField: ['2021-01-01', '2021-01-04']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Contains(field: 'listField', value: '2021-01-02') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', listField: ['2021-01-01', '2021-01-02']), ]) ]; @@ -2132,12 +2132,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectListField: [['foo' => 'baz'], ['foo' => 'baz-2']]), self::document(key: 'key3', objectListField: [['foo' => 'qux'], ['foo' => 'qux-2'], ['foo' => 'baz-2']]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'objectListField.foo', value: 'baz-2') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectListField: [['foo' => 'baz'], ['foo' => 'baz-2']]), self::document(key: 'key3', objectListField: [['foo' => 'qux'], ['foo' => 'qux-2'], ['foo' => 'baz-2']]), ]) @@ -2148,12 +2148,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectListField: [['foo' => 'baz'], ['foo' => 'baz-2']]), self::document(key: 'key3', objectListField: [['foo' => 'qux'], ['foo' => 'qux-2'], ['foo' => 'baz-2']]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'objectListField.foo', value: ['bar-2', 'qux-2']) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectListField: [['foo' => 'bar'], ['foo' => 'bar-2']]), self::document(key: 'key3', objectListField: [['foo' => 'qux'], ['foo' => 'qux-2'], ['foo' => 'baz-2']]), ]) @@ -2164,12 +2164,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectListField: [['foo' => 'baz'], ['foo' => 'baz-2']]), self::document(key: 'key3', objectListField: [['foo' => 'qux'], ['foo' => 'qux-2'], ['foo' => 'baz-2']]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Contains(field: 'objectListField.foo', value: 'baz') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectListField: [['foo' => 'baz'], ['foo' => 'baz-2']]), self::document(key: 'key3', objectListField: [['foo' => 'qux'], ['foo' => 'qux-2'], ['foo' => 'baz-2']]), ]) @@ -2180,12 +2180,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectListField: [['foo' => 'baz'], ['foo' => 'baz-2']]), self::document(key: 'key3', objectListField: [['foo' => 'qux'], ['foo' => 'qux-2'], ['foo' => 'baz-2']]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Prefix(field: 'objectListField.foo', value: 'qu') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key3', objectListField: [['foo' => 'qux'], ['foo' => 'qux-2'], ['foo' => 'baz-2']]), ]) ]; @@ -2195,12 +2195,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectListField: [['foo' => 'baz'], ['foo' => 'baz-2']]), self::document(key: 'key3', objectListField: [['foo' => 'qux'], ['foo' => 'qux-2'], ['foo' => 'baz-2']]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Suffix(field: 'objectListField.foo', value: 'z-2') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectListField: [['foo' => 'baz'], ['foo' => 'baz-2']]), self::document(key: 'key3', objectListField: [['foo' => 'qux'], ['foo' => 'qux-2'], ['foo' => 'baz-2']]), ]) @@ -2212,12 +2212,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectListField: [['fooInt' => 10], ['fooInt' => 2]]), self::document(key: 'key3', objectListField: [['fooInt' => 20], ['fooInt' => 22], ['fooInt' => 24]]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'objectListField.fooInt', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectListField: [['fooInt' => 1], ['fooInt' => 2]]), self::document(key: 'key2', objectListField: [['fooInt' => 10], ['fooInt' => 2]]), ]) @@ -2228,12 +2228,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectListField: [['fooInt' => 10], ['fooInt' => 2]]), self::document(key: 'key3', objectListField: [['fooInt' => 20], ['fooInt' => 22], ['fooInt' => 24]]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'objectListField.fooInt', value: [10, 22]) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectListField: [['fooInt' => 10], ['fooInt' => 2]]), self::document(key: 'key3', objectListField: [['fooInt' => 20], ['fooInt' => 22], ['fooInt' => 24]]), ]) @@ -2244,12 +2244,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectListField: [['fooInt' => 10], ['fooInt' => 2]]), self::document(key: 'key3', objectListField: [['fooInt' => 20], ['fooInt' => 22], ['fooInt' => 24]]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gte(field: 'objectListField.fooInt', value: 22) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key3', objectListField: [['fooInt' => 20], ['fooInt' => 22], ['fooInt' => 24]]), ]) ]; @@ -2259,12 +2259,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectListField: [['fooInt' => 10], ['fooInt' => 2]]), self::document(key: 'key3', objectListField: [['fooInt' => 20], ['fooInt' => 22], ['fooInt' => 24]]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lte(field: 'objectListField.fooInt', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectListField: [['fooInt' => 1], ['fooInt' => 2]]), self::document(key: 'key2', objectListField: [['fooInt' => 10], ['fooInt' => 2]]), ]) @@ -2275,12 +2275,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectListField: [['fooInt' => 10], ['fooInt' => 2]]), self::document(key: 'key3', objectListField: [['fooInt' => 20], ['fooInt' => 22], ['fooInt' => 24]]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gt(field: 'objectListField.fooInt', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectListField: [['fooInt' => 10], ['fooInt' => 2]]), self::document(key: 'key3', objectListField: [['fooInt' => 20], ['fooInt' => 22], ['fooInt' => 24]]), ]) @@ -2291,12 +2291,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectListField: [['fooInt' => 10], ['fooInt' => 2]]), self::document(key: 'key3', objectListField: [['fooInt' => 20], ['fooInt' => 22], ['fooInt' => 24]]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lt(field: 'objectListField.fooInt', value: 20) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectListField: [['fooInt' => 1], ['fooInt' => 2]]), self::document(key: 'key2', objectListField: [['fooInt' => 10], ['fooInt' => 2]]), ]) @@ -2308,12 +2308,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectListField: [['fooFloat' => 10.1], ['fooFloat' => 2.2]]), self::document(key: 'key3', objectListField: [['fooFloat' => 20.1], ['fooFloat' => 22.2], ['fooFloat' => 24.2]]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'objectListField.fooFloat', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectListField: [['fooFloat' => 1.1], ['fooFloat' => 2.2]]), self::document(key: 'key2', objectListField: [['fooFloat' => 10.1], ['fooFloat' => 2.2]]), ]) @@ -2325,12 +2325,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', objectListField: [['fooFloat' => 20.1], ['fooFloat' => 22.2], ['fooFloat' => 24.2]]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'objectListField.fooFloat', value: [10.1, 22.2]) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectListField: [['fooFloat' => 10.1], ['fooFloat' => 2.2]]), self::document(key: 'key3', objectListField: [['fooFloat' => 20.1], ['fooFloat' => 22.2], ['fooFloat' => 24.2]]), ]) @@ -2341,12 +2341,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectListField: [['fooFloat' => 10.1], ['fooFloat' => 2.2]]), self::document(key: 'key3', objectListField: [['fooFloat' => 20.1], ['fooFloat' => 22.2], ['fooFloat' => 24.2]]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gte(field: 'objectListField.fooFloat', value: 22.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key3', objectListField: [['fooFloat' => 20.1], ['fooFloat' => 22.2], ['fooFloat' => 24.2]]), ]) ]; @@ -2356,12 +2356,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectListField: [['fooFloat' => 10.1], ['fooFloat' => 2.2]]), self::document(key: 'key3', objectListField: [['fooFloat' => 20.1], ['fooFloat' => 22.2], ['fooFloat' => 24.2]]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lte(field: 'objectListField.fooFloat', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectListField: [['fooFloat' => 1.1], ['fooFloat' => 2.2]]), self::document(key: 'key2', objectListField: [['fooFloat' => 10.1], ['fooFloat' => 2.2]]), ]) @@ -2372,12 +2372,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectListField: [['fooFloat' => 10.1], ['fooFloat' => 2.2]]), self::document(key: 'key3', objectListField: [['fooFloat' => 20.1], ['fooFloat' => 22.2], ['fooFloat' => 24.2]]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gt(field: 'objectListField.fooFloat', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectListField: [['fooFloat' => 10.1], ['fooFloat' => 2.2]]), self::document(key: 'key3', objectListField: [['fooFloat' => 20.1], ['fooFloat' => 22.2], ['fooFloat' => 24.2]]), ]) @@ -2388,12 +2388,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectListField: [['fooFloat' => 10.1], ['fooFloat' => 2.2]]), self::document(key: 'key3', objectListField: [['fooFloat' => 20.1], ['fooFloat' => 22.2], ['fooFloat' => 24.2]]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lt(field: 'objectListField.fooFloat', value: 20.1) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectListField: [['fooFloat' => 1.1], ['fooFloat' => 2.2]]), self::document(key: 'key2', objectListField: [['fooFloat' => 10.1], ['fooFloat' => 2.2]]), ]) @@ -2405,12 +2405,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectListField: [['fooDate' => '2021-01-10 00:00:00.000'], ['fooDate' => '2021-01-02 00:00:00.000']]), self::document(key: 'key3', objectListField: [['fooDate' => '2021-01-20 00:00:00.000'], ['fooDate' => '2021-01-22 00:00:00.000'], ['fooDate' => '2021-01-24 00:00:00.000']]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'objectListField.fooDate', value: '2021-01-02 00:00:00.000') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectListField: [['fooDate' => '2021-01-01 00:00:00.000'], ['fooDate' => '2021-01-02 00:00:00.000']]), self::document(key: 'key2', objectListField: [['fooDate' => '2021-01-10 00:00:00.000'], ['fooDate' => '2021-01-02 00:00:00.000']]), ]) @@ -2421,12 +2421,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectListField: [['fooDate' => '2021-01-10 00:00:00.000'], ['fooDate' => '2021-01-02 00:00:00.000']]), self::document(key: 'key3', objectListField: [['fooDate' => '2021-01-20 00:00:00.000'], ['fooDate' => '2021-01-22 00:00:00.000'], ['fooDate' => '2021-01-24 00:00:00.000']]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'objectListField.fooDate', value: ['2021-01-10 00:00:00.000', '2021-01-22 00:00:00.000']) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectListField: [['fooDate' => '2021-01-10 00:00:00.000'], ['fooDate' => '2021-01-02 00:00:00.000']]), self::document(key: 'key3', objectListField: [['fooDate' => '2021-01-20 00:00:00.000'], ['fooDate' => '2021-01-22 00:00:00.000'], ['fooDate' => '2021-01-24 00:00:00.000']]), ]) @@ -2438,12 +2438,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectListField: [['fooDate' => '2021-01-10 00:00:00.000'], ['fooDate' => '2021-01-02 00:00:00.000']]), self::document(key: 'key3', objectListField: [['fooDate' => '2021-01-20 00:00:00.000'], ['fooDate' => '2021-01-22 00:00:00.000'], ['fooDate' => '2021-01-24 00:00:00.000']]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gte(field: 'objectListField.fooDate', value: '2021-01-22 00:00:00.000') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key3', objectListField: [['fooDate' => '2021-01-20 00:00:00.000'], ['fooDate' => '2021-01-22 00:00:00.000'], ['fooDate' => '2021-01-24 00:00:00.000']]), ]) ]; @@ -2453,12 +2453,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectListField: [['fooDate' => '2021-01-10 00:00:00.000'], ['fooDate' => '2021-01-02 00:00:00.000']]), self::document(key: 'key3', objectListField: [['fooDate' => '2021-01-20 00:00:00.000'], ['fooDate' => '2021-01-22 00:00:00.000'], ['fooDate' => '2021-01-24 00:00:00.000']]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lte(field: 'objectListField.fooDate', value: '2021-01-02 00:00:00.000') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectListField: [['fooDate' => '2021-01-01 00:00:00.000'], ['fooDate' => '2021-01-02 00:00:00.000']]), self::document(key: 'key2', objectListField: [['fooDate' => '2021-01-10 00:00:00.000'], ['fooDate' => '2021-01-02 00:00:00.000']]), ]) @@ -2469,12 +2469,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectListField: [['fooDate' => '2021-01-10 00:00:00.000'], ['fooDate' => '2021-01-02 00:00:00.000']]), self::document(key: 'key3', objectListField: [['fooDate' => '2021-01-20 00:00:00.000'], ['fooDate' => '2021-01-22 00:00:00.000'], ['fooDate' => '2021-01-24 00:00:00.000']]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gt(field: 'objectListField.fooDate', value: '2021-01-02 00:00:00.000') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectListField: [['fooDate' => '2021-01-10 00:00:00.000'], ['fooDate' => '2021-01-02 00:00:00.000']]), self::document(key: 'key3', objectListField: [['fooDate' => '2021-01-20 00:00:00.000'], ['fooDate' => '2021-01-22 00:00:00.000'], ['fooDate' => '2021-01-24 00:00:00.000']]), ]) @@ -2485,12 +2485,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectListField: [['fooDate' => '2021-01-10 00:00:00.000'], ['fooDate' => '2021-01-02 00:00:00.000']]), self::document(key: 'key3', objectListField: [['fooDate' => '2021-01-20 00:00:00.000'], ['fooDate' => '2021-01-22 00:00:00.000'], ['fooDate' => '2021-01-24 00:00:00.000']]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lt(field: 'objectListField.fooDate', value: '2021-01-20 00:00:00.000') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectListField: [['fooDate' => '2021-01-01 00:00:00.000'], ['fooDate' => '2021-01-02 00:00:00.000']]), self::document(key: 'key2', objectListField: [['fooDate' => '2021-01-10 00:00:00.000'], ['fooDate' => '2021-01-02 00:00:00.000']]), ]) @@ -2502,12 +2502,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key2', objectField: ['fooObj' => ['bar' => 'qux']]), self::document(key: 'key3', objectField: ['fooObj' => ['bar' => 'quux']]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'objectField.fooObj.bar', value: 'qux') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectField: ['fooObj' => ['bar' => 'qux']]), ]) ]; @@ -2519,12 +2519,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'foo']), self::document(key: 'key4', translatedString: ['de' => 'foo']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'translatedString', value: 'foo') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedString: ['en' => 'foo']), self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'foo']), self::document(key: 'key4', translatedString: ['de' => 'foo']), @@ -2537,12 +2537,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'foo']), self::document(key: 'key4', translatedString: ['en' => 'baz', 'de' => 'foo']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'translatedString', value: ['foo', 'bar']) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', translatedString: ['en' => 'bar', 'de' => 'foo']), self::document(key: 'key2', translatedString: ['en' => 'foo']), self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'foo']), @@ -2555,12 +2555,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'foo']), self::document(key: 'key4', translatedString: ['en' => 'baz', 'de' => 'foo']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'translatedString', value: 'foo') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', translatedString: ['en' => 'bar', 'de' => 'foo']), self::document(key: 'key4', translatedString: ['en' => 'baz', 'de' => 'foo']), ]) @@ -2572,12 +2572,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'foo']), self::document(key: 'key4', translatedString: ['en' => 'baz', 'de' => 'foo']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Neither(field: 'translatedString', value: ['foo', 'bar']) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key4', translatedString: ['en' => 'baz', 'de' => 'foo']), ]) ]; @@ -2588,12 +2588,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'foo']), self::document(key: 'key4', translatedString: ['en' => 'foo', 'de' => 'bar']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Contains(field: 'translatedString', value: 'oo') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedString: ['en' => 'boo']), self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'foo']), self::document(key: 'key4', translatedString: ['en' => 'foo', 'de' => 'bar']), @@ -2606,12 +2606,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'foo']), self::document(key: 'key4', translatedString: ['en' => 'baz', 'de' => 'foo']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Prefix(field: 'translatedString', value: 'foo') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedString: ['en' => 'foo']), self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'foo']), ]) @@ -2623,12 +2623,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'foo']), self::document(key: 'key4', translatedString: ['en' => 'ob', 'de' => 'foo']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Suffix(field: 'translatedString', value: 'o') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedString: ['en' => 'foo']), self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'foo']), ]) @@ -2640,12 +2640,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'b']), self::document(key: 'key4', translatedString: ['en' => 'b', 'de' => 'a']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gte(field: 'translatedString', value: 'b') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedString: ['en' => 'c']), self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'b']), self::document(key: 'key4', translatedString: ['en' => 'b', 'de' => 'a']), @@ -2658,12 +2658,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'b']), self::document(key: 'key4', translatedString: ['en' => 'b', 'de' => 'a']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gt(field: 'translatedString', value: 'b') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedString: ['en' => 'c']), ]) ]; @@ -2674,12 +2674,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'b']), self::document(key: 'key4', translatedString: ['en' => 'b', 'de' => 'a']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lte(field: 'translatedString', value: 'b') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', translatedString: ['en' => 'a', 'de' => 'b']), self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'b']), self::document(key: 'key4', translatedString: ['en' => 'b', 'de' => 'a']), @@ -2692,12 +2692,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'b']), self::document(key: 'key4', translatedString: ['en' => 'b', 'de' => 'a']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lt(field: 'translatedString', value: 'b') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', translatedString: ['en' => 'a', 'de' => 'b']), ]) ]; @@ -2708,12 +2708,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedString: ['en' => '', 'de' => 'foo']), self::document(key: 'key4', translatedString: ['de' => 'foo']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'translatedString', value: 'foo') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedString: ['en' => 'foo']), self::document(key: 'key4', translatedString: ['de' => 'foo']), ]) @@ -2726,12 +2726,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedInt: ['en' => null, 'de' => 2]), self::document(key: 'key4', translatedInt: ['de' => 2]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'translatedInt', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedInt: ['en' => 2]), self::document(key: 'key3', translatedInt: ['en' => null, 'de' => 2]), self::document(key: 'key4', translatedInt: ['de' => 2]), @@ -2744,12 +2744,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedInt: ['en' => null, 'de' => 3]), self::document(key: 'key4', translatedInt: ['de' => 4]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'translatedInt', value: [2, 3, 4]) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedInt: ['en' => 2]), self::document(key: 'key3', translatedInt: ['en' => null, 'de' => 3]), self::document(key: 'key4', translatedInt: ['de' => 4]), @@ -2762,12 +2762,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedInt: ['en' => null, 'de' => 2]), self::document(key: 'key4', translatedInt: ['de' => 2]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'translatedInt', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', translatedInt: ['en' => 1, 'de' => 2]), ]) ]; @@ -2778,12 +2778,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedInt: ['en' => null, 'de' => 2]), self::document(key: 'key4', translatedInt: ['de' => 2]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Neither(field: 'translatedInt', value: [1, 2]) ] ), - 'expected' => new FilterResult([]) + 'expected' => new Result([]) ]; yield 'Test translated int field gte filter' => [ 'input' => new Documents([ @@ -2792,12 +2792,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedInt: ['en' => null, 'de' => 2]), self::document(key: 'key4', translatedInt: ['de' => 1]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gte(field: 'translatedInt', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedInt: ['en' => 3]), self::document(key: 'key3', translatedInt: ['en' => null, 'de' => 2]), ]) @@ -2809,12 +2809,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedInt: ['en' => null, 'de' => 2]), self::document(key: 'key4', translatedInt: ['de' => 1]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gt(field: 'translatedInt', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedInt: ['en' => 3]), ]) ]; @@ -2825,12 +2825,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedInt: ['en' => null, 'de' => 2]), self::document(key: 'key4', translatedInt: ['de' => 1]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lte(field: 'translatedInt', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', translatedInt: ['en' => 1, 'de' => 2]), self::document(key: 'key3', translatedInt: ['en' => null, 'de' => 2]), self::document(key: 'key4', translatedInt: ['de' => 1]), @@ -2843,12 +2843,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedInt: ['en' => null, 'de' => 2]), self::document(key: 'key4', translatedInt: ['de' => 1]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lt(field: 'translatedInt', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', translatedInt: ['en' => 1, 'de' => 2]), self::document(key: 'key4', translatedInt: ['de' => 1]), ]) @@ -2861,12 +2861,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedFloat: ['en' => null, 'de' => 2.2]), self::document(key: 'key4', translatedFloat: ['de' => 2.2]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'translatedFloat', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedFloat: ['en' => 2.2]), self::document(key: 'key3', translatedFloat: ['en' => null, 'de' => 2.2]), self::document(key: 'key4', translatedFloat: ['de' => 2.2]), @@ -2879,12 +2879,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedFloat: ['en' => null, 'de' => 3.3]), self::document(key: 'key4', translatedFloat: ['de' => 4.4]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'translatedFloat', value: [2.2, 3.3, 4.4]) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedFloat: ['en' => 2.2]), self::document(key: 'key3', translatedFloat: ['en' => null, 'de' => 3.3]), self::document(key: 'key4', translatedFloat: ['de' => 4.4]), @@ -2897,12 +2897,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedFloat: ['en' => null, 'de' => 2.2]), self::document(key: 'key4', translatedFloat: ['de' => 2.2]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'translatedFloat', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', translatedFloat: ['en' => 1.1, 'de' => 2.2]), ]) ]; @@ -2913,12 +2913,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedFloat: ['en' => null, 'de' => 2.2]), self::document(key: 'key4', translatedFloat: ['de' => 2.2]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Neither(field: 'translatedFloat', value: [1.1, 2.2]) ] ), - 'expected' => new FilterResult([]) + 'expected' => new Result([]) ]; yield 'Test translated float field gte filter' => [ 'input' => new Documents([ @@ -2927,12 +2927,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedFloat: ['en' => null, 'de' => 2.2]), self::document(key: 'key4', translatedFloat: ['de' => 1.1]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gte(field: 'translatedFloat', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedFloat: ['en' => 3.3]), self::document(key: 'key3', translatedFloat: ['en' => null, 'de' => 2.2]), ]) @@ -2944,12 +2944,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedFloat: ['en' => null, 'de' => 2.2]), self::document(key: 'key4', translatedFloat: ['de' => 1.1]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gt(field: 'translatedFloat', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedFloat: ['en' => 3.3]), ]) ]; @@ -2960,12 +2960,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedFloat: ['en' => null, 'de' => 2.2]), self::document(key: 'key4', translatedFloat: ['de' => 1.1]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lte(field: 'translatedFloat', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', translatedFloat: ['en' => 1.1, 'de' => 2.2]), self::document(key: 'key3', translatedFloat: ['en' => null, 'de' => 2.2]), self::document(key: 'key4', translatedFloat: ['de' => 1.1]), @@ -2978,12 +2978,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedFloat: ['en' => null, 'de' => 2.2]), self::document(key: 'key4', translatedFloat: ['de' => 1.1]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lt(field: 'translatedFloat', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', translatedFloat: ['en' => 1.1, 'de' => 2.2]), self::document(key: 'key4', translatedFloat: ['de' => 1.1]), ]) @@ -2996,12 +2996,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedBool: ['en' => null, 'de' => false]), self::document(key: 'key4', translatedBool: ['de' => false]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'translatedBool', value: false) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedBool: ['en' => false]), self::document(key: 'key3', translatedBool: ['en' => null, 'de' => false]), self::document(key: 'key4', translatedBool: ['de' => false]), @@ -3014,12 +3014,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedBool: ['en' => null, 'de' => false]), self::document(key: 'key4', translatedBool: ['de' => false]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'translatedBool', value: false) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', translatedBool: ['en' => true, 'de' => false]), ]) ]; @@ -3031,12 +3031,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedDate: ['en' => null, 'de' => '2021-01-02 00:00:00.000']), self::document(key: 'key4', translatedDate: ['de' => '2021-01-02 00:00:00.000']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'translatedDate', value: '2021-01-02 00:00:00.000') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedDate: ['en' => '2021-01-02 00:00:00.000']), self::document(key: 'key3', translatedDate: ['en' => null, 'de' => '2021-01-02 00:00:00.000']), self::document(key: 'key4', translatedDate: ['de' => '2021-01-02 00:00:00.000']), @@ -3049,12 +3049,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedDate: ['en' => null, 'de' => '2021-01-03 00:00:00.000']), self::document(key: 'key4', translatedDate: ['de' => '2021-01-02 00:00:00.000']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'translatedDate', value: ['2021-01-02 00:00:00.000', '2021-01-03 00:00:00.000']) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedDate: ['en' => '2021-01-02 00:00:00.000']), self::document(key: 'key3', translatedDate: ['en' => null, 'de' => '2021-01-03 00:00:00.000']), self::document(key: 'key4', translatedDate: ['de' => '2021-01-02 00:00:00.000']), @@ -3067,12 +3067,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedDate: ['en' => null, 'de' => '2021-01-02 00:00:00.000']), self::document(key: 'key4', translatedDate: ['de' => '2021-01-02 00:00:00.000']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'translatedDate', value: '2021-01-02 00:00:00.000') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', translatedDate: ['en' => '2021-01-01 00:00:00.000', 'de' => '2021-01-02 00:00:00.000']), ]) ]; @@ -3083,12 +3083,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedDate: ['en' => null, 'de' => '2021-01-02 00:00:00.000']), self::document(key: 'key4', translatedDate: ['de' => '2021-01-02 00:00:00.000']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Neither(field: 'translatedDate', value: ['2021-01-01 00:00:00.000', '2021-01-02 00:00:00.000']) ] ), - 'expected' => new FilterResult([]) + 'expected' => new Result([]) ]; yield 'Test translated date field gte filter' => [ 'input' => new Documents([ @@ -3097,12 +3097,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedDate: ['en' => null, 'de' => '2021-01-02 00:00:00.000']), self::document(key: 'key4', translatedDate: ['de' => '2021-01-01 00:00:00.000']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gte(field: 'translatedDate', value: '2021-01-02 00:00:00.000') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedDate: ['en' => '2021-01-03 00:00:00.000']), self::document(key: 'key3', translatedDate: ['en' => null, 'de' => '2021-01-02 00:00:00.000']), ]) @@ -3114,12 +3114,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedDate: ['en' => null, 'de' => '2021-01-02 00:00:00.000']), self::document(key: 'key4', translatedDate: ['de' => '2021-01-01 00:00:00.000']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gt(field: 'translatedDate', value: '2021-01-02 00:00:00.000') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedDate: ['en' => '2021-01-03 00:00:00.000']), ]) ]; @@ -3130,12 +3130,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedDate: ['en' => null, 'de' => '2021-01-02 00:00:00.000']), self::document(key: 'key4', translatedDate: ['de' => '2021-01-01 00:00:00.000']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lte(field: 'translatedDate', value: '2021-01-02 00:00:00.000') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', translatedDate: ['en' => '2021-01-01 00:00:00.000', 'de' => '2021-01-02 00:00:00.000']), self::document(key: 'key3', translatedDate: ['en' => null, 'de' => '2021-01-02 00:00:00.000']), self::document(key: 'key4', translatedDate: ['de' => '2021-01-01 00:00:00.000']), @@ -3148,12 +3148,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedDate: ['en' => null, 'de' => '2021-01-02 00:00:00.000']), self::document(key: 'key4', translatedDate: ['de' => '2021-01-01 00:00:00.000']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lt(field: 'translatedDate', value: '2021-01-02 00:00:00.000') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', translatedDate: ['en' => '2021-01-01 00:00:00.000', 'de' => '2021-01-02 00:00:00.000']), self::document(key: 'key4', translatedDate: ['de' => '2021-01-01 00:00:00.000']), ]) @@ -3166,12 +3166,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'bar']), self::document(key: 'key4', translatedString: ['de' => 'bar']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'translatedString', value: 'bar') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedString: ['en' => 'bar']), self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'bar']), self::document(key: 'key4', translatedString: ['de' => 'bar']), @@ -3184,12 +3184,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'baz']), self::document(key: 'key4', translatedString: ['de' => 'bar']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'translatedString', value: ['bar', 'baz']) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedString: ['en' => 'bar']), self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'baz']), self::document(key: 'key4', translatedString: ['de' => 'bar']), @@ -3202,12 +3202,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'bar']), self::document(key: 'key4', translatedString: ['de' => 'bar']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'translatedString', value: 'bar') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', translatedString: ['en' => 'foo', 'de' => 'bar']), ]) ]; @@ -3218,12 +3218,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'bar']), self::document(key: 'key4', translatedString: ['de' => 'bar']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Neither(field: 'translatedString', value: ['foo', 'bar']) ] ), - 'expected' => new FilterResult([]) + 'expected' => new Result([]) ]; yield 'Test translated list field contains filter and string values' => [ 'input' => new Documents([ @@ -3232,12 +3232,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'bar']), self::document(key: 'key4', translatedString: ['de' => 'bar']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Contains(field: 'translatedString', value: 'ba') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedString: ['en' => 'bar']), self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'bar']), self::document(key: 'key4', translatedString: ['de' => 'bar']), @@ -3251,12 +3251,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedInt: ['en' => null, 'de' => 2]), self::document(key: 'key4', translatedInt: ['de' => 2]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'translatedInt', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedInt: ['en' => 2]), self::document(key: 'key3', translatedInt: ['en' => null, 'de' => 2]), self::document(key: 'key4', translatedInt: ['de' => 2]), @@ -3269,12 +3269,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedInt: ['en' => null, 'de' => 3]), self::document(key: 'key4', translatedInt: ['de' => 2]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'translatedInt', value: [2, 3]) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedInt: ['en' => 2]), self::document(key: 'key3', translatedInt: ['en' => null, 'de' => 3]), self::document(key: 'key4', translatedInt: ['de' => 2]), @@ -3287,12 +3287,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedInt: ['en' => null, 'de' => 2]), self::document(key: 'key4', translatedInt: ['de' => 2]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'translatedInt', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', translatedInt: ['en' => 1, 'de' => 2]), ]) ]; @@ -3303,12 +3303,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedInt: ['en' => null, 'de' => 2]), self::document(key: 'key4', translatedInt: ['de' => 2]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Neither(field: 'translatedInt', value: [1, 2]) ] ), - 'expected' => new FilterResult([]) + 'expected' => new Result([]) ]; yield 'Test translated list field equals filter and float values' => [ @@ -3318,12 +3318,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedFloat: ['en' => null, 'de' => 2.2]), self::document(key: 'key4', translatedFloat: ['de' => 2.2]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'translatedFloat', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedFloat: ['en' => 2.2]), self::document(key: 'key3', translatedFloat: ['en' => null, 'de' => 2.2]), self::document(key: 'key4', translatedFloat: ['de' => 2.2]), @@ -3336,12 +3336,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedFloat: ['en' => null, 'de' => 3.3]), self::document(key: 'key4', translatedFloat: ['de' => 2.2]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'translatedFloat', value: [2.2, 3.3]) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedFloat: ['en' => 2.2]), self::document(key: 'key3', translatedFloat: ['en' => null, 'de' => 3.3]), self::document(key: 'key4', translatedFloat: ['de' => 2.2]), @@ -3354,12 +3354,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedFloat: ['en' => null, 'de' => 2.2]), self::document(key: 'key4', translatedFloat: ['de' => 2.2]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'translatedFloat', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', translatedFloat: ['en' => 1.1, 'de' => 2.2]), ]) ]; @@ -3370,12 +3370,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedFloat: ['en' => null, 'de' => 2.2]), self::document(key: 'key4', translatedFloat: ['de' => 2.2]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Neither(field: 'translatedFloat', value: [1.1, 2.2]) ] ), - 'expected' => new FilterResult([]) + 'expected' => new Result([]) ]; yield 'Test translated list field equals filter and bool values' => [ @@ -3385,12 +3385,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedBool: ['en' => null, 'de' => false]), self::document(key: 'key4', translatedBool: ['de' => false]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'translatedBool', value: false) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedBool: ['en' => false]), self::document(key: 'key3', translatedBool: ['en' => null, 'de' => false]), self::document(key: 'key4', translatedBool: ['de' => false]), @@ -3403,12 +3403,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedBool: ['en' => null, 'de' => true]), self::document(key: 'key4', translatedBool: ['de' => false]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'translatedBool', value: [false, true]) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', translatedBool: ['en' => true, 'de' => false]), self::document(key: 'key2', translatedBool: ['en' => false]), self::document(key: 'key3', translatedBool: ['en' => null, 'de' => true]), @@ -3422,12 +3422,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedBool: ['en' => null, 'de' => false]), self::document(key: 'key4', translatedBool: ['de' => false]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'translatedBool', value: false) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', translatedBool: ['en' => true, 'de' => false]), ]) ]; @@ -3438,12 +3438,12 @@ final public static function storageProvider(): \Generator self::document(key: 'key3', translatedBool: ['en' => null, 'de' => false]), self::document(key: 'key4', translatedBool: ['de' => false]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Neither(field: 'translatedBool', value: [true, false]) ] ), - 'expected' => new FilterResult([]) + 'expected' => new Result([]) ]; } diff --git a/tests/Common/KeyValueStorageTestBase.php b/tests/Common/KeyValueStorageTestBase.php index cfc99dd..66599c9 100644 --- a/tests/Common/KeyValueStorageTestBase.php +++ b/tests/Common/KeyValueStorageTestBase.php @@ -6,11 +6,12 @@ use PHPUnit\Framework\TestCase; use Shopware\Storage\Common\Document\Document; use Shopware\Storage\Common\Document\Documents; -use Shopware\Storage\Common\KeyValue\KeyValueStorage; +use Shopware\Storage\Common\KeyValue\KeyAware; +use Shopware\Storage\Common\Storage; abstract class KeyValueStorageTestBase extends TestCase { - abstract public function getStorage(): KeyValueStorage; + abstract public function getStorage(): KeyAware&Storage; #[DataProvider('storeProvider')] final public function testSingle(Documents $input): void diff --git a/tests/DynamoDB/DynamoDBKeyValueStorageTest.php b/tests/DynamoDB/DynamoDBKeyValueStorageTest.php index efe89c8..aa19461 100644 --- a/tests/DynamoDB/DynamoDBKeyValueStorageTest.php +++ b/tests/DynamoDB/DynamoDBKeyValueStorageTest.php @@ -8,12 +8,13 @@ use AsyncAws\DynamoDb\ValueObject\AttributeDefinition; use AsyncAws\DynamoDb\ValueObject\KeySchemaElement; use AsyncAws\DynamoDb\ValueObject\ProvisionedThroughput; -use Shopware\Storage\Common\KeyValue\KeyValueStorage; -use Shopware\Storage\DynamoDB\DynamoDBKeyValueStorage; +use Shopware\Storage\Common\KeyValue\KeyAware; +use Shopware\Storage\Common\Storage; +use Shopware\Storage\DynamoDB\DynamoDBKeyStorage; use Shopware\StorageTests\Common\KeyValueStorageTestBase; /** - * @covers \Shopware\Storage\DynamoDB\DynamoDBKeyValueStorage + * @covers \Shopware\Storage\DynamoDB\DynamoDBKeyStorage */ class DynamoDBKeyValueStorageTest extends KeyValueStorageTestBase { @@ -44,9 +45,9 @@ protected function setUp(): void } } - public function getStorage(): KeyValueStorage + public function getStorage(): KeyAware&Storage { - return new DynamoDBKeyValueStorage( + return new DynamoDBKeyStorage( $this->getClient(), 'test' ); diff --git a/tests/Meilisearch/LiveMeilisearchStorage.php b/tests/Meilisearch/LiveMeilisearchAware.php similarity index 75% rename from tests/Meilisearch/LiveMeilisearchStorage.php rename to tests/Meilisearch/LiveMeilisearchAware.php index 6343510..e91b5ad 100644 --- a/tests/Meilisearch/LiveMeilisearchStorage.php +++ b/tests/Meilisearch/LiveMeilisearchAware.php @@ -5,20 +5,20 @@ use Meilisearch\Client; use Meilisearch\Contracts\TasksQuery; use Shopware\Storage\Common\Document\Documents; -use Shopware\Storage\Common\Filter\FilterCriteria; -use Shopware\Storage\Common\Filter\FilterResult; -use Shopware\Storage\Common\Filter\FilterStorage; +use Shopware\Storage\Common\Filter\Criteria; +use Shopware\Storage\Common\Filter\Result; +use Shopware\Storage\Common\Filter\FilterAware; use Shopware\Storage\Common\Storage; use Shopware\Storage\Common\StorageContext; -class LiveMeilisearchStorage implements Storage, FilterStorage +class LiveMeilisearchAware implements Storage, FilterAware { public function __construct( - private readonly FilterStorage $storage, + private readonly FilterAware&Storage $storage, private readonly Client $client ) {} - public function filter(FilterCriteria $criteria, StorageContext $context): FilterResult + public function filter(Criteria $criteria, StorageContext $context): Result { return $this->storage->filter($criteria, $context); } diff --git a/tests/Meilisearch/MeilisearchStorageTest.php b/tests/Meilisearch/MeilisearchStorageTest.php index fe4715a..d9b7802 100644 --- a/tests/Meilisearch/MeilisearchStorageTest.php +++ b/tests/Meilisearch/MeilisearchStorageTest.php @@ -9,9 +9,9 @@ use PHPUnit\Framework\Attributes\DataProvider; use Shopware\Storage\Common\Document\Documents; use Shopware\Storage\Common\Exception\NotSupportedByEngine; -use Shopware\Storage\Common\Filter\FilterCriteria; -use Shopware\Storage\Common\Filter\FilterResult; -use Shopware\Storage\Common\Filter\FilterStorage; +use Shopware\Storage\Common\Filter\Criteria; +use Shopware\Storage\Common\Filter\Result; +use Shopware\Storage\Common\Filter\FilterAware; use Shopware\Storage\Common\Filter\Paging\Page; use Shopware\Storage\Common\Filter\Type\Any; use Shopware\Storage\Common\Filter\Type\Contains; @@ -24,6 +24,7 @@ use Shopware\Storage\Common\Filter\Type\Not; use Shopware\Storage\Common\Filter\Type\Prefix; use Shopware\Storage\Common\Filter\Type\Suffix; +use Shopware\Storage\Common\Storage; use Shopware\Storage\Common\StorageContext; use Shopware\Storage\Meilisearch\MeilisearchStorage; use Shopware\StorageTests\Common\FilterStorageTestBase; @@ -82,8 +83,8 @@ protected function setUp(): void #[DataProvider('debugProvider')] public function testDebug( Documents $input, - FilterCriteria $criteria, - FilterResult $expected + Criteria $criteria, + Result $expected ): void { $storage = $this->getStorage(); @@ -106,12 +107,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectField: ['foo' => 'baz']), self::document(key: 'key3', objectField: ['foo' => 'qux']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'objectField.foo', value: 'baz') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectField: ['foo' => 'baz']), ]) ]; @@ -121,12 +122,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectField: ['foo' => 'baz']), self::document(key: 'key3', objectField: ['foo' => 'qux']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'objectField.foo', value: ['baz', 'qux']) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectField: ['foo' => 'baz']), self::document(key: 'key3', objectField: ['foo' => 'qux']), ]) @@ -137,12 +138,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectField: ['foo' => 'baz']), self::document(key: 'key3', objectField: ['foo' => 'qux']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'objectField.foo', value: 'baz') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectField: ['foo' => 'bar']), self::document(key: 'key3', objectField: ['foo' => 'qux']), ]) @@ -153,12 +154,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectField: ['foo' => 'baz']), self::document(key: 'key3', objectField: ['foo' => 'qux']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Neither(field: 'objectField.foo', value: ['baz', 'qux']) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectField: ['foo' => 'bar']), ]) ]; @@ -168,12 +169,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectField: ['foo' => 'baz']), self::document(key: 'key3', objectField: ['foo' => 'qux']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Contains(field: 'objectField.foo', value: 'ba') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectField: ['foo' => 'bar']), self::document(key: 'key2', objectField: ['foo' => 'baz']), ]) @@ -184,12 +185,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectField: ['foo' => 'baz']), self::document(key: 'key3', objectField: ['foo' => 'qux']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gte(field: 'objectField.foo', value: 'baz') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectField: ['foo' => 'baz']), self::document(key: 'key3', objectField: ['foo' => 'qux']), ]) @@ -200,12 +201,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectField: ['foo' => 'baz']), self::document(key: 'key3', objectField: ['foo' => 'qux']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lte(field: 'objectField.foo', value: 'baz') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectField: ['foo' => 'bar']), self::document(key: 'key2', objectField: ['foo' => 'baz']), ]) @@ -216,12 +217,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectField: ['foo' => 'baz']), self::document(key: 'key3', objectField: ['foo' => 'qux']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gt(field: 'objectField.foo', value: 'baz') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key3', objectField: ['foo' => 'qux']), ]) ]; @@ -231,12 +232,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectField: ['foo' => 'baz']), self::document(key: 'key3', objectField: ['foo' => 'qux']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lt(field: 'objectField.foo', value: 'baz') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectField: ['foo' => 'bar']), ]) ]; @@ -247,12 +248,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectField: ['fooInt' => 2]), self::document(key: 'key3', objectField: ['fooInt' => 3]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'objectField.fooInt', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectField: ['fooInt' => 2]), ]) ]; @@ -262,12 +263,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectField: ['fooInt' => 2]), self::document(key: 'key3', objectField: ['fooInt' => 3]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'objectField.fooInt', value: [1, 2]) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectField: ['fooInt' => 1]), self::document(key: 'key2', objectField: ['fooInt' => 2]), ]) @@ -278,12 +279,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectField: ['fooInt' => 2]), self::document(key: 'key3', objectField: ['fooInt' => 3]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'objectField.fooInt', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectField: ['fooInt' => 1]), self::document(key: 'key3', objectField: ['fooInt' => 3]), ]) @@ -294,12 +295,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectField: ['fooInt' => 2]), self::document(key: 'key3', objectField: ['fooInt' => 3]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Neither(field: 'objectField.fooInt', value: [1, 2]) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key3', objectField: ['fooInt' => 3]), ]) ]; @@ -309,12 +310,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectField: ['fooInt' => 2]), self::document(key: 'key3', objectField: ['fooInt' => 3]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gte(field: 'objectField.fooInt', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectField: ['fooInt' => 2]), self::document(key: 'key3', objectField: ['fooInt' => 3]), ]) @@ -325,12 +326,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectField: ['fooInt' => 2]), self::document(key: 'key3', objectField: ['fooInt' => 3]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lte(field: 'objectField.fooInt', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectField: ['fooInt' => 1]), self::document(key: 'key2', objectField: ['fooInt' => 2]), ]) @@ -341,12 +342,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectField: ['fooInt' => 2]), self::document(key: 'key3', objectField: ['fooInt' => 3]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gt(field: 'objectField.fooInt', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key3', objectField: ['fooInt' => 3]), ]) ]; @@ -356,12 +357,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectField: ['fooInt' => 2]), self::document(key: 'key3', objectField: ['fooInt' => 3]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lt(field: 'objectField.fooInt', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectField: ['fooInt' => 1]), ]) ]; @@ -372,13 +373,13 @@ public static function debugProvider(): \Generator self::document(key: 'key3', objectField: ['fooInt' => 3]), self::document(key: 'key4', objectField: ['fooInt' => 4]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gte(field: 'objectField.fooInt', value: 2), new Lte(field: 'objectField.fooInt', value: 3), ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectField: ['fooInt' => 2]), self::document(key: 'key3', objectField: ['fooInt' => 3]), ]) @@ -390,12 +391,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectField: ['fooFloat' => 2.2]), self::document(key: 'key3', objectField: ['fooFloat' => 3.3]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'objectField.fooFloat', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectField: ['fooFloat' => 2.2]), ]) ]; @@ -405,12 +406,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectField: ['fooFloat' => 2.2]), self::document(key: 'key3', objectField: ['fooFloat' => 3.3]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'objectField.fooFloat', value: [1.1, 2.2]) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectField: ['fooFloat' => 1.1]), self::document(key: 'key2', objectField: ['fooFloat' => 2.2]), ]) @@ -421,12 +422,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectField: ['fooFloat' => 2.2]), self::document(key: 'key3', objectField: ['fooFloat' => 3.3]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'objectField.fooFloat', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectField: ['fooFloat' => 1.1]), self::document(key: 'key3', objectField: ['fooFloat' => 3.3]), ]) @@ -437,12 +438,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectField: ['fooFloat' => 2.2]), self::document(key: 'key3', objectField: ['fooFloat' => 3.3]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Neither(field: 'objectField.fooFloat', value: [1.1, 2.2]) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key3', objectField: ['fooFloat' => 3.3]), ]) ]; @@ -452,12 +453,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectField: ['fooFloat' => 2.2]), self::document(key: 'key3', objectField: ['fooFloat' => 3.3]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gte(field: 'objectField.fooFloat', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectField: ['fooFloat' => 2.2]), self::document(key: 'key3', objectField: ['fooFloat' => 3.3]), ]) @@ -468,12 +469,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectField: ['fooFloat' => 2.2]), self::document(key: 'key3', objectField: ['fooFloat' => 3.3]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lte(field: 'objectField.fooFloat', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectField: ['fooFloat' => 1.1]), self::document(key: 'key2', objectField: ['fooFloat' => 2.2]), ]) @@ -484,12 +485,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectField: ['fooFloat' => 2.2]), self::document(key: 'key3', objectField: ['fooFloat' => 3.3]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gt(field: 'objectField.fooFloat', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key3', objectField: ['fooFloat' => 3.3]), ]) ]; @@ -499,12 +500,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectField: ['fooFloat' => 2.2]), self::document(key: 'key3', objectField: ['fooFloat' => 3.3]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lt(field: 'objectField.fooFloat', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectField: ['fooFloat' => 1.1]), ]) ]; @@ -515,13 +516,13 @@ public static function debugProvider(): \Generator self::document(key: 'key3', objectField: ['fooFloat' => 3.3]), self::document(key: 'key4', objectField: ['fooFloat' => 4.4]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gte(field: 'objectField.fooFloat', value: 2.2), new Lte(field: 'objectField.fooFloat', value: 3.3), ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectField: ['fooFloat' => 2.2]), self::document(key: 'key3', objectField: ['fooFloat' => 3.3]), ]) @@ -533,12 +534,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectField: ['fooDate' => '2021-01-02 00:00:00.000']), self::document(key: 'key3', objectField: ['fooDate' => '2021-01-03 00:00:00.000']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'objectField.fooDate', value: '2021-01-02') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectField: ['fooDate' => '2021-01-02 00:00:00.000']), ]) ]; @@ -548,12 +549,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectField: ['fooDate' => '2021-01-02 00:00:00.000']), self::document(key: 'key3', objectField: ['fooDate' => '2021-01-03 00:00:00.000']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'objectField.fooDate', value: ['2021-01-02', '2021-01-03']) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectField: ['fooDate' => '2021-01-02 00:00:00.000']), self::document(key: 'key3', objectField: ['fooDate' => '2021-01-03 00:00:00.000']), ]) @@ -564,12 +565,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectField: ['fooDate' => '2021-01-02 00:00:00.000']), self::document(key: 'key3', objectField: ['fooDate' => '2021-01-03 00:00:00.000']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'objectField.fooDate', value: '2021-01-02') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectField: ['fooDate' => '2021-01-01 00:00:00.000']), self::document(key: 'key3', objectField: ['fooDate' => '2021-01-03 00:00:00.000']), ]) @@ -580,12 +581,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectField: ['fooDate' => '2021-01-02 00:00:00.000']), self::document(key: 'key3', objectField: ['fooDate' => '2021-01-03 00:00:00.000']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Neither(field: 'objectField.fooDate', value: ['2021-01-02', '2021-01-03']) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectField: ['fooDate' => '2021-01-01 00:00:00.000']), ]) ]; @@ -595,12 +596,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectField: ['fooDate' => '2021-01-02 00:00:00.000']), self::document(key: 'key3', objectField: ['fooDate' => '2021-01-03 00:00:00.000']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gte(field: 'objectField.fooDate', value: '2021-01-02') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectField: ['fooDate' => '2021-01-02 00:00:00.000']), self::document(key: 'key3', objectField: ['fooDate' => '2021-01-03 00:00:00.000']), ]) @@ -611,12 +612,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectField: ['fooDate' => '2021-01-02 00:00:00.000']), self::document(key: 'key3', objectField: ['fooDate' => '2021-01-03 00:00:00.000']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lte(field: 'objectField.fooDate', value: '2021-01-02') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectField: ['fooDate' => '2021-01-01 00:00:00.000']), self::document(key: 'key2', objectField: ['fooDate' => '2021-01-02 00:00:00.000']), ]) @@ -627,12 +628,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectField: ['fooDate' => '2021-01-02 00:00:00.000']), self::document(key: 'key3', objectField: ['fooDate' => '2021-01-03 00:00:00.000']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gt(field: 'objectField.fooDate', value: '2021-01-02') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key3', objectField: ['fooDate' => '2021-01-03 00:00:00.000']), ]) ]; @@ -642,12 +643,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectField: ['fooDate' => '2021-01-02 00:00:00.000']), self::document(key: 'key3', objectField: ['fooDate' => '2021-01-03 00:00:00.000']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lt(field: 'objectField.fooDate', value: '2021-01-02') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectField: ['fooDate' => '2021-01-01 00:00:00.000']), ]) ]; @@ -658,13 +659,13 @@ public static function debugProvider(): \Generator self::document(key: 'key3', objectField: ['fooDate' => '2021-01-03 00:00:00.000']), self::document(key: 'key4', objectField: ['fooDate' => '2021-01-04 00:00:00.000']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gte(field: 'objectField.fooDate', value: '2021-01-02'), new Lte(field: 'objectField.fooDate', value: '2021-01-03'), ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectField: ['fooDate' => '2021-01-02 00:00:00.000']), self::document(key: 'key3', objectField: ['fooDate' => '2021-01-03 00:00:00.000']), ]) @@ -676,12 +677,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', listField: ['foo', 'baz']), self::document(key: 'key3', listField: ['foo', 'qux']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'listField', value: 'baz') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', listField: ['foo', 'baz']), ]) ]; @@ -691,12 +692,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', listField: ['foo', 'baz']), self::document(key: 'key3', listField: ['foo', 'qux']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'listField', value: ['baz', 'qux']) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', listField: ['foo', 'baz']), self::document(key: 'key3', listField: ['foo', 'qux']), ]) @@ -707,12 +708,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', listField: ['foo', 'baz']), self::document(key: 'key3', listField: ['foo', 'qux']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'listField', value: 'baz') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', listField: ['foo', 'bar']), self::document(key: 'key3', listField: ['foo', 'qux']), ]) @@ -723,12 +724,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', listField: ['foo', 'baz']), self::document(key: 'key3', listField: ['foo', 'qux']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Neither(field: 'listField', value: ['baz', 'qux']) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', listField: ['foo', 'bar']), ]) ]; @@ -738,12 +739,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', listField: ['foo', 'baz']), self::document(key: 'key3', listField: ['foo', 'qux']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Contains(field: 'listField', value: 'ba') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', listField: ['foo', 'bar']), self::document(key: 'key2', listField: ['foo', 'baz']), ]) @@ -754,12 +755,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', listField: [1, 3]), self::document(key: 'key3', listField: null), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'listField', value: null) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key3', listField: null) ]) ]; @@ -769,12 +770,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', listField: [1, 3]), self::document(key: 'key3', listField: null), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'listField', value: null) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document('key1', listField: [1, 2]), self::document('key2', listField: [1, 3]) ]) @@ -786,12 +787,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', listField: [1, 3]), self::document(key: 'key3', listField: [1, 4]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'listField', value: 3) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', listField: [1, 3]), ]) ]; @@ -801,12 +802,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', listField: [1, 3]), self::document(key: 'key3', listField: [1, 4]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'listField', value: [3, 4]) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', listField: [1, 3]), self::document(key: 'key3', listField: [1, 4]), ]) @@ -817,12 +818,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', listField: [1, 3]), self::document(key: 'key3', listField: [1, 4]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'listField', value: 3) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', listField: [1, 2]), self::document(key: 'key3', listField: [1, 4]), ]) @@ -833,12 +834,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', listField: [1, 3]), self::document(key: 'key3', listField: [1, 4]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Neither(field: 'listField', value: [3, 4]) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', listField: [1, 2]), ]) ]; @@ -848,12 +849,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', listField: [1.1, 3.3]), self::document(key: 'key3', listField: [1.1, 4.4]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'listField', value: 3.3) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', listField: [1.1, 3.3]), ]) ]; @@ -863,12 +864,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', listField: [1.1, 3.3]), self::document(key: 'key3', listField: [1.1, 4.4]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'listField', value: [3.3, 4.4]) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', listField: [1.1, 3.3]), self::document(key: 'key3', listField: [1.1, 4.4]), ]) @@ -879,12 +880,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', listField: [1.1, 3.3]), self::document(key: 'key3', listField: [1.1, 4.4]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'listField', value: 3.3) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', listField: [1.1, 2.2]), self::document(key: 'key3', listField: [1.1, 4.4]), ]) @@ -895,12 +896,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', listField: [1.1, 3.3]), self::document(key: 'key3', listField: [1.1, 4.4]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Neither(field: 'listField', value: [3.3, 4.4]) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', listField: [1.1, 2.2]), ]) ]; @@ -910,12 +911,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', listField: ['2021-01-01', '2021-01-03']), self::document(key: 'key3', listField: ['2021-01-01', '2021-01-04']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'listField', value: '2021-01-03') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', listField: ['2021-01-01', '2021-01-03']), ]) ]; @@ -925,12 +926,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', listField: ['2021-01-01', '2021-01-03']), self::document(key: 'key3', listField: ['2021-01-01', '2021-01-04']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'listField', value: ['2021-01-03', '2021-01-04']) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', listField: ['2021-01-01', '2021-01-03']), self::document(key: 'key3', listField: ['2021-01-01', '2021-01-04']), ]) @@ -941,12 +942,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', listField: ['2021-01-01', '2021-01-03']), self::document(key: 'key3', listField: ['2021-01-01', '2021-01-04']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'listField', value: '2021-01-03') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', listField: ['2021-01-01', '2021-01-02']), self::document(key: 'key3', listField: ['2021-01-01', '2021-01-04']), ]) @@ -957,12 +958,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', listField: ['2021-01-01', '2021-01-03']), self::document(key: 'key3', listField: ['2021-01-01', '2021-01-04']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Neither(field: 'listField', value: ['2021-01-03', '2021-01-04']) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', listField: ['2021-01-01', '2021-01-02']), ]) ]; @@ -972,12 +973,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', listField: ['2021-01-01', '2021-01-03']), self::document(key: 'key3', listField: ['2021-01-01', '2021-01-04']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Contains(field: 'listField', value: '2021-01-02') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', listField: ['2021-01-01', '2021-01-02']), ]) ]; @@ -988,12 +989,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectListField: [['foo' => 'baz'], ['foo' => 'baz-2']]), self::document(key: 'key3', objectListField: [['foo' => 'qux'], ['foo' => 'qux-2'], ['foo' => 'baz-2']]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'objectListField.foo', value: 'baz-2') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectListField: [['foo' => 'baz'], ['foo' => 'baz-2']]), self::document(key: 'key3', objectListField: [['foo' => 'qux'], ['foo' => 'qux-2'], ['foo' => 'baz-2']]), ]) @@ -1004,12 +1005,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectListField: [['foo' => 'baz'], ['foo' => 'baz-2']]), self::document(key: 'key3', objectListField: [['foo' => 'qux'], ['foo' => 'qux-2'], ['foo' => 'baz-2']]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'objectListField.foo', value: ['bar-2', 'qux-2']) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectListField: [['foo' => 'bar'], ['foo' => 'bar-2']]), self::document(key: 'key3', objectListField: [['foo' => 'qux'], ['foo' => 'qux-2'], ['foo' => 'baz-2']]), ]) @@ -1020,12 +1021,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectListField: [['foo' => 'baz'], ['foo' => 'baz-2']]), self::document(key: 'key3', objectListField: [['foo' => 'qux'], ['foo' => 'qux-2'], ['foo' => 'baz-2']]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Contains(field: 'objectListField.foo', value: 'baz') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectListField: [['foo' => 'baz'], ['foo' => 'baz-2']]), self::document(key: 'key3', objectListField: [['foo' => 'qux'], ['foo' => 'qux-2'], ['foo' => 'baz-2']]), ]) @@ -1036,12 +1037,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectListField: [['foo' => 'baz'], ['foo' => 'baz-2']]), self::document(key: 'key3', objectListField: [['foo' => 'qux'], ['foo' => 'qux-2'], ['foo' => 'baz-2']]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Prefix(field: 'objectListField.foo', value: 'qu') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key3', objectListField: [['foo' => 'qux'], ['foo' => 'qux-2'], ['foo' => 'baz-2']]), ]) ]; @@ -1051,12 +1052,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectListField: [['foo' => 'baz'], ['foo' => 'baz-2']]), self::document(key: 'key3', objectListField: [['foo' => 'qux'], ['foo' => 'qux-2'], ['foo' => 'baz-2']]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Suffix(field: 'objectListField.foo', value: 'z-2') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectListField: [['foo' => 'baz'], ['foo' => 'baz-2']]), self::document(key: 'key3', objectListField: [['foo' => 'qux'], ['foo' => 'qux-2'], ['foo' => 'baz-2']]), ]) @@ -1068,12 +1069,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectListField: [['fooInt' => 10], ['fooInt' => 2]]), self::document(key: 'key3', objectListField: [['fooInt' => 20], ['fooInt' => 22], ['fooInt' => 24]]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'objectListField.fooInt', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectListField: [['fooInt' => 1], ['fooInt' => 2]]), self::document(key: 'key2', objectListField: [['fooInt' => 10], ['fooInt' => 2]]), ]) @@ -1084,12 +1085,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectListField: [['fooInt' => 10], ['fooInt' => 2]]), self::document(key: 'key3', objectListField: [['fooInt' => 20], ['fooInt' => 22], ['fooInt' => 24]]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'objectListField.fooInt', value: [10, 22]) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectListField: [['fooInt' => 10], ['fooInt' => 2]]), self::document(key: 'key3', objectListField: [['fooInt' => 20], ['fooInt' => 22], ['fooInt' => 24]]), ]) @@ -1100,12 +1101,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectListField: [['fooInt' => 10], ['fooInt' => 2]]), self::document(key: 'key3', objectListField: [['fooInt' => 20], ['fooInt' => 22], ['fooInt' => 24]]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gte(field: 'objectListField.fooInt', value: 22) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key3', objectListField: [['fooInt' => 20], ['fooInt' => 22], ['fooInt' => 24]]), ]) ]; @@ -1115,12 +1116,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectListField: [['fooInt' => 10], ['fooInt' => 2]]), self::document(key: 'key3', objectListField: [['fooInt' => 20], ['fooInt' => 22], ['fooInt' => 24]]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lte(field: 'objectListField.fooInt', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectListField: [['fooInt' => 1], ['fooInt' => 2]]), self::document(key: 'key2', objectListField: [['fooInt' => 10], ['fooInt' => 2]]), ]) @@ -1131,12 +1132,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectListField: [['fooInt' => 10], ['fooInt' => 2]]), self::document(key: 'key3', objectListField: [['fooInt' => 20], ['fooInt' => 22], ['fooInt' => 24]]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gt(field: 'objectListField.fooInt', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectListField: [['fooInt' => 10], ['fooInt' => 2]]), self::document(key: 'key3', objectListField: [['fooInt' => 20], ['fooInt' => 22], ['fooInt' => 24]]), ]) @@ -1147,12 +1148,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectListField: [['fooInt' => 10], ['fooInt' => 2]]), self::document(key: 'key3', objectListField: [['fooInt' => 20], ['fooInt' => 22], ['fooInt' => 24]]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lt(field: 'objectListField.fooInt', value: 20) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectListField: [['fooInt' => 1], ['fooInt' => 2]]), self::document(key: 'key2', objectListField: [['fooInt' => 10], ['fooInt' => 2]]), ]) @@ -1164,12 +1165,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectListField: [['fooFloat' => 10.1], ['fooFloat' => 2.2]]), self::document(key: 'key3', objectListField: [['fooFloat' => 20.1], ['fooFloat' => 22.2], ['fooFloat' => 24.2]]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'objectListField.fooFloat', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectListField: [['fooFloat' => 1.1], ['fooFloat' => 2.2]]), self::document(key: 'key2', objectListField: [['fooFloat' => 10.1], ['fooFloat' => 2.2]]), ]) @@ -1181,12 +1182,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', objectListField: [['fooFloat' => 20.1], ['fooFloat' => 22.2], ['fooFloat' => 24.2]]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'objectListField.fooFloat', value: [10.1, 22.2]) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectListField: [['fooFloat' => 10.1], ['fooFloat' => 2.2]]), self::document(key: 'key3', objectListField: [['fooFloat' => 20.1], ['fooFloat' => 22.2], ['fooFloat' => 24.2]]), ]) @@ -1197,12 +1198,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectListField: [['fooFloat' => 10.1], ['fooFloat' => 2.2]]), self::document(key: 'key3', objectListField: [['fooFloat' => 20.1], ['fooFloat' => 22.2], ['fooFloat' => 24.2]]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gte(field: 'objectListField.fooFloat', value: 22.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key3', objectListField: [['fooFloat' => 20.1], ['fooFloat' => 22.2], ['fooFloat' => 24.2]]), ]) ]; @@ -1213,12 +1214,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectListField: [['fooFloat' => 10.1], ['fooFloat' => 2.2]]), self::document(key: 'key3', objectListField: [['fooFloat' => 20.1], ['fooFloat' => 22.2], ['fooFloat' => 24.2]]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lte(field: 'objectListField.fooFloat', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectListField: [['fooFloat' => 1.1], ['fooFloat' => 2.2]]), self::document(key: 'key2', objectListField: [['fooFloat' => 10.1], ['fooFloat' => 2.2]]), ]) @@ -1229,12 +1230,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectListField: [['fooFloat' => 10.1], ['fooFloat' => 2.2]]), self::document(key: 'key3', objectListField: [['fooFloat' => 20.1], ['fooFloat' => 22.2], ['fooFloat' => 24.2]]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gt(field: 'objectListField.fooFloat', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectListField: [['fooFloat' => 10.1], ['fooFloat' => 2.2]]), self::document(key: 'key3', objectListField: [['fooFloat' => 20.1], ['fooFloat' => 22.2], ['fooFloat' => 24.2]]), ]) @@ -1245,12 +1246,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectListField: [['fooFloat' => 10.1], ['fooFloat' => 2.2]]), self::document(key: 'key3', objectListField: [['fooFloat' => 20.1], ['fooFloat' => 22.2], ['fooFloat' => 24.2]]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lt(field: 'objectListField.fooFloat', value: 20.1) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectListField: [['fooFloat' => 1.1], ['fooFloat' => 2.2]]), self::document(key: 'key2', objectListField: [['fooFloat' => 10.1], ['fooFloat' => 2.2]]), ]) @@ -1262,12 +1263,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectListField: [['fooDate' => '2021-01-10 00:00:00.000'], ['fooDate' => '2021-01-02 00:00:00.000']]), self::document(key: 'key3', objectListField: [['fooDate' => '2021-01-20 00:00:00.000'], ['fooDate' => '2021-01-22 00:00:00.000'], ['fooDate' => '2021-01-24 00:00:00.000']]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'objectListField.fooDate', value: '2021-01-02 00:00:00.000') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectListField: [['fooDate' => '2021-01-01 00:00:00.000'], ['fooDate' => '2021-01-02 00:00:00.000']]), self::document(key: 'key2', objectListField: [['fooDate' => '2021-01-10 00:00:00.000'], ['fooDate' => '2021-01-02 00:00:00.000']]), ]) @@ -1278,12 +1279,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectListField: [['fooDate' => '2021-01-10 00:00:00.000'], ['fooDate' => '2021-01-02 00:00:00.000']]), self::document(key: 'key3', objectListField: [['fooDate' => '2021-01-20 00:00:00.000'], ['fooDate' => '2021-01-22 00:00:00.000'], ['fooDate' => '2021-01-24 00:00:00.000']]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'objectListField.fooDate', value: ['2021-01-10 00:00:00.000', '2021-01-22 00:00:00.000']) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectListField: [['fooDate' => '2021-01-10 00:00:00.000'], ['fooDate' => '2021-01-02 00:00:00.000']]), self::document(key: 'key3', objectListField: [['fooDate' => '2021-01-20 00:00:00.000'], ['fooDate' => '2021-01-22 00:00:00.000'], ['fooDate' => '2021-01-24 00:00:00.000']]), ]) @@ -1295,12 +1296,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectListField: [['fooDate' => '2021-01-10 00:00:00.000'], ['fooDate' => '2021-01-02 00:00:00.000']]), self::document(key: 'key3', objectListField: [['fooDate' => '2021-01-20 00:00:00.000'], ['fooDate' => '2021-01-22 00:00:00.000'], ['fooDate' => '2021-01-24 00:00:00.000']]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gte(field: 'objectListField.fooDate', value: '2021-01-22 00:00:00.000') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key3', objectListField: [['fooDate' => '2021-01-20 00:00:00.000'], ['fooDate' => '2021-01-22 00:00:00.000'], ['fooDate' => '2021-01-24 00:00:00.000']]), ]) ]; @@ -1310,12 +1311,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectListField: [['fooDate' => '2021-01-10 00:00:00.000'], ['fooDate' => '2021-01-02 00:00:00.000']]), self::document(key: 'key3', objectListField: [['fooDate' => '2021-01-20 00:00:00.000'], ['fooDate' => '2021-01-22 00:00:00.000'], ['fooDate' => '2021-01-24 00:00:00.000']]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lte(field: 'objectListField.fooDate', value: '2021-01-02 00:00:00.000') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectListField: [['fooDate' => '2021-01-01 00:00:00.000'], ['fooDate' => '2021-01-02 00:00:00.000']]), self::document(key: 'key2', objectListField: [['fooDate' => '2021-01-10 00:00:00.000'], ['fooDate' => '2021-01-02 00:00:00.000']]), ]) @@ -1326,12 +1327,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectListField: [['fooDate' => '2021-01-10 00:00:00.000'], ['fooDate' => '2021-01-02 00:00:00.000']]), self::document(key: 'key3', objectListField: [['fooDate' => '2021-01-20 00:00:00.000'], ['fooDate' => '2021-01-22 00:00:00.000'], ['fooDate' => '2021-01-24 00:00:00.000']]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gt(field: 'objectListField.fooDate', value: '2021-01-02 00:00:00.000') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectListField: [['fooDate' => '2021-01-10 00:00:00.000'], ['fooDate' => '2021-01-02 00:00:00.000']]), self::document(key: 'key3', objectListField: [['fooDate' => '2021-01-20 00:00:00.000'], ['fooDate' => '2021-01-22 00:00:00.000'], ['fooDate' => '2021-01-24 00:00:00.000']]), ]) @@ -1342,12 +1343,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectListField: [['fooDate' => '2021-01-10 00:00:00.000'], ['fooDate' => '2021-01-02 00:00:00.000']]), self::document(key: 'key3', objectListField: [['fooDate' => '2021-01-20 00:00:00.000'], ['fooDate' => '2021-01-22 00:00:00.000'], ['fooDate' => '2021-01-24 00:00:00.000']]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lt(field: 'objectListField.fooDate', value: '2021-01-20 00:00:00.000') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', objectListField: [['fooDate' => '2021-01-01 00:00:00.000'], ['fooDate' => '2021-01-02 00:00:00.000']]), self::document(key: 'key2', objectListField: [['fooDate' => '2021-01-10 00:00:00.000'], ['fooDate' => '2021-01-02 00:00:00.000']]), ]) @@ -1359,12 +1360,12 @@ public static function debugProvider(): \Generator self::document(key: 'key2', objectField: ['fooObj' => ['bar' => 'qux']]), self::document(key: 'key3', objectField: ['fooObj' => ['bar' => 'quux']]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'objectField.fooObj.bar', value: 'qux') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', objectField: ['fooObj' => ['bar' => 'qux']]), ]) ]; @@ -1376,12 +1377,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'foo']), self::document(key: 'key4', translatedString: ['de' => 'foo']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'translatedString', value: 'foo') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedString: ['en' => 'foo']), self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'foo']), self::document(key: 'key4', translatedString: ['de' => 'foo']), @@ -1394,12 +1395,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'foo']), self::document(key: 'key4', translatedString: ['en' => 'baz', 'de' => 'foo']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'translatedString', value: ['foo', 'bar']) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', translatedString: ['en' => 'bar', 'de' => 'foo']), self::document(key: 'key2', translatedString: ['en' => 'foo']), self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'foo']), @@ -1412,12 +1413,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'foo']), self::document(key: 'key4', translatedString: ['en' => 'baz', 'de' => 'foo']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'translatedString', value: 'foo') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', translatedString: ['en' => 'bar', 'de' => 'foo']), self::document(key: 'key4', translatedString: ['en' => 'baz', 'de' => 'foo']), ]) @@ -1429,12 +1430,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'foo']), self::document(key: 'key4', translatedString: ['en' => 'baz', 'de' => 'foo']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Neither(field: 'translatedString', value: ['foo', 'bar']) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key4', translatedString: ['en' => 'baz', 'de' => 'foo']), ]) ]; @@ -1445,12 +1446,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'foo']), self::document(key: 'key4', translatedString: ['en' => 'foo', 'de' => 'bar']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Contains(field: 'translatedString', value: 'oo') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedString: ['en' => 'boo']), self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'foo']), self::document(key: 'key4', translatedString: ['en' => 'foo', 'de' => 'bar']), @@ -1463,12 +1464,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'foo']), self::document(key: 'key4', translatedString: ['en' => 'baz', 'de' => 'foo']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Prefix(field: 'translatedString', value: 'foo') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedString: ['en' => 'foo']), self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'foo']), ]) @@ -1480,12 +1481,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'foo']), self::document(key: 'key4', translatedString: ['en' => 'ob', 'de' => 'foo']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Suffix(field: 'translatedString', value: 'o') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedString: ['en' => 'foo']), self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'foo']), ]) @@ -1497,12 +1498,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'b']), self::document(key: 'key4', translatedString: ['en' => 'b', 'de' => 'a']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gte(field: 'translatedString', value: 'b') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedString: ['en' => 'c']), self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'b']), self::document(key: 'key4', translatedString: ['en' => 'b', 'de' => 'a']), @@ -1515,12 +1516,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'b']), self::document(key: 'key4', translatedString: ['en' => 'b', 'de' => 'a']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gt(field: 'translatedString', value: 'b') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedString: ['en' => 'c']), ]) ]; @@ -1531,12 +1532,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'b']), self::document(key: 'key4', translatedString: ['en' => 'b', 'de' => 'a']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lte(field: 'translatedString', value: 'b') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', translatedString: ['en' => 'a', 'de' => 'b']), self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'b']), self::document(key: 'key4', translatedString: ['en' => 'b', 'de' => 'a']), @@ -1549,12 +1550,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'b']), self::document(key: 'key4', translatedString: ['en' => 'b', 'de' => 'a']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lt(field: 'translatedString', value: 'b') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', translatedString: ['en' => 'a', 'de' => 'b']), ]) ]; @@ -1565,12 +1566,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedString: ['en' => '', 'de' => 'foo']), self::document(key: 'key4', translatedString: ['de' => 'foo']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'translatedString', value: 'foo') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedString: ['en' => 'foo']), self::document(key: 'key4', translatedString: ['de' => 'foo']), ]) @@ -1583,12 +1584,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedInt: ['en' => null, 'de' => 2]), self::document(key: 'key4', translatedInt: ['de' => 2]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'translatedInt', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedInt: ['en' => 2]), self::document(key: 'key3', translatedInt: ['en' => null, 'de' => 2]), self::document(key: 'key4', translatedInt: ['de' => 2]), @@ -1601,12 +1602,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedInt: ['en' => null, 'de' => 3]), self::document(key: 'key4', translatedInt: ['de' => 4]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'translatedInt', value: [2, 3, 4]) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedInt: ['en' => 2]), self::document(key: 'key3', translatedInt: ['en' => null, 'de' => 3]), self::document(key: 'key4', translatedInt: ['de' => 4]), @@ -1619,12 +1620,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedInt: ['en' => null, 'de' => 2]), self::document(key: 'key4', translatedInt: ['de' => 2]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'translatedInt', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', translatedInt: ['en' => 1, 'de' => 2]), ]) ]; @@ -1635,12 +1636,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedInt: ['en' => null, 'de' => 2]), self::document(key: 'key4', translatedInt: ['de' => 2]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Neither(field: 'translatedInt', value: [1, 2]) ] ), - 'expected' => new FilterResult([]) + 'expected' => new Result([]) ]; yield 'Test translated int field gte filter' => [ 'input' => new Documents([ @@ -1649,12 +1650,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedInt: ['en' => null, 'de' => 2]), self::document(key: 'key4', translatedInt: ['de' => 1]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gte(field: 'translatedInt', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedInt: ['en' => 3]), self::document(key: 'key3', translatedInt: ['en' => null, 'de' => 2]), ]) @@ -1666,12 +1667,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedInt: ['en' => null, 'de' => 2]), self::document(key: 'key4', translatedInt: ['de' => 1]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gt(field: 'translatedInt', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedInt: ['en' => 3]), ]) ]; @@ -1682,12 +1683,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedInt: ['en' => null, 'de' => 2]), self::document(key: 'key4', translatedInt: ['de' => 1]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lte(field: 'translatedInt', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', translatedInt: ['en' => 1, 'de' => 2]), self::document(key: 'key3', translatedInt: ['en' => null, 'de' => 2]), self::document(key: 'key4', translatedInt: ['de' => 1]), @@ -1700,12 +1701,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedInt: ['en' => null, 'de' => 2]), self::document(key: 'key4', translatedInt: ['de' => 1]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lt(field: 'translatedInt', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', translatedInt: ['en' => 1, 'de' => 2]), self::document(key: 'key4', translatedInt: ['de' => 1]), ]) @@ -1718,12 +1719,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedFloat: ['en' => null, 'de' => 2.2]), self::document(key: 'key4', translatedFloat: ['de' => 2.2]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'translatedFloat', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedFloat: ['en' => 2.2]), self::document(key: 'key3', translatedFloat: ['en' => null, 'de' => 2.2]), self::document(key: 'key4', translatedFloat: ['de' => 2.2]), @@ -1736,12 +1737,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedFloat: ['en' => null, 'de' => 3.3]), self::document(key: 'key4', translatedFloat: ['de' => 4.4]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'translatedFloat', value: [2.2, 3.3, 4.4]) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedFloat: ['en' => 2.2]), self::document(key: 'key3', translatedFloat: ['en' => null, 'de' => 3.3]), self::document(key: 'key4', translatedFloat: ['de' => 4.4]), @@ -1754,12 +1755,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedFloat: ['en' => null, 'de' => 2.2]), self::document(key: 'key4', translatedFloat: ['de' => 2.2]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'translatedFloat', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', translatedFloat: ['en' => 1.1, 'de' => 2.2]), ]) ]; @@ -1770,12 +1771,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedFloat: ['en' => null, 'de' => 2.2]), self::document(key: 'key4', translatedFloat: ['de' => 2.2]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Neither(field: 'translatedFloat', value: [1.1, 2.2]) ] ), - 'expected' => new FilterResult([]) + 'expected' => new Result([]) ]; yield 'Test translated float field gte filter' => [ 'input' => new Documents([ @@ -1784,12 +1785,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedFloat: ['en' => null, 'de' => 2.2]), self::document(key: 'key4', translatedFloat: ['de' => 1.1]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gte(field: 'translatedFloat', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedFloat: ['en' => 3.3]), self::document(key: 'key3', translatedFloat: ['en' => null, 'de' => 2.2]), ]) @@ -1801,12 +1802,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedFloat: ['en' => null, 'de' => 2.2]), self::document(key: 'key4', translatedFloat: ['de' => 1.1]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gt(field: 'translatedFloat', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedFloat: ['en' => 3.3]), ]) ]; @@ -1817,12 +1818,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedFloat: ['en' => null, 'de' => 2.2]), self::document(key: 'key4', translatedFloat: ['de' => 1.1]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lte(field: 'translatedFloat', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', translatedFloat: ['en' => 1.1, 'de' => 2.2]), self::document(key: 'key3', translatedFloat: ['en' => null, 'de' => 2.2]), self::document(key: 'key4', translatedFloat: ['de' => 1.1]), @@ -1835,12 +1836,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedFloat: ['en' => null, 'de' => 2.2]), self::document(key: 'key4', translatedFloat: ['de' => 1.1]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lt(field: 'translatedFloat', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', translatedFloat: ['en' => 1.1, 'de' => 2.2]), self::document(key: 'key4', translatedFloat: ['de' => 1.1]), ]) @@ -1853,12 +1854,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedBool: ['en' => null, 'de' => false]), self::document(key: 'key4', translatedBool: ['de' => false]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'translatedBool', value: false) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedBool: ['en' => false]), self::document(key: 'key3', translatedBool: ['en' => null, 'de' => false]), self::document(key: 'key4', translatedBool: ['de' => false]), @@ -1871,12 +1872,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedBool: ['en' => null, 'de' => false]), self::document(key: 'key4', translatedBool: ['de' => false]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'translatedBool', value: false) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', translatedBool: ['en' => true, 'de' => false]), ]) ]; @@ -1888,12 +1889,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedDate: ['en' => null, 'de' => '2021-01-02 00:00:00.000']), self::document(key: 'key4', translatedDate: ['de' => '2021-01-02 00:00:00.000']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'translatedDate', value: '2021-01-02 00:00:00.000') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedDate: ['en' => '2021-01-02 00:00:00.000']), self::document(key: 'key3', translatedDate: ['en' => null, 'de' => '2021-01-02 00:00:00.000']), self::document(key: 'key4', translatedDate: ['de' => '2021-01-02 00:00:00.000']), @@ -1906,12 +1907,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedDate: ['en' => null, 'de' => '2021-01-03 00:00:00.000']), self::document(key: 'key4', translatedDate: ['de' => '2021-01-02 00:00:00.000']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'translatedDate', value: ['2021-01-02 00:00:00.000', '2021-01-03 00:00:00.000']) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedDate: ['en' => '2021-01-02 00:00:00.000']), self::document(key: 'key3', translatedDate: ['en' => null, 'de' => '2021-01-03 00:00:00.000']), self::document(key: 'key4', translatedDate: ['de' => '2021-01-02 00:00:00.000']), @@ -1924,12 +1925,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedDate: ['en' => null, 'de' => '2021-01-02 00:00:00.000']), self::document(key: 'key4', translatedDate: ['de' => '2021-01-02 00:00:00.000']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'translatedDate', value: '2021-01-02 00:00:00.000') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', translatedDate: ['en' => '2021-01-01 00:00:00.000', 'de' => '2021-01-02 00:00:00.000']), ]) ]; @@ -1940,12 +1941,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedDate: ['en' => null, 'de' => '2021-01-02 00:00:00.000']), self::document(key: 'key4', translatedDate: ['de' => '2021-01-02 00:00:00.000']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Neither(field: 'translatedDate', value: ['2021-01-01 00:00:00.000', '2021-01-02 00:00:00.000']) ] ), - 'expected' => new FilterResult([]) + 'expected' => new Result([]) ]; yield 'Test translated date field gte filter' => [ 'input' => new Documents([ @@ -1954,12 +1955,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedDate: ['en' => null, 'de' => '2021-01-02 00:00:00.000']), self::document(key: 'key4', translatedDate: ['de' => '2021-01-01 00:00:00.000']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gte(field: 'translatedDate', value: '2021-01-02 00:00:00.000') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedDate: ['en' => '2021-01-03 00:00:00.000']), self::document(key: 'key3', translatedDate: ['en' => null, 'de' => '2021-01-02 00:00:00.000']), ]) @@ -1971,12 +1972,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedDate: ['en' => null, 'de' => '2021-01-02 00:00:00.000']), self::document(key: 'key4', translatedDate: ['de' => '2021-01-01 00:00:00.000']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Gt(field: 'translatedDate', value: '2021-01-02 00:00:00.000') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedDate: ['en' => '2021-01-03 00:00:00.000']), ]) ]; @@ -1987,12 +1988,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedDate: ['en' => null, 'de' => '2021-01-02 00:00:00.000']), self::document(key: 'key4', translatedDate: ['de' => '2021-01-01 00:00:00.000']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lte(field: 'translatedDate', value: '2021-01-02 00:00:00.000') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', translatedDate: ['en' => '2021-01-01 00:00:00.000', 'de' => '2021-01-02 00:00:00.000']), self::document(key: 'key3', translatedDate: ['en' => null, 'de' => '2021-01-02 00:00:00.000']), self::document(key: 'key4', translatedDate: ['de' => '2021-01-01 00:00:00.000']), @@ -2005,12 +2006,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedDate: ['en' => null, 'de' => '2021-01-02 00:00:00.000']), self::document(key: 'key4', translatedDate: ['de' => '2021-01-01 00:00:00.000']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Lt(field: 'translatedDate', value: '2021-01-02 00:00:00.000') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', translatedDate: ['en' => '2021-01-01 00:00:00.000', 'de' => '2021-01-02 00:00:00.000']), self::document(key: 'key4', translatedDate: ['de' => '2021-01-01 00:00:00.000']), ]) @@ -2023,12 +2024,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'bar']), self::document(key: 'key4', translatedString: ['de' => 'bar']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'translatedString', value: 'bar') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedString: ['en' => 'bar']), self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'bar']), self::document(key: 'key4', translatedString: ['de' => 'bar']), @@ -2041,12 +2042,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'baz']), self::document(key: 'key4', translatedString: ['de' => 'bar']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'translatedString', value: ['bar', 'baz']) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedString: ['en' => 'bar']), self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'baz']), self::document(key: 'key4', translatedString: ['de' => 'bar']), @@ -2059,12 +2060,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'bar']), self::document(key: 'key4', translatedString: ['de' => 'bar']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'translatedString', value: 'bar') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', translatedString: ['en' => 'foo', 'de' => 'bar']), ]) ]; @@ -2075,12 +2076,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'bar']), self::document(key: 'key4', translatedString: ['de' => 'bar']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Neither(field: 'translatedString', value: ['foo', 'bar']) ] ), - 'expected' => new FilterResult([]) + 'expected' => new Result([]) ]; yield 'Test translated list field contains filter and string values' => [ 'input' => new Documents([ @@ -2089,12 +2090,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'bar']), self::document(key: 'key4', translatedString: ['de' => 'bar']), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Contains(field: 'translatedString', value: 'ba') ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedString: ['en' => 'bar']), self::document(key: 'key3', translatedString: ['en' => null, 'de' => 'bar']), self::document(key: 'key4', translatedString: ['de' => 'bar']), @@ -2108,12 +2109,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedInt: ['en' => null, 'de' => 2]), self::document(key: 'key4', translatedInt: ['de' => 2]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'translatedInt', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedInt: ['en' => 2]), self::document(key: 'key3', translatedInt: ['en' => null, 'de' => 2]), self::document(key: 'key4', translatedInt: ['de' => 2]), @@ -2126,12 +2127,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedInt: ['en' => null, 'de' => 3]), self::document(key: 'key4', translatedInt: ['de' => 2]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'translatedInt', value: [2, 3]) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedInt: ['en' => 2]), self::document(key: 'key3', translatedInt: ['en' => null, 'de' => 3]), self::document(key: 'key4', translatedInt: ['de' => 2]), @@ -2144,12 +2145,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedInt: ['en' => null, 'de' => 2]), self::document(key: 'key4', translatedInt: ['de' => 2]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'translatedInt', value: 2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', translatedInt: ['en' => 1, 'de' => 2]), ]) ]; @@ -2160,12 +2161,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedInt: ['en' => null, 'de' => 2]), self::document(key: 'key4', translatedInt: ['de' => 2]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Neither(field: 'translatedInt', value: [1, 2]) ] ), - 'expected' => new FilterResult([]) + 'expected' => new Result([]) ]; yield 'Test translated list field equals filter and float values' => [ @@ -2175,12 +2176,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedFloat: ['en' => null, 'de' => 2.2]), self::document(key: 'key4', translatedFloat: ['de' => 2.2]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'translatedFloat', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedFloat: ['en' => 2.2]), self::document(key: 'key3', translatedFloat: ['en' => null, 'de' => 2.2]), self::document(key: 'key4', translatedFloat: ['de' => 2.2]), @@ -2193,12 +2194,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedFloat: ['en' => null, 'de' => 3.3]), self::document(key: 'key4', translatedFloat: ['de' => 2.2]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'translatedFloat', value: [2.2, 3.3]) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedFloat: ['en' => 2.2]), self::document(key: 'key3', translatedFloat: ['en' => null, 'de' => 3.3]), self::document(key: 'key4', translatedFloat: ['de' => 2.2]), @@ -2211,12 +2212,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedFloat: ['en' => null, 'de' => 2.2]), self::document(key: 'key4', translatedFloat: ['de' => 2.2]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'translatedFloat', value: 2.2) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', translatedFloat: ['en' => 1.1, 'de' => 2.2]), ]) ]; @@ -2227,12 +2228,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedFloat: ['en' => null, 'de' => 2.2]), self::document(key: 'key4', translatedFloat: ['de' => 2.2]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Neither(field: 'translatedFloat', value: [1.1, 2.2]) ] ), - 'expected' => new FilterResult([]) + 'expected' => new Result([]) ]; yield 'Test translated list field equals filter and bool values' => [ @@ -2242,12 +2243,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedBool: ['en' => null, 'de' => false]), self::document(key: 'key4', translatedBool: ['de' => false]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Equals(field: 'translatedBool', value: false) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key2', translatedBool: ['en' => false]), self::document(key: 'key3', translatedBool: ['en' => null, 'de' => false]), self::document(key: 'key4', translatedBool: ['de' => false]), @@ -2260,12 +2261,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedBool: ['en' => null, 'de' => true]), self::document(key: 'key4', translatedBool: ['de' => false]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Any(field: 'translatedBool', value: [false, true]) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', translatedBool: ['en' => true, 'de' => false]), self::document(key: 'key2', translatedBool: ['en' => false]), self::document(key: 'key3', translatedBool: ['en' => null, 'de' => true]), @@ -2279,12 +2280,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedBool: ['en' => null, 'de' => false]), self::document(key: 'key4', translatedBool: ['de' => false]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Not(field: 'translatedBool', value: false) ] ), - 'expected' => new FilterResult([ + 'expected' => new Result([ self::document(key: 'key1', translatedBool: ['en' => true, 'de' => false]), ]) ]; @@ -2295,12 +2296,12 @@ public static function debugProvider(): \Generator self::document(key: 'key3', translatedBool: ['en' => null, 'de' => false]), self::document(key: 'key4', translatedBool: ['de' => false]), ]), - 'criteria' => new FilterCriteria( + 'criteria' => new Criteria( filters: [ new Neither(field: 'translatedBool', value: [true, false]) ] ), - 'expected' => new FilterResult([]) + 'expected' => new Result([]) ]; } @@ -2316,9 +2317,9 @@ private function getClient(): Client return $this->client; } - public function getStorage(): FilterStorage + public function getStorage(): FilterAware&Storage { - return new LiveMeilisearchStorage( + return new LiveMeilisearchAware( storage: new MeilisearchStorage( client: $this->getClient(), schema: $this->getSchema() diff --git a/tests/MongoDB/MongoDBFilterStorageTest.php b/tests/MongoDB/MongoDBFilterStorageTest.php index 3ab4c6f..05570d5 100644 --- a/tests/MongoDB/MongoDBFilterStorageTest.php +++ b/tests/MongoDB/MongoDBFilterStorageTest.php @@ -3,12 +3,13 @@ namespace Shopware\StorageTests\MongoDB; use MongoDB\Client; -use Shopware\Storage\Common\Filter\FilterStorage; -use Shopware\Storage\MongoDB\MongoDBFilterStorage; +use Shopware\Storage\Common\Filter\FilterAware; +use Shopware\Storage\Common\Storage; +use Shopware\Storage\MongoDB\MongoDBStorage; use Shopware\StorageTests\Common\FilterStorageTestBase; /** - * @covers \Shopware\Storage\MongoDB\MongoDBFilterStorage + * @covers \Shopware\Storage\MongoDB\MongoDBStorage */ class MongoDBFilterStorageTest extends FilterStorageTestBase { @@ -35,9 +36,9 @@ protected function tearDown(): void $this->getClient()->dropDatabase('test'); } - public function getStorage(): FilterStorage + public function getStorage(): FilterAware&Storage { - return new MongoDBFilterStorage( + return new MongoDBStorage( database: 'test', schema: $this->getSchema(), client: $this->getClient(), diff --git a/tests/MongoDB/MongoDBKeyValueStorageTest.php b/tests/MongoDB/MongoDBKeyValueStorageTest.php index ffe7d50..b701901 100644 --- a/tests/MongoDB/MongoDBKeyValueStorageTest.php +++ b/tests/MongoDB/MongoDBKeyValueStorageTest.php @@ -3,14 +3,15 @@ namespace Shopware\StorageTests\MongoDB; use MongoDB\Client; -use Shopware\Storage\Common\KeyValue\KeyValueStorage; -use Shopware\Storage\MongoDB\MongoDBKeyValueStorage; +use Shopware\Storage\Common\KeyValue\KeyAware; +use Shopware\Storage\Common\Storage; +use Shopware\Storage\MongoDB\MongoDBKeyStorage; use Shopware\StorageTests\Common\KeyValueStorageTestBase; /** * @internal * - * @covers \Shopware\Storage\MongoDB\MongoDBKeyValueStorage + * @covers \Shopware\Storage\MongoDB\MongoDBKeyStorage */ class MongoDBKeyValueStorageTest extends KeyValueStorageTestBase { @@ -25,9 +26,9 @@ private function getClient(): Client return $this->client; } - public function getStorage(): KeyValueStorage + public function getStorage(): KeyAware&Storage { - return new MongoDBKeyValueStorage( + return new MongoDBKeyStorage( database: 'test', collection: 'test_document', client: $this->getClient() diff --git a/tests/MySQL/MySQLFilterStorageTest.php b/tests/MySQL/MySQLFilterStorageTest.php index 2958248..c6c0462 100644 --- a/tests/MySQL/MySQLFilterStorageTest.php +++ b/tests/MySQL/MySQLFilterStorageTest.php @@ -6,16 +6,17 @@ use Doctrine\DBAL\DriverManager; use PHPUnit\Framework\Attributes\DataProvider; use Shopware\Storage\Common\Document\Documents; -use Shopware\Storage\Common\Filter\FilterCriteria; -use Shopware\Storage\Common\Filter\FilterResult; -use Shopware\Storage\Common\Filter\FilterStorage; +use Shopware\Storage\Common\Filter\Criteria; +use Shopware\Storage\Common\Filter\Result; +use Shopware\Storage\Common\Filter\FilterAware; use Shopware\Storage\Common\Filter\Type\Equals; use Shopware\Storage\Common\Filter\Type\Not; -use Shopware\Storage\MySQL\MySQLFilterStorage; +use Shopware\Storage\Common\Storage; +use Shopware\Storage\MySQL\MySQLStorage; use Shopware\StorageTests\Common\FilterStorageTestBase; /** - * @covers \Shopware\Storage\MySQL\MySQLFilterStorage + * @covers \Shopware\Storage\MySQL\MySQLStorage */ class MySQLFilterStorageTest extends FilterStorageTestBase { @@ -32,9 +33,9 @@ protected function setUp(): void ->executeStatement((string) file_get_contents(__DIR__ . '/test_storage.sql')); } - public function getStorage(): FilterStorage + public function getStorage(): FilterAware&Storage { - return new MySQLFilterStorage( + return new MySQLStorage( connection: $this->getConnection(), schema: $this->getSchema() ); diff --git a/tests/MySQL/MySQLKeyValueStorageTest.php b/tests/MySQL/MySQLKeyValueStorageTest.php index 44651a3..56adb72 100644 --- a/tests/MySQL/MySQLKeyValueStorageTest.php +++ b/tests/MySQL/MySQLKeyValueStorageTest.php @@ -4,12 +4,13 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\DriverManager; -use Shopware\Storage\Common\KeyValue\KeyValueStorage; -use Shopware\Storage\MySQL\MySQLKeyValueStorage; +use Shopware\Storage\Common\KeyValue\KeyAware; +use Shopware\Storage\Common\Storage; +use Shopware\Storage\MySQL\MySQLKeyStorage; use Shopware\StorageTests\Common\KeyValueStorageTestBase; /** - * @covers \Shopware\Storage\MySQL\MySQLKeyValueStorage + * @covers \Shopware\Storage\MySQL\MySQLKeyStorage */ class MySQLKeyValueStorageTest extends KeyValueStorageTestBase { @@ -31,9 +32,9 @@ protected function tearDown(): void ->executeStatement('DROP TABLE IF EXISTS `test_key_value`'); } - public function getStorage(): KeyValueStorage + public function getStorage(): KeyAware&Storage { - return new MySQLKeyValueStorage( + return new MySQLKeyStorage( connection: $this->getConnection(), source: 'test_key_value' ); diff --git a/tests/Opensearch/OpenSearchStorageTest.php b/tests/Opensearch/OpenSearchStorageTest.php index 7af7385..3f25ee6 100644 --- a/tests/Opensearch/OpenSearchStorageTest.php +++ b/tests/Opensearch/OpenSearchStorageTest.php @@ -4,12 +4,13 @@ use OpenSearch\Client; use OpenSearch\ClientBuilder; -use Shopware\Storage\Common\Filter\FilterStorage; -use Shopware\Storage\Opensearch\OpenSearchFilterStorage; +use Shopware\Storage\Common\Filter\FilterAware; +use Shopware\Storage\Common\Storage; +use Shopware\Storage\Opensearch\OpenSearchStorage; use Shopware\StorageTests\Common\FilterStorageTestBase; /** - * @covers \Shopware\Storage\Opensearch\OpenSearchFilterStorage + * @covers \Shopware\Storage\Opensearch\OpenSearchStorage */ class OpenSearchStorageTest extends FilterStorageTestBase { @@ -156,12 +157,11 @@ public static function tearDownAfterClass(): void } } - - public function getStorage(): FilterStorage + public function getStorage(): FilterAware&Storage { - return new OpensearchLiveFilterStorage( + return new OpensearchLiveStorage( $this->getClient(), - new OpenSearchFilterStorage( + new OpenSearchStorage( $this->getClient(), $this->getSchema() ), diff --git a/tests/Opensearch/OpensearchLiveFilterStorage.php b/tests/Opensearch/OpensearchLiveStorage.php similarity index 70% rename from tests/Opensearch/OpensearchLiveFilterStorage.php rename to tests/Opensearch/OpensearchLiveStorage.php index 918d450..312fd08 100644 --- a/tests/Opensearch/OpensearchLiveFilterStorage.php +++ b/tests/Opensearch/OpensearchLiveStorage.php @@ -4,17 +4,18 @@ use OpenSearch\Client; use Shopware\Storage\Common\Document\Documents; -use Shopware\Storage\Common\Filter\FilterCriteria; -use Shopware\Storage\Common\Filter\FilterResult; -use Shopware\Storage\Common\Filter\FilterStorage; +use Shopware\Storage\Common\Filter\Criteria; +use Shopware\Storage\Common\Filter\Result; +use Shopware\Storage\Common\Filter\FilterAware; use Shopware\Storage\Common\Schema\Schema; +use Shopware\Storage\Common\Storage; use Shopware\Storage\Common\StorageContext; -class OpensearchLiveFilterStorage implements FilterStorage +class OpensearchLiveStorage implements FilterAware, Storage { public function __construct( private readonly Client $client, - private readonly FilterStorage $decorated, + private readonly FilterAware&Storage $decorated, private readonly Schema $schema ) {} @@ -30,7 +31,7 @@ public function store(Documents $documents): void $this->client->indices()->refresh(['index' => $this->schema->source]); } - public function filter(FilterCriteria $criteria, StorageContext $context): FilterResult + public function filter(Criteria $criteria, StorageContext $context): Result { return $this->decorated->filter($criteria, $context); } diff --git a/tests/Redis/RedisKeyValueStorageTest.php b/tests/Redis/RedisKeyValueStorageTest.php index b75b92f..c011a51 100644 --- a/tests/Redis/RedisKeyValueStorageTest.php +++ b/tests/Redis/RedisKeyValueStorageTest.php @@ -2,12 +2,13 @@ namespace Shopware\StorageTests\Redis; -use Shopware\Storage\Common\KeyValue\KeyValueStorage; -use Shopware\Storage\Redis\RedisKeyValueStorage; +use Shopware\Storage\Common\KeyValue\KeyAware; +use Shopware\Storage\Common\Storage; +use Shopware\Storage\Redis\RedisKeyStorage; use Shopware\StorageTests\Common\KeyValueStorageTestBase; /** - * @covers \Shopware\Storage\Redis\RedisKeyValueStorage + * @covers \Shopware\Storage\Redis\RedisKeyStorage */ class RedisKeyValueStorageTest extends KeyValueStorageTestBase { @@ -19,9 +20,9 @@ private function getClient(): \Redis return $client; } - public function getStorage(): KeyValueStorage + public function getStorage(): KeyAware&Storage { - return new RedisKeyValueStorage( + return new RedisKeyStorage( client: $this->getClient() ); }