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 testItShouldEmptyTheItemListOnClear() { $this->bulk->addItem('idfoo', 'foo'); $this->assertAttributeEquals(1, 'itemCount', $this->bulk); $this->bulk->clear(); $this->assertAttributeEquals(0, 'itemCount', $this->bulk); }