/** * @Then /^the index should be updated$/ */ public function theIndexShouldBeUpdated() { $entityId = $this->entity->getId(); $document = $this->findDocumentById($entityId, self::DOCUMENT_NAME); $fields = $document->getFields(); $changedFieldValue = $fields['text_t']; if ($changedFieldValue != $this->entity->getText()) { throw new \RuntimeException(sprintf('updated entity with id %s was not updated in solr', $entityId)); } }
/** * @Then /^the index should be updated$/ */ public function theIndexShouldBeUpdated() { $client = $this->getMainContext()->getSolrClient(); $entityId = $this->entity->getId(); $query = $client->createSelect(); $query->setQuery(sprintf('id:%s', $entityId)); $resultset = $client->select($query); if ($resultset->getNumFound() == 0) { throw new RuntimeException(sprintf('could not find document with id %s after update', $entityId)); } foreach ($resultset as $document) { $changedFieldValue = $document['text_t']; if ($changedFieldValue != $this->entity->getText()) { throw new RuntimeException(sprintf('updated entity with id %s was not updated in solr', $entityId)); } } }