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.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php b/src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php
new file mode 100644
index 0000000..7a41ca1
--- /dev/null
+++ b/src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php
@@ -0,0 +1,38 @@
+<?php
+
+final class VyOSElasticModernFulltextStorageEngineTestCase
+ extends PhutilTestCase {
+
+ public function testSetVersionAcceptsSevenAndAbove() {
+ foreach (array(7, 8, 9, 100) as $v) {
+ $engine = new VyOSElasticModernFulltextStorageEngine();
+ $caught = null;
+ try {
+ $engine->setVersion($v);
+ } catch (Exception $e) {
+ $caught = $e;
+ }
+ $this->assertEqual(
+ null,
+ $caught,
+ pht('Expected no exception for version=%d.', $v));
+ $this->assertEqual($v, $engine->getVersion());
+ }
+ }
+
+ public function testSetVersionRejectsBelowSeven() {
+ foreach (array(0, 1, 2, 5, 6) as $v) {
+ $engine = new VyOSElasticModernFulltextStorageEngine();
+ $caught = null;
+ try {
+ $engine->setVersion($v);
+ } catch (Exception $e) {
+ $caught = $e;
+ }
+ $this->assertTrue(
+ $caught !== null,
+ pht('Expected an exception for version=%d.', $v));
+ }
+ }
+
+}