/** * @param MetaInformation $metaInformation * @param object $entity * @throws \BadMethodCallException if callback method not exists * @return boolean */ private function addToIndex(MetaInformation $metaInformation, $entity) { if (!$metaInformation->hasSynchronizationFilter()) { return true; } $callback = $metaInformation->getSynchronizationCallback(); if (!method_exists($entity, $callback)) { throw new \BadMethodCallException(sprintf('unknown method %s in entity %s', $callback, get_class($entity))); } return $entity->{$callback}(); }
public function testHasCallback_NoCallbackSet() { $information = new MetaInformation(); $this->assertFalse($information->hasSynchronizationFilter(), 'has no callback'); }