Ejemplo n.º 1
0
 public function initialize(sfEventDispatcher $dispatcher, $parameters = array(), $attributes = array(), $options = array())
 {
     parent::initialize($dispatcher, $parameters, $attributes, $options);
     if (null === self::$initialPathArrayKeys) {
         self::$initialPathArrayKeys = array_keys($this->getPathInfoArray());
     }
     $this->resetPathInfoArray();
 }
 public function getRequest()
 {
     static $request;
     if (!$request) {
         $request = new sfWebRequest();
         $request->initialize($this);
     }
     return $request;
 }
Ejemplo n.º 3
0
 public function initialize(sfEventDispatcher $dispatcher, $parameters = array(), $attributes = array(), $options = array())
 {
     if (isset($options['content_custom_only_for_test'])) {
         $this->content = $options['content_custom_only_for_test'];
         unset($options['content_custom_only_for_test']);
     }
     parent::initialize($dispatcher, $parameters, $attributes, $options);
     if (null === self::$initialPathArrayKeys) {
         self::$initialPathArrayKeys = array_keys($this->getPathInfoArray());
     }
     $this->resetPathInfoArray();
 }
Ejemplo n.º 4
0
 /**
  * @see sfWebRequest
  */
 public function initialize(sfEventDispatcher $dispatcher, $parameters = array(), $attributes = array(), $options = array())
 {
     parent::initialize($dispatcher, $parameters, $attributes, $options);
     $this->parameterHolder = new opParameterHolder();
     $this->attributeHolder = new opParameterHolder();
     $this->parameterHolder->add($parameters);
     $this->attributeHolder->add($attributes);
     // POST parameters
     $this->getParameters = get_magic_quotes_gpc() ? sfToolkit::stripslashesDeep($_GET) : $_GET;
     $this->parameterHolder->add($this->getParameters);
     // POST parameters
     $this->postParameters = get_magic_quotes_gpc() ? sfToolkit::stripslashesDeep($_POST) : $_POST;
     $this->parameterHolder->add($this->postParameters);
     if ($this->isMethod(sfWebRequest::POST)) {
         $this->parameterHolder->remove('sf_method');
     }
     // additional parameters
     $this->requestParameters = $this->parseRequestParameters();
     $this->parameterHolder->add($this->requestParameters);
     $this->fixParameters();
 }
Ejemplo n.º 5
0
    }
    public function getUser()
    {
        return $this->user;
    }
    public function getStorage()
    {
        return $this->storage;
    }
}
$t = new lime_test(33, new lime_output_color());
$_SERVER['session_id'] = 'test';
sfConfig::set('sf_test_cache_dir', sfToolkit::getTmpDir());
$context = new sfContext();
$request = new sfWebRequest();
$request->initialize($context);
$context->request = $request;
$storage = sfStorage::newInstance('sfSessionTestStorage');
$storage->initialize($context);
$storage->clear();
$context->storage = $storage;
$user = new sfUser();
$user->initialize($context);
$context->user = $user;
// ->initialize()
$t->diag('->initialize()');
$t->is($user->getCulture(), 'en', '->initialize() sets the culture to "en" by default');
sfConfig::set('sf_i18n_default_culture', 'de');
$user->setCulture(null);
user_flush($context);
$t->is($user->getCulture(), 'de', '->initialize() sets the culture to the value of sf_i18n_default_culture if available');