From 77fdd523554e18abc3a834bbd52527f015bc4aa8 Mon Sep 17 00:00:00 2001 From: Yuriy Andamasov Date: Fri, 22 May 2026 10:43:48 +0300 Subject: Add VyOSElasticModernHost + placeholder engine stub MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- src/__tests__/VyOSElasticModernHostTestCase.php | 52 +++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 src/__tests__/VyOSElasticModernHostTestCase.php (limited to 'src/__tests__/VyOSElasticModernHostTestCase.php') 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 @@ +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); + } + +} -- cgit v1.2.3