Example #1
0
 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);
 }
Example #2
0
 /**
  * @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);
 }
Example #3
0
 /**
  * @expectedException RuntimeException
  */
 public function testGetNonInstantiableException()
 {
     $this->manager->get('ClassNoInstance');
 }
Example #4
0
 /**
  * Get an instance of the given className or alias
  *
  * @param string $name
  *
  * @return object
  */
 public function get($name)
 {
     return $this->dm->get($name);
 }