PHPUnit_Util_Class::collectEnd PHP Method

collectEnd() public static method

Stops the collection of loaded classes and returns the names of the loaded classes.
public static collectEnd ( ) : array
return array
    public static function collectEnd()
    {
        return array_values(array_diff(get_declared_classes(), self::$buffer));
    }

Usage Example

 /**
  * @param  string  $suiteClassName
  * @param  string  $suiteClassFile
  * @return ReflectionClass
  * @throws RuntimeException
  */
 public function load($suiteClassName, $suiteClassFile = '')
 {
     $suiteClassName = str_replace('.php', '', $suiteClassName);
     if (empty($suiteClassFile)) {
         $suiteClassFile = PHPUnit_Util_Filesystem::classNameToFilename($suiteClassName);
     }
     if (!class_exists($suiteClassName, FALSE)) {
         PHPUnit_Util_Class::collectStart();
         $filename = PHPUnit_Util_Fileloader::checkAndLoad($suiteClassFile);
         $loadedClasses = PHPUnit_Util_Class::collectEnd();
     }
     if (!class_exists($suiteClassName, FALSE) && !empty($loadedClasses)) {
         $offset = 0 - strlen($suiteClassName);
         foreach ($loadedClasses as $loadedClass) {
             $class = new ReflectionClass($loadedClass);
             if (substr($loadedClass, $offset) === $suiteClassName && $class->getFileName() == $filename) {
                 $suiteClassName = $loadedClass;
                 break;
             }
         }
     }
     if (!class_exists($suiteClassName, FALSE) && !empty($loadedClasses)) {
         $testCaseClass = 'PHPUnit_Framework_TestCase';
         foreach ($loadedClasses as $loadedClass) {
             $class = new ReflectionClass($loadedClass);
             $classFile = $class->getFileName();
             if ($class->isSubclassOf($testCaseClass) && !$class->isAbstract()) {
                 $suiteClassName = $loadedClass;
                 $testCaseClass = $loadedClass;
                 if ($classFile == realpath($suiteClassFile)) {
                     break;
                 }
             }
             if ($class->hasMethod('suite')) {
                 $method = $class->getMethod('suite');
                 if (!$method->isAbstract() && $method->isPublic() && $method->isStatic()) {
                     $suiteClassName = $loadedClass;
                     if ($classFile == realpath($suiteClassFile)) {
                         break;
                     }
                 }
             }
         }
     }
     if (class_exists($suiteClassName, FALSE)) {
         $class = new ReflectionClass($suiteClassName);
         $filePath = $GLOBALS['base_dir'] . DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR . 'phpunit' . DIRECTORY_SEPARATOR . $suiteClassFile;
         if ($class->getFileName() == realpath($filePath)) {
             return $class;
         }
     }
     throw new PHPUnit_Framework_Exception(sprintf('Class %s could not be found in %s.', $suiteClassName, $suiteClassFile));
 }
All Usage Examples Of PHPUnit_Util_Class::collectEnd