You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
798 B
29 lines
798 B
<?php |
|
|
|
namespace yiiunit\extensions\elasticsearch; |
|
|
|
use yii\elasticsearch\Connection; |
|
use yii\elasticsearch\GuzzleConnection; |
|
|
|
/** |
|
* @group elasticsearch |
|
*/ |
|
class ElasticSearchConnectionTest extends ElasticSearchTestCase |
|
{ |
|
public function testOpen() |
|
{ |
|
$connection = new GuzzleConnection(); |
|
$connection->autodetectCluster; |
|
$connection->nodes = [ |
|
['http_address' => 'inet[/127.0.0.1:9200]'], |
|
]; |
|
$this->assertNull($connection->activeNode); |
|
$connection->open(); |
|
$this->assertNotNull($connection->activeNode); |
|
$this->assertArrayHasKey('name', reset($connection->nodes)); |
|
$this->assertArrayHasKey('hostname', reset($connection->nodes)); |
|
$this->assertArrayHasKey('version', reset($connection->nodes)); |
|
$this->assertArrayHasKey('http_address', reset($connection->nodes)); |
|
} |
|
|
|
} |