/**
  * Composes a TestSuite from a TestCaseClass or uses $staticProperties['phantomPath']
  * for creation of a TestSuite from a folder.
  *
  * @param  string $className extending PHPUnit_Extensions_PhantomTestCase
  * @return PHPUnit_Extensions_PhantomTestSuite
  */
 public static function addTestsFromTestCaseClass($className)
 {
     $suite = new self();
     $suite->setName($className);
     // use Ref to allow access to class properties
     $class = new ReflectionClass($className);
     $classGroups = PHPUnit_Util_Test::getGroups($className);
     $staticProperties = $class->getStaticProperties();
     // Tests come from Folder.
     // create tests from a folder with phantom .js or .coffee files
     if (isset($staticProperties['phantomPath']) === true) {
         $files = array();
         if (is_dir($staticProperties['phantomPath']) === true) {
             $files = array_merge(self::getTestFilesFromFolder($staticProperties['phantomPath'], '.js'), self::getTestFilesFromFolder($staticProperties['phantomPath'], '.coffee'));
         } else {
             $files[] = realpath($staticProperties['phantomPath']);
         }
         // create tests from PhantomJS javascript or coffee script files
         foreach ($files as $file) {
             $basename = basename($file);
             $filename = str_replace(array('.js', '.coffee'), array('', ''), $basename);
             // exclude some javascript tests from execution, because:
             $excludedFiles = array('modernizr', 'jquery', 'movies', 'seasonfood', 'outputEncoding', 'sleepsort', 'stdin-stdout-stderr', 'universe', 'colorwheel', 'technews');
             if (in_array($filename, $excludedFiles) === true) {
                 continue;
             }
             // filename to testname
             $testname = 'test_' . str_replace('.', '_', $basename);
             // every Phantom test file gets its own test case (one executePhantomJS call each)
             $test = new PHPUnit_Extensions_Phantom_FileExecute($testname, array($file));
             $suite->addTest($test, $classGroups);
         }
     } else {
         // Test come from a TestCaseClass.
         // create tests for all methods of the test case class
         foreach ($class->getMethods() as $method) {
             $suite->addTestMethod($class, $method);
         }
     }
     return $suite;
 }