Beispiel #1
0
 public function setUp()
 {
     if (self::$app === null) {
         self::$app = new TApplication(dirname(__FILE__) . '/app');
         prado::setPathofAlias('App', dirname(__FILE__));
     }
     if (self::$config === null) {
         // Simulate a config file
         self::$config = new TXmlDocument('1.0', 'utf8');
         self::$config->loadFromString('<users><user name="Joe" password="******"/><user name="John" password="******" /><user name="test" password="******" roles="Reader, User"/><role name="Administrator" users="John" /><role name="Writer" users="Joe, John" /></users>');
     }
 }
Beispiel #2
0
 public function setUp()
 {
     if (self::$app === null) {
         self::$app = new TApplication(dirname(__FILE__) . '/app');
         prado::setPathofAlias('App', dirname(__FILE__));
     }
     if (self::$mgr === null) {
         $config = new TXmlDocument('1.0', 'utf8');
         $config->loadFromString('<users><user name="Joe" password="******"/><user name="John" password="******" /><role name="Administrator" users="John" /><role name="Writer" users="Joe,John" /></users>');
         self::$mgr = new TUserManager();
         self::$mgr->init($config);
     }
 }
Beispiel #3
0
 public function setUp()
 {
     // Fake environment variables needed to determine path
     $_SERVER['HTTP_HOST'] = 'localhost';
     $_SERVER['SERVER_NAME'] = 'localhost';
     $_SERVER['SERVER_PORT'] = '80';
     $_SERVER['REQUEST_METHOD'] = 'GET';
     $_SERVER['REQUEST_URI'] = '/demos/personal/index.php?page=Links';
     $_SERVER['SCRIPT_NAME'] = '/demos/personal/index.php';
     $_SERVER['PHP_SELF'] = '/demos/personal/index.php';
     $_SERVER['QUERY_STRING'] = 'page=Links';
     $_SERVER['SCRIPT_FILENAME'] = __FILE__;
     $_SERVER['PATH_INFO'] = __FILE__;
     $_SERVER['HTTP_REFERER'] = 'http://www.pradosoft.com';
     $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
     $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3';
     $_SERVER['REMOTE_HOST'] = 'localhost';
     if (self::$app === null) {
         self::$app = new TApplication(dirname(__FILE__) . '/app');
     }
     if (self::$assetDir === null) {
         self::$assetDir = dirname(__FILE__) . '/assets';
     }
     // Make asset directory if not exists
     if (!file_exists(self::$assetDir)) {
         if (is_writable(dirname(self::$assetDir))) {
             mkdir(self::$assetDir);
         } else {
             throw new Exception('Directory ' . dirname(self::$assetDir) . ' is not writable');
         }
     } elseif (!is_dir(self::$assetDir)) {
         throw new Exception(self::$assetDir . ' exists and is not a directory');
     }
     // Define an alias to asset directory
     prado::setPathofAlias('AssetAlias', self::$assetDir);
 }