コード例 #1
0
 /**
  * Check if "store" and "indexName" options are set as expected.
  */
 public function testDocumentMappingWithStore()
 {
     $manager = DelayedObjectWrapper::wrap($this->getManager());
     $params = ['index' => $manager->getConnection()->getIndexName(), 'type' => 'product', 'field' => 'stored'];
     $result = $manager->getConnection()->getClient()->indices()->getFieldMapping($params);
     $expectedMapping = ['stored' => ['store' => true, 'index_name' => 'ongr-esb-test', 'type' => 'string']];
     $this->assertEquals($expectedMapping, $result['ongr-esb-test']['mappings']['product']['stored']['mapping']);
 }
コード例 #2
0
 /**
  * Tests if warmers are being put into index if command is executed.
  *
  * @param string $expected
  * @param array  $arguments
  *
  * @dataProvider getTestExecuteData
  */
 public function testExecute($expected, $arguments = [])
 {
     $app = new Application();
     $app->add($this->getCommand());
     $command = $app->find('ongr:es:warmer:put');
     $commandTester = new CommandTester($command);
     $connection = DelayedObjectWrapper::wrap($this->getManager()->getConnection());
     $warmers = $connection->getClient()->indices()->getWarmer(['index' => $connection->getIndexName(), 'name' => '*']);
     $this->assertEmpty($warmers, 'Index should not have any warmers loaded.');
     $arguments['command'] = $command->getName();
     $commandTester->execute($arguments);
     $this->assertEquals($expected, $commandTester->getDisplay());
     $warmers = $connection->getClient()->indices()->getWarmer(['index' => $connection->getIndexName(), 'name' => '*']);
     $this->assertNotEmpty($warmers[$connection->getIndexName()], 'Index should have warmers loaded.');
 }
コード例 #3
0
 /**
  * Tests if close index throws exception for read only manager.
  *
  * @expectedException \Elasticsearch\Common\Exceptions\Forbidden403Exception
  * @expectedExceptionMessage Manager is readonly! Close index operation not permitted.
  */
 public function testReadOnlyManagerCloseIndex()
 {
     $connection = DelayedObjectWrapper::wrap($this->getReadOnlyManager()->getConnection());
     $this->assertTrue($connection->isOpen());
     $connection->close();
     $this->assertTrue($connection->isOpen());
 }