summaryrefslogtreecommitdiff
path: root/src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php')
-rw-r--r--src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php b/src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php
index 1762d32..95558a1 100644
--- a/src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php
+++ b/src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php
@@ -89,4 +89,29 @@ final class VyOSElasticModernFulltextStorageEngineTestCase
$this->assertEqual('/_search', $engine->getSearchUri(array()));
}
+ public function testBuildTypeFilter() {
+ $engine = id(new VyOSElasticModernFulltextStorageEngine())
+ ->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 = id(new VyOSElasticModernFulltextStorageEngine())
+ ->setVersion(7);
+ $filter = $engine->buildTypeFilter(array());
+ $this->assertEqual(
+ array('terms' => array('documentType' => array())),
+ $filter);
+ }
+
}