summaryrefslogtreecommitdiff
path: root/vendor/ruflin/elastica/test/lib/Elastica/Test/Index/StatusTest.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2015-08-16 08:22:05 +0200
committerPierre Schmitz <pierre@archlinux.de>2015-08-16 08:22:05 +0200
commit1a365e77dfb8825136626202b1df462731b42060 (patch)
tree1dc4468eaabf070e051e790a9e67a9a9a2c63d99 /vendor/ruflin/elastica/test/lib/Elastica/Test/Index/StatusTest.php
parenta72fd280f7acb4d2a1ba579a0f1b2b2ae8958530 (diff)
Update to MediaWiki 1.25.2
Diffstat (limited to 'vendor/ruflin/elastica/test/lib/Elastica/Test/Index/StatusTest.php')
-rw-r--r--vendor/ruflin/elastica/test/lib/Elastica/Test/Index/StatusTest.php66
1 files changed, 66 insertions, 0 deletions
diff --git a/vendor/ruflin/elastica/test/lib/Elastica/Test/Index/StatusTest.php b/vendor/ruflin/elastica/test/lib/Elastica/Test/Index/StatusTest.php
new file mode 100644
index 00000000..8a056a53
--- /dev/null
+++ b/vendor/ruflin/elastica/test/lib/Elastica/Test/Index/StatusTest.php
@@ -0,0 +1,66 @@
+<?php
+
+namespace Elastica\Test\Index;
+
+use Elastica\Index\Status as IndexStatus;
+use Elastica\Test\Base as BaseTest;
+
+class StatusTest extends BaseTest
+{
+ public function testGetAliases()
+ {
+ $indexName = 'test';
+ $aliasName = 'test-alias';
+
+ $client = $this->_getClient();
+ $index = $client->getIndex($indexName);
+ $index->create(array(), true);
+
+ $status = new IndexStatus($index);
+
+ $aliases = $status->getAliases();
+
+ $this->assertTrue(empty($aliases));
+ $this->assertInternalType('array', $aliases);
+
+ $index->addAlias($aliasName);
+ $status->refresh();
+
+ $aliases = $status->getAliases();
+
+ $this->assertTrue(in_array($aliasName, $aliases));
+ }
+
+ public function testHasAlias()
+ {
+ $indexName = 'test';
+ $aliasName = 'test-alias';
+
+ $client = $this->_getClient();
+ $index = $client->getIndex($indexName);
+ $index->create(array(), true);
+
+ $status = new IndexStatus($index);
+
+ $this->assertFalse($status->hasAlias($aliasName));
+
+ $index->addAlias($aliasName);
+ $status->refresh();
+
+ $this->assertTrue($status->hasAlias($aliasName));
+ }
+
+ public function testGetSettings()
+ {
+ $indexName = 'test';
+
+ $client = $this->_getClient();
+ $index = $client->getIndex($indexName);
+ $index->create(array(), true);
+ $status = $index->getStatus();
+
+ $settings = $status->getSettings();
+ $this->assertInternalType('array', $settings);
+ $this->assertTrue(isset($settings['index']['number_of_shards']));
+ }
+}