protected function prepareTests( $directories, $params )
    {
        if ( count( $directories ) <= 0 )
            return self::suite();

        $suite = new ezpTestSuite;
        $suite->setName( "eZ Publish Test Suite" );

        foreach ( $directories as $dir )
        {
            $file = $dir;
            if ( strpos( $file, 'suite.php' ) === false )
            {
                $file = eZDir::path( array( $file, "suite.php" ) );
            }

            if ( !file_exists( $file ) )
            {
                $normalizedExtDir = $this->normalizeExtensionPath( $dir );
                $file = eZDir::path( array( $normalizedExtDir, "tests/suite.php") );
            }

            if ( file_exists( $file ) )
            {
                require_once( $file );
                $class = self::getClassName( $file );
                $suite->addTest( new $class );
            }
            else
            {
                print( "Unable to load $file\n" );
            }
        }

        return $suite;
    }
 /**
  * Returns the eZ Publish test suite
  *
  * If $directories are given, only the tests in these directories will be executed.
  * If omitted, the default eZ Publish test suite and all extension test suites will be executed.
  *
  * @param array $directories
  * @return ezpTestSuite $suite
  */
 protected function prepareTests(array $directories = array())
 {
     // If no $directories are given, we return the standard eZ Publish test suite
     if (count($directories) === 0) {
         // The default eZ Publish test suite with all core tests
         $suite = new eZTestSuite();
         // Add the extension directories to search for test suites
         $directories = eZDir::findSubitems(eZExtension::baseDirectory(), 'dl', true);
     } else {
         $suite = new ezpTestSuite();
         $suite->setName("eZ Publish Test Suite");
     }
     foreach ($directories as $dir) {
         $file = $dir;
         if (strpos($file, 'suite.php') === false) {
             $file = eZDir::path(array($file, "suite.php"));
         }
         if (!file_exists($file)) {
             $normalizedExtDir = $this->normalizeExtensionPath($dir);
             $file = eZDir::path(array($normalizedExtDir, "tests/suite.php"));
         }
         if (file_exists($file)) {
             require_once $file;
             $class = self::getClassName($file);
             $suite->addTest(new $class());
         } else {
             // No suite.php found anywhere in given (extension) directory.
             print "No tests found for {$dir}\n";
         }
     }
     return $suite;
 }