addActions() public method

public addActions ( array $actions )
$actions array
コード例 #1
0
 /**
  * @param array $responseData
  * @param array $actions
  *
  * @return \Elastica\Bulk\ResponseSet
  */
 protected function _createResponseSet(array $responseData, array $actions)
 {
     $client = $this->getMock('Elastica\\Client', array('request'));
     $client->expects($this->once())->method('request')->withAnyParameters()->will($this->returnValue(new Response($responseData)));
     $bulk = new Bulk($client);
     $bulk->addActions($actions);
     return $bulk->send();
 }
コード例 #2
0
ファイル: BulkTest.php プロジェクト: MediaWiki-stable/1.26.1
 /**
  * @group unit
  */
 public function testAddActions()
 {
     $client = $this->_getClient();
     $bulk = new Bulk($client);
     $action1 = new Action(Action::OP_TYPE_DELETE);
     $action1->setIndex('index');
     $action1->setType('type');
     $action1->setId(1);
     $action2 = new Action(Action::OP_TYPE_INDEX);
     $action2->setIndex('index');
     $action2->setType('type');
     $action2->setId(1);
     $action2->setSource(array('name' => 'Batman'));
     $actions = array($action1, $action2);
     $bulk->addActions($actions);
     $getActions = $bulk->getActions();
     $this->assertSame($action1, $getActions[0]);
     $this->assertSame($action2, $getActions[1]);
 }