Пример #1
0
 public static function minimalBootstrap()
 {
     if (!defined('VENDOR_PATH')) {
         define('VENDOR_PATH', 'vendor');
     }
     if (VENDOR_PATH == '../vendor') {
         $kwfPath = '..';
     } else {
         $kwfPath = VENDOR_PATH . '/koala-framework/koala-framework';
     }
     if (!defined('KWF_PATH')) {
         define('KWF_PATH', $kwfPath);
     }
     //reset include path, don't use anything from php.ini
     set_include_path('.' . PATH_SEPARATOR . $kwfPath . PATH_SEPARATOR . self::_getZendPath());
     require_once $kwfPath . '/Kwf/Loader.php';
     Kwf_Loader::registerAutoload();
     Zend_Registry::setClassName('Kwf_Registry');
     $configSection = call_user_func(array(Kwf_Setup::$configClass, 'getDefaultConfigSection'));
     Kwf_Setup::$configSection = $configSection;
     error_reporting(E_ALL ^ E_STRICT);
     class_exists('Kwf_Trl');
     //trigger autoload
     umask(00);
     //nicht 002 weil wwwrun und kwcms in unterschiedlichen gruppen
 }
Пример #2
0
 public static function setup()
 {
     require_once KWF_PATH . '/Kwf/Loader.php';
     require_once KWF_PATH . '/Kwf/Setup.php';
     Kwf_Loader::registerAutoload();
     date_default_timezone_set('Europe/Berlin');
     mb_internal_encoding('UTF-8');
     Zend_Registry::setClassName('Kwf_Registry');
     // auskommentiert, da main() sowieso nicht aufgerufen wird
     //         require_once KWF_PATH.'/tests/TestConfiguration.php';
     require_once 'PHPUnit/Framework/TestSuite.php';
     require_once 'PHPUnit/TextUI/TestRunner.php';
 }
Пример #3
0
 public function testRegistryExceptionClassNotFound()
 {
     try {
         $registry = @Zend_Registry::setClassName('classdoesnotexist');
         $this->fail('Expected exception, because we cannot initialize the registry using a non-existent class.');
     } catch (Zend_Exception $e) {
         $this->assertRegExp('/file .* does not exist or .*/i', $e->getMessage());
     }
 }
Пример #4
0
 /**
  * Initialize the registry. Invoking this method more than once will generate an exception.
  *
  * @param mixed $registry - Either a name of the registry class (Zend_Registry, or a subclass)
  *                          or an instance of Zend_Registry (or subclass)
  * @return Zend_Registry
  *
  * @deprecated Since 0.9.0 -- Use Zend_Registry::setClassName() instead.
  */
 public static function initRegistry($registry = 'Zend_Registry')
 {
     trigger_error(__CLASS__ . "::" . __FUNCTION__ . " deprecated since 0.9.0, use Zend_Registry::setClassName() instead");
     require_once 'Zend/Registry.php';
     Zend_Registry::setClassName($registry);
     return Zend_Registry::getInstance();
 }
Пример #5
0
 public function testRegistryExceptionClassNotFound()
 {
     try {
         $registry = Zend_Registry::setClassName('classdoesnotexist');
         $this->fail('Expected exception, because we cannot initialize the registry using a non-existent class.');
     } catch (Zend_Exception $e) {
         $this->assertTrue(is_array($e->includeErrors));
         $this->assertEquals(2, count($e->includeErrors));
         $this->assertRegExp('/failed to open stream: No such file/i', $e->includeErrors[0]->errstr);
         $this->assertRegExp('/Failed opening \'classdoesnotexist\.php\'/i', $e->includeErrors[1]->errstr);
     }
 }
Пример #6
0
 public function testRegistryExceptionClassNotFound()
 {
     try {
         $registry = Zend_Registry::setClassName('classdoesnotexist');
         $this->fail('Expected exception, because we cannot initialize the registry using a non-existent class.');
     } catch (Zend_Exception $e) {
         $this->assertContains('File "classdoesnotexist.php" was not found', $e->getMessage());
     }
 }
Пример #7
0
                                $v = Kwf_Trl::getInstance();
                                $this->offsetSet('trl', $v);
                                return $v;
                            }
                        }
                    }
                }
            }
        }
        return parent::offsetGet($index);
    }
    public function offsetExists($index)
    {
        if (in_array($index, array('db', 'config', 'dao', 'acl', 'userModel', 'trl'))) {
            return true;
        }
        return parent::offsetExists($index);
    }
    public function offsetUnset($index)
    {
        if (in_array($index, array('db', 'dao', 'userModel'))) {
            if (!parent::offsetExists($index)) {
                //not yet set, ignore
                return;
            }
        }
        return parent::offsetUnset($index);
    }
}
Zend_Registry::setClassName('Kwf_Registry');
Пример #8
0
 /**
  * Set the class name to use for the default registry instance.
  * Does not affect the currently initialized instance, it only applies
  * for the next time you instantiate.
  *
  * @param string $registryClassName
  * @return void
  * @throws Zend_Exception if the registry is initialized or if the
  *   class name is not valid.
  */
 public static function setClassName($registryClassName = 'Engine_Registry')
 {
     if (self::$_registry !== null) {
         // require_once 'Zend/Exception.php';
         throw new Zend_Exception('Registry is already initialized');
     }
     if (!is_string($registryClassName)) {
         // require_once 'Zend/Exception.php';
         throw new Zend_Exception("Argument is not a class name");
     }
     /**
      * @see Zend_Loader
      */
     if (!class_exists($registryClassName)) {
         Engine_Loader::loadClass($registryClassName);
     }
     parent::setClassName($registryClassName);
     self::$_registryClassName = $registryClassName;
 }