Example #1
0
 /**
  * Bootstrap code for Horde PEAR packages.
  *
  * @param string $dir           Base directory of tests.
  * @param boolean $no_autoload  Don't run default Horde_Test autoload
  *                              tasks.
  */
 public static function bootstrap($dir, $no_autoload = false)
 {
     if (self::$_runonce) {
         return;
     }
     if (!$no_autoload) {
         // Catch strict standards
         error_reporting(E_ALL | E_STRICT);
         // Set up autoload
         $base = $dir;
         while ($base != '/' && basename($base) != 'Horde') {
             $base = dirname($base);
         }
         $base = dirname($base);
         if ($base) {
             set_include_path($base . PATH_SEPARATOR . $base . '/../lib' . PATH_SEPARATOR . get_include_path());
         }
         require_once 'Horde/Test/Autoload.php';
         Horde_Test_Autoload::init();
     }
     if (file_exists($dir . '/Autoload.php')) {
         require_once $dir . '/Autoload.php';
     }
     self::$_runonce = true;
 }
Example #2
0
<?php

require_once 'Horde/Test/Bootstrap.php';
Horde_Test_Bootstrap::bootstrap(dirname(__FILE__));
Example #3
0
 /**
  * Basic test suite setup. This includes error checking and autoloading.
  *
  * In the default situation this will set the error reporting to E_ALL |
  * E_STRICT and pull in Horde/Test/Autoload.php as autoloading
  * definition. If there is an Autoload.php in $_dir, then only this file
  * will be used.
  *
  * In addition the setup() call will attempt to detect the "lib" directory
  * of the component currently under test and add it to the
  * include_path. This ensures that the component code from the checkout is
  * preferred over whatever else might be available in the default
  * include_path.
  */
 public function setup()
 {
     // Detect component root and add "lib" and "test" to the include path.
     $base = $this->_dir;
     while ($base != '/' && basename($base) != 'test') {
         $base = dirname($base);
     }
     if ($base) {
         set_include_path($base . PATH_SEPARATOR . $base . '/../lib' . PATH_SEPARATOR . get_include_path());
     }
     require_once 'Horde/Test/Bootstrap.php';
     Horde_Test_Bootstrap::bootstrap($this->_dir);
     if (file_exists($this->_dir . '/Autoload.php')) {
         require_once $this->_dir . '/Autoload.php';
     }
 }