summaryrefslogtreecommitdiff
path: root/src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php
diff options
context:
space:
mode:
authorYuriy Andamasov <yuriy@andamasov.com>2026-05-23 14:23:13 +0300
committerGitHub <noreply@github.com>2026-05-23 14:23:13 +0300
commit132217de05911823c2fcec2785fc38918442081c (patch)
treee5a11c374fc4f8d8b3d30e144648a39d3de016f2 /src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php
parentebc6bcf1466f7555988df9063dd86e834de1b9aa (diff)
parent67d619a782eef8df6437525c45a63c9485c13a6a (diff)
downloadphorge-elasticsearch-modern-132217de05911823c2fcec2785fc38918442081c.tar.gz
phorge-elasticsearch-modern-132217de05911823c2fcec2785fc38918442081c.zip
Merge pull request #7 from vyos/task/e4-buildtypefilter
E4: Add buildTypeFilter() helper
Diffstat (limited to 'src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php')
-rw-r--r--src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php b/src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php
index 1762d32..ff4ade8 100644
--- a/src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php
+++ b/src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php
@@ -89,4 +89,27 @@ final class VyOSElasticModernFulltextStorageEngineTestCase
$this->assertEqual('/_search', $engine->getSearchUri(array()));
}
+ public function testBuildTypeFilter() {
+ $engine = $this->newEngine()->setVersion(7);
+ $filter = $engine->buildTypeFilter(array('TASK', 'DREV'));
+ $expected = array(
+ 'terms' => array(
+ 'documentType' => array('TASK', 'DREV'),
+ ),
+ );
+ $this->assertEqual($expected, $filter);
+ }
+
+ public function testBuildTypeFilterEmpty() {
+ // Empty list still produces a filter; the caller is responsible
+ // for normalizing "no types specified" to "all indexable types"
+ // before calling this method. This matches the bundled engine's
+ // pattern (executeSearch() normalizes before URL construction).
+ $engine = $this->newEngine()->setVersion(7);
+ $filter = $engine->buildTypeFilter(array());
+ $this->assertEqual(
+ array('terms' => array('documentType' => array())),
+ $filter);
+ }
+
}