Horde_Test_AllTests::init PHP Méthode

init() public static méthode

Create a Horde_Test_AllTests object.
public static init ( string $file ) : Horde_Test_AllTests
$file string Filename of the AllTests.php script.
Résultat Horde_Test_AllTests Test object.
    public static function init($file)
    {
        $file = dirname($file);
        $parts = array();
        foreach (array_reverse(explode(DIRECTORY_SEPARATOR, $file)) as $val) {
            if ($val == 'test' || $val == implode('_', array_reverse($parts))) {
                break;
            }
            $parts[] = $val;
        }
        return new self(implode('_', array_reverse($parts)), $file);
    }

Usage Example

Exemple #1
0
 /**
  * Run the task.
  *
  * @param array &$options Additional options.
  *
  * @return integer Number of errors.
  */
 public function run(&$options)
 {
     try {
         $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(realpath($this->_config->getPath() . '/test')));
     } catch (Exception $e) {
         return false;
     }
     $result = null;
     foreach ($iterator as $file) {
         if ($file->getFilename() == 'AllTests.php') {
             $result = Horde_Test_AllTests::init(strval($file))->run();
         }
     }
     if ($result) {
         return $result->errorCount() + $result->failureCount();
     }
 }
All Usage Examples Of Horde_Test_AllTests::init