| @@ 396-419 (lines=24) @@ | ||
| 393 | $this->assertFalse($status->aliasExists($aliasName)); |
|
| 394 | } |
|
| 395 | ||
| 396 | public function testAddAliasTwoIndices(): void |
|
| 397 | { |
|
| 398 | $indexName1 = 'test1'; |
|
| 399 | $aliasName = 'test-alias'; |
|
| 400 | ||
| 401 | $client = $this->_getClient(); |
|
| 402 | $index1 = $client->getIndex($indexName1); |
|
| 403 | ||
| 404 | $index1->create([], [ |
|
| 405 | 'recreate' => true, |
|
| 406 | ]); |
|
| 407 | $this->_waitForAllocation($index1); |
|
| 408 | $index1->addAlias($aliasName); |
|
| 409 | ||
| 410 | $index1->refresh(); |
|
| 411 | $index1->forcemerge(); |
|
| 412 | ||
| 413 | $status = new Status($client); |
|
| 414 | ||
| 415 | $this->assertTrue($status->indexExists($indexName1)); |
|
| 416 | ||
| 417 | $this->assertTrue($status->aliasExists($aliasName)); |
|
| 418 | $this->assertTrue($index1->hasAlias($aliasName)); |
|
| 419 | } |
|
| 420 | ||
| 421 | public function testReplaceAlias(): void |
|
| 422 | { |
|
| @@ 579-597 (lines=19) @@ | ||
| 576 | /** |
|
| 577 | * @group functional |
|
| 578 | */ |
|
| 579 | public function testCreate(): void |
|
| 580 | { |
|
| 581 | $client = $this->_getClient(); |
|
| 582 | $indexName = 'test'; |
|
| 583 | ||
| 584 | $index = $client->getIndex($indexName); |
|
| 585 | $index->create([]); |
|
| 586 | $this->_waitForAllocation($index); |
|
| 587 | $status = new Status($client); |
|
| 588 | $this->assertTrue($status->indexExists($indexName)); |
|
| 589 | ||
| 590 | $index = $client->getIndex($indexName); |
|
| 591 | $index->create([], [ |
|
| 592 | 'recreate' => true, |
|
| 593 | ]); |
|
| 594 | $this->_waitForAllocation($index); |
|
| 595 | $status = new Status($client); |
|
| 596 | $this->assertTrue($status->indexExists($indexName)); |
|
| 597 | } |
|
| 598 | ||
| 599 | /** |
|
| 600 | * @group functional |
|
| @@ 28-49 (lines=22) @@ | ||
| 25 | /** |
|
| 26 | * @group functional |
|
| 27 | */ |
|
| 28 | public function testGetIndexNames(): void |
|
| 29 | { |
|
| 30 | $indexName = 'test'; |
|
| 31 | $client = $this->_getClient(); |
|
| 32 | $index = $client->getIndex($indexName); |
|
| 33 | $index->create([], [ |
|
| 34 | 'recreate' => true, |
|
| 35 | ]); |
|
| 36 | $index = $this->_createIndex(); |
|
| 37 | $index->refresh(); |
|
| 38 | $index->forcemerge(); |
|
| 39 | ||
| 40 | $status = new Status($index->getClient()); |
|
| 41 | $names = $status->getIndexNames(); |
|
| 42 | ||
| 43 | $this->assertIsArray($names); |
|
| 44 | $this->assertContains($index->getName(), $names); |
|
| 45 | ||
| 46 | foreach ($names as $name) { |
|
| 47 | $this->assertIsString($name); |
|
| 48 | } |
|
| 49 | } |
|
| 50 | ||
| 51 | /** |
|
| 52 | * @group functional |
|