public function testWrongFactorySource() { $this->setExpectedException(UnableToBuild::class); $plan = new FactoryObjectProductBuildPlan(); $plan->setFactoryObject(new ScalarValue("not a factory")); $this->haringo->buildObjectBasedOn($plan); }
public function mapToObject(array $previouslyMappedObject) { $plan = new FactoryObjectProductBuildPlan(); $plan->setFactoryObject($this->objectSourceMapper->mapToObject($previouslyMappedObject[0])); $plan->setBuildMethodCall($this->methodCallMapper->mapToObject($previouslyMappedObject[1])); return $plan; }
/** * @return mixed factory object * @throws UnableToBuild when got something different than an object */ private function getFactoryObjectBasedOn(FactoryObjectProductBuildPlan $p) { $factorySource = $p->getFactoryObjectSource(); $factory = $this->objectResolver->resolveValueFrom($factorySource); if (!is_object($factory)) { throw new UnableToBuild(); } return $factory; }