diff options
| author | Yuriy Andamasov <yuriy@vyos.io> | 2026-05-22 10:43:48 +0300 |
|---|---|---|
| committer | Yuriy Andamasov <yuriy@vyos.io> | 2026-05-22 10:43:48 +0300 |
| commit | 77fdd523554e18abc3a834bbd52527f015bc4aa8 (patch) | |
| tree | 379777dc790c25af69e7710b60d3bb8e891ac531 /src/__tests__/VyOSElasticModernHostTestCase.php | |
| parent | ea323c862121e2b309f526d5027a511b8d61e906 (diff) | |
| download | phorge-elasticsearch-modern-77fdd523554e18abc3a834bbd52527f015bc4aa8.tar.gz phorge-elasticsearch-modern-77fdd523554e18abc3a834bbd52527f015bc4aa8.zip | |
Add VyOSElasticModernHost + placeholder engine stub
Host class mirrors PhabricatorElasticsearchHost's surface. Engine is
a stub providing only getEngineIdentifier() and getHostType() so the
host's tests can construct an engine instance; real engine
implementation lands in subsequent commits. All six abstract methods
of PhabricatorFulltextStorageEngine are implemented (four as throwing
stubs to be replaced in E7/E8).
.arcconfig gains "src/" in the load list so arc unit can discover the
extension library; test case extends PhutilTestCase (no DB needed for
pure-PHP host property assertions).
🤖 Generated by [robots](https://vyos.io)
Diffstat (limited to 'src/__tests__/VyOSElasticModernHostTestCase.php')
| -rw-r--r-- | src/__tests__/VyOSElasticModernHostTestCase.php | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/__tests__/VyOSElasticModernHostTestCase.php b/src/__tests__/VyOSElasticModernHostTestCase.php new file mode 100644 index 0000000..1c5ef95 --- /dev/null +++ b/src/__tests__/VyOSElasticModernHostTestCase.php @@ -0,0 +1,52 @@ +<?php + +final class VyOSElasticModernHostTestCase + extends PhutilTestCase { + + public function testDisplayName() { + $engine = new VyOSElasticModernFulltextStorageEngine(); + $host = new VyOSElasticModernHost($engine); + $this->assertEqual( + 'Elasticsearch (modern)', + (string)$host->getDisplayName()); + } + + public function testConfigDefaults() { + $engine = new VyOSElasticModernFulltextStorageEngine(); + $host = new VyOSElasticModernHost($engine); + $host->setConfig(array()); + $this->assertEqual('http', $host->getProtocol()); + $this->assertEqual('phabricator/', $host->getPath()); + $this->assertEqual(7, $host->getVersion()); + } + + public function testConfigOverrides() { + $engine = new VyOSElasticModernFulltextStorageEngine(); + $host = new VyOSElasticModernHost($engine); + $host->setConfig(array( + 'host' => 'es.example.com', + 'port' => 9200, + 'protocol' => 'https', + 'path' => '/myphorge', + 'version' => 8, + )); + $this->assertEqual('https', $host->getProtocol()); + $this->assertEqual('/myphorge', $host->getPath()); + $this->assertEqual(8, $host->getVersion()); + } + + public function testGetURI() { + $engine = new VyOSElasticModernFulltextStorageEngine(); + $host = new VyOSElasticModernHost($engine); + $host->setConfig(array( + 'host' => 'es.example.com', + 'port' => 9200, + 'protocol' => 'http', + 'path' => '/phabricator', + )); + $uri = (string)$host->getURI('/_doc/abc'); + $this->assertTrue(strpos($uri, 'es.example.com') !== false); + $this->assertTrue(strpos($uri, '/_doc/abc') !== false); + } + +} |
