diff options
Diffstat (limited to 'vendor/ruflin/elastica/test/lib/Elastica/Test/NodeTest.php')
-rw-r--r-- | vendor/ruflin/elastica/test/lib/Elastica/Test/NodeTest.php | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/vendor/ruflin/elastica/test/lib/Elastica/Test/NodeTest.php b/vendor/ruflin/elastica/test/lib/Elastica/Test/NodeTest.php new file mode 100644 index 00000000..fbd2d297 --- /dev/null +++ b/vendor/ruflin/elastica/test/lib/Elastica/Test/NodeTest.php @@ -0,0 +1,75 @@ +<?php +namespace Elastica\Test; + +use Elastica\Node; +use Elastica\Test\Base as BaseTest; + +class NodeTest extends BaseTest +{ + /** + * @group functional + */ + public function testCreateNode() + { + $client = $this->_getClient(); + $names = $client->getCluster()->getNodeNames(); + $name = reset($names); + + $node = new Node($name, $client); + $this->assertInstanceOf('Elastica\Node', $node); + } + + /** + * @group functional + */ + public function testGetInfo() + { + $client = $this->_getClient(); + $names = $client->getCluster()->getNodeNames(); + $name = reset($names); + + $node = new Node($name, $client); + + $info = $node->getInfo(); + + $this->assertInstanceOf('Elastica\Node\Info', $info); + } + + /** + * @group functional + */ + public function testGetStats() + { + $client = $this->_getClient(); + $names = $client->getCluster()->getNodeNames(); + $name = reset($names); + + $node = new Node($name, $client); + + $stats = $node->getStats(); + + $this->assertInstanceOf('Elastica\Node\Stats', $stats); + } + + /** + * @group functional + */ + public function testGetName() + { + $nodes = $this->_getClient()->getCluster()->getNodes(); + // At least 1 instance must exist + $this->assertGreaterThan(0, $nodes); + + foreach ($nodes as $node) { + $this->assertEquals($node->getName(), 'Elastica'); + } + } + + /** + * @group functional + */ + public function testGetId() + { + $node = new Node('Elastica', $this->_getClient()); + } +} |