public function testItShouldRaiseAnExceptionIfSomeItemsFail() { $result = new \stdClass(); $result->errors = ['qux', 'quux']; $this->client->expects($this->once())->method('bulk')->willReturn($result); $this->setExpectedException('CascadeEnergy\\ElasticSearch\\Exceptions\\PartialFailureException'); $this->bulk->addItem('idFoo', 'foo'); $this->bulk->flush(); }
public function testItShouldRaiseAnExceptionIfTheErrorListIsNotEmpty() { $result = []; $result['items'] = ['foo' => ['index' => ['status' => 100]]]; $result['errors'] = true; $this->client->expects($this->once())->method('bulk')->willReturn($result); $this->setExpectedException('CascadeEnergy\\ElasticSearch\\Exceptions\\PartialFailureException'); $this->bulk->addItem('idFoo', 'foo'); $this->bulk->flush(); }