/** * @param LifecycleEventArgs $args */ public function postPersist(LifecycleEventArgs $args) { $entity = $args->getDocument(); try { $this->solrFacade->addDocument($entity); } catch (\RuntimeException $e) { } }
public function testAddEntity_FilteredEntityWithUnknownCallback() { $this->eventManager->expects($this->never())->method('handle'); $information = new MetaInformation(); $information->setSynchronizationCallback('shouldBeIndex'); $this->setupMetaFactoryLoadOneCompleteInformation($information); $solr = new SolrFacade($this->connectionFactory, $this->commandFactory, $this->eventManager, $this->metaFactory); try { $solr->addDocument(new InvalidTestEntityFiltered()); $this->fail('BadMethodCallException expected'); } catch (\BadMethodCallException $e) { $this->assertTrue(true); } }