diff options
Diffstat (limited to 'src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php')
| -rw-r--r-- | src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php b/src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php index 7a41ca1..7c0755c 100644 --- a/src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php +++ b/src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php @@ -1,11 +1,42 @@ <?php +/** + * Minimal concrete subclass for unit-testing the abstract engine. + * Only the abstract stubs from PhabricatorFulltextStorageEngine are + * satisfied here; no real Elasticsearch I/O occurs in tests. + */ +final class VyOSElasticModernFulltextStorageEngineTestDouble + extends VyOSElasticModernFulltextStorageEngine { + + public function reindexAbstractDocument( + PhabricatorSearchAbstractDocument $doc) { + // no-op in tests + } + + public function executeSearch(PhabricatorSavedQuery $query) { + return array(); + } + + public function indexExists() { + return false; + } + + public function getIndexStats() { + return array(); + } + +} + final class VyOSElasticModernFulltextStorageEngineTestCase extends PhutilTestCase { + private function newEngine() { + return new VyOSElasticModernFulltextStorageEngineTestDouble(); + } + public function testSetVersionAcceptsSevenAndAbove() { foreach (array(7, 8, 9, 100) as $v) { - $engine = new VyOSElasticModernFulltextStorageEngine(); + $engine = $this->newEngine(); $caught = null; try { $engine->setVersion($v); @@ -22,7 +53,7 @@ final class VyOSElasticModernFulltextStorageEngineTestCase public function testSetVersionRejectsBelowSeven() { foreach (array(0, 1, 2, 5, 6) as $v) { - $engine = new VyOSElasticModernFulltextStorageEngine(); + $engine = $this->newEngine(); $caught = null; try { $engine->setVersion($v); |
