public function testLoad() { $manager = new Manager(); $manager->implement('InterfaceOne', 'ClassOne'); $this->descriptor->setManager($manager); $result = $this->descriptor->load(new ReflectionClass('ClassA')); $this->assertEquals($this->descriptor, $result); }
/** * @param \ReflectionParameter $param * * @throws Exception\RuntimeException * @return mixed */ protected function resolveArgumentValue(\ReflectionParameter $param) { $paramClass = null; try { $paramClass = $param->getClass(); } catch (\ReflectionException $e) { } if (!$paramClass instanceof ReflectionClass || $param->isDefaultValueAvailable()) { return $this->resolveArgumentDefaultValue($param); } if (!$this->manager instanceof Manager) { throw new RuntimeException("Unable to retrieve descriptor for class '{$paramClass->getName()}' " . "because the manager has not been set. Please use Descriptor::setManager to resolve this."); } return $this->manager->describe($paramClass->getName(), null, null, $paramClass); }
/** * @expectedException RuntimeException */ public function testGetNonInstantiableException() { $this->manager->get('ClassNoInstance'); }
/** * Get an instance of the given className or alias * * @param string $name * * @return object */ public function get($name) { return $this->dm->get($name); }