示例#1
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;
 }
 public function testFromAbstractClass()
 {
     $reflection = new ReflectionClass('InstantiatorTestAsset\\AbstractClassAsset');
     $exception = InvalidArgumentException::fromAbstractClass($reflection);
     $this->assertSame('The provided class "InstantiatorTestAsset\\AbstractClassAsset" is abstract, and can not be instantiated', $exception->getMessage());
 }