diff options
| author | Yuriy Andamasov <yuriy@vyos.io> | 2026-05-23 13:13:22 +0300 |
|---|---|---|
| committer | Yuriy Andamasov <yuriy@vyos.io> | 2026-05-23 13:13:22 +0300 |
| commit | ed0dee0333acf8a1c79845bba6455506c8210bad (patch) | |
| tree | ded9334a63052323a074c3531273ee1c667f8855 /src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php | |
| parent | 04acd3d6b9a95ff49d430eaf4f65aabc25282d88 (diff) | |
| download | phorge-elasticsearch-modern-ed0dee0333acf8a1c79845bba6455506c8210bad.tar.gz phorge-elasticsearch-modern-ed0dee0333acf8a1c79845bba6455506c8210bad.zip | |
E1 fixup: initialize $version to null; getVersion() throws if unset; use TestDouble in tests
🤖 Generated by [robots](https://vyos.io)
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); |
