public function testFromAbstractClass()
 {
     $reflection = new ReflectionClass('DoctrineTest\\InstantiatorTestAsset\\AbstractClassAsset');
     $exception = InvalidArgumentException::fromAbstractClass($reflection);
     $this->assertSame('The provided class "DoctrineTest\\InstantiatorTestAsset\\AbstractClassAsset" is abstract, ' . 'and can not be instantiated', $exception->getMessage());
 }
Ejemplo n.º 2
0
 /**
  * @param string $className
  *
  * @return ReflectionClass
  *
  * @throws InvalidArgumentException
  */
 private function getReflectionClass($className)
 {
     if (!class_exists($className)) {
         throw InvalidArgumentException::fromNonExistingClass($className);
     }
     $reflection = new ReflectionClass($className);
     if ($reflection->isAbstract()) {
         throw InvalidArgumentException::fromAbstractClass($reflection);
     }
     return $reflection;
 }