Пример #1
0
 public function properties()
 {
     $r = new Runner('/var/www', 'dev');
     $r->mapApplication('/debug', (new \xp\scriptlet\WebApplication('debug'))->withScriptlet(self::$debugScriptlet->getName())->withConfig('res://user')->withArguments(['Debugging', 'today']));
     ob_start();
     $_REQUEST = [];
     $content = $r->run('/debug');
     $_REQUEST = [];
     $content = ob_get_contents();
     ob_end_clean();
     preg_match('#<h2>(.+)</h2>#', $content, $config);
     $this->assertEquals('util.CompositeProperties', $config[1], 'config');
 }
Пример #2
0
 /**
  * Creates a new runner
  *
  */
 protected function newRunner($profile = null)
 {
     $r = new Runner('/var/www', $profile);
     // The debug application
     $r->mapApplication('/debug', create(new \xp\scriptlet\WebApplication('debug'))->withScriptlet(self::$debugScriptlet->getName())->withConfig($r->expand('{WEBROOT}/etc/{PROFILE}'))->withEnvironment(array('DOMAIN' => 'example.com', 'ADMINS' => 'admin@example.com,root@localhost'))->withArguments(array('Debugging', 'today')));
     // The error application
     $r->mapApplication('/error', create(new \xp\scriptlet\WebApplication('error'))->withScriptlet(self::$errorScriptlet->getName())->withConfig($r->expand('{WEBROOT}/etc'))->withDebug('dev' === $profile ? \xp\scriptlet\WebDebug::XML | \xp\scriptlet\WebDebug::ERRORS | \xp\scriptlet\WebDebug::STACKTRACE | \xp\scriptlet\WebDebug::TRACE : \xp\scriptlet\WebDebug::NONE));
     // The incomplete app (missing a scriptlet)
     $r->mapApplication('/incomplete', create(new \xp\scriptlet\WebApplication('incomplete'))->withScriptlet(null)->withDebug(\xp\scriptlet\WebDebug::STACKTRACE));
     // The XML application
     $r->mapApplication('/xml', create(new \xp\scriptlet\WebApplication('xml'))->withScriptlet(self::$xmlScriptlet->getName())->withDebug('dev' === $profile ? \xp\scriptlet\WebDebug::XML : \xp\scriptlet\WebDebug::NONE));
     // The exit scriptlet
     $r->mapApplication('/exit', create(new \xp\scriptlet\WebApplication('exit'))->withScriptlet(self::$exitScriptlet->getName()));
     // The welcome application
     $r->mapApplication('/', create(new \xp\scriptlet\WebApplication('welcome'))->withScriptlet(self::$welcomeScriptlet->getName())->withConfig($r->expand('{WEBROOT}/etc'))->withDebug('dev' === $profile ? \xp\scriptlet\WebDebug::XML | \xp\scriptlet\WebDebug::ERRORS | \xp\scriptlet\WebDebug::STACKTRACE : \xp\scriptlet\WebDebug::NONE));
     return $r;
 }