Development

Changeset 5016

You must first sign up to be able to contribute.

Changeset 5016

Show
Ignore:
Timestamp:
09/09/07 17:11:05 (2 years ago)
Author:
fabien
Message:

added a new sfNamespacedParameterHolder, the old sfParameterHolder does not support namespace anymore, changed all parameter and attribute older to use the simple sfParameterHolder except for user attributes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/addon/sfPager.class.php

    r4659 r5016  
    281281  } 
    282282 
    283   public function getParameter($name, $default = null, $ns = null
    284   { 
    285     return $this->parameterHolder->get($name, $default, $ns); 
    286   } 
    287  
    288   public function hasParameter($name, $ns = null
    289   { 
    290     return $this->parameterHolder->has($name, $ns); 
    291   } 
    292  
    293   public function setParameter($name, $value, $ns = null
    294   { 
    295     return $this->parameterHolder->set($name, $value, $ns); 
     283  public function getParameter($name, $default = null
     284  { 
     285    return $this->parameterHolder->get($name, $default); 
     286  } 
     287 
     288  public function hasParameter($name
     289  { 
     290    return $this->parameterHolder->has($name); 
     291  } 
     292 
     293  public function setParameter($name, $value
     294  { 
     295    return $this->parameterHolder->set($name, $value); 
    296296  } 
    297297} 
  • trunk/lib/cache/sfCache.class.php

    r4957 r5016  
    200200  } 
    201201 
    202   public function getParameter($name, $default = null, $ns = null
    203   { 
    204     return $this->parameterHolder->get($name, $default, $ns); 
    205   } 
    206  
    207   public function hasParameter($name, $ns = null
    208   { 
    209     return $this->parameterHolder->has($name, $ns); 
    210   } 
    211  
    212   public function setParameter($name, $value, $ns = null
    213   { 
    214     return $this->parameterHolder->set($name, $value, $ns); 
     202  public function getParameter($name, $default = null
     203  { 
     204    return $this->parameterHolder->get($name, $default); 
     205  } 
     206 
     207  public function hasParameter($name
     208  { 
     209    return $this->parameterHolder->has($name); 
     210  } 
     211 
     212  public function setParameter($name, $value
     213  { 
     214    return $this->parameterHolder->set($name, $value); 
    215215  } 
    216216 
  • trunk/lib/database/sfDatabase.class.php

    r4957 r5016  
    115115   * @param string The key name 
    116116   * @param string The default value 
    117    * @param string The namespace to use 
    118117   * 
    119118   * @return string The value associated with the key 
     
    121120   * @see sfParameterHolder 
    122121   */ 
    123   public function getParameter($name, $default = null, $ns = null
     122  public function getParameter($name, $default = null
    124123  { 
    125     return $this->parameterHolder->get($name, $default, $ns); 
     124    return $this->parameterHolder->get($name, $default); 
    126125  } 
    127126 
     
    134133   * 
    135134   * @param string The key name 
    136    * @param string The namespace to use 
    137135   * 
    138136   * @return boolean true if the given key exists, false otherwise 
     
    140138   * @see sfParameterHolder 
    141139   */ 
    142   public function hasParameter($name, $ns = null
     140  public function hasParameter($name
    143141  { 
    144     return $this->parameterHolder->has($name, $ns); 
     142    return $this->parameterHolder->has($name); 
    145143  } 
    146144 
     
    154152   * @param string The key name 
    155153   * @param string The value 
    156    * @param string The namespace to use 
    157154   * 
    158155   * @see sfParameterHolder 
    159156   */ 
    160   public function setParameter($name, $value, $ns = null
     157  public function setParameter($name, $value
    161158  { 
    162     $this->parameterHolder->set($name, $value, $ns); 
     159    $this->parameterHolder->set($name, $value); 
    163160  } 
    164161 
  • trunk/lib/debug/sfDebug.class.php

    r3786 r5016  
    152152  { 
    153153    $values = array(); 
    154     foreach ($parameterHolder->getNamespaces() as $ns
     154    if ($parameterHolder instanceof sfNamespacedParameterHolder
    155155    { 
    156       $values[$ns] = array(); 
    157       foreach ($parameterHolder->getAll($ns) as $key => $value) 
     156      foreach ($parameterHolder->getNamespaces() as $ns) 
    158157      { 
    159         $values[$ns][$key] = $value; 
     158        $values[$ns] = array(); 
     159        foreach ($parameterHolder->getAll($ns) as $key => $value) 
     160        { 
     161          $values[$ns][$key] = $value; 
     162        } 
     163        ksort($values[$ns]); 
    160164      } 
    161       ksort($values[$ns]); 
     165    } 
     166    else 
     167    { 
     168      foreach ($parameterHolder->getAll() as $key => $value) 
     169      { 
     170        $values[$key] = $value; 
     171      } 
    162172    } 
    163173 
  • trunk/lib/event/sfEvent.class.php

    r5015 r5016  
    107107  } 
    108108 
    109   public function getParameter($name, $default = null, $ns = null
     109  public function getParameter($name, $default = null
    110110  { 
    111     return $this->parameterHolder->get($name, $default, $ns); 
     111    return $this->parameterHolder->get($name, $default); 
    112112  } 
    113113 
    114   public function hasParameter($name, $ns = null
     114  public function hasParameter($name
    115115  { 
    116     return $this->parameterHolder->has($name, $ns); 
     116    return $this->parameterHolder->has($name); 
    117117  } 
    118118 
    119   public function setParameter($name, $value, $ns = null
     119  public function setParameter($name, $value
    120120  { 
    121     return $this->parameterHolder->set($name, $value, $ns); 
     121    return $this->parameterHolder->set($name, $value); 
    122122  } 
    123123} 
  • trunk/lib/filter/sfFilter.class.php

    r4957 r5016  
    107107   * @param string The key name 
    108108   * @param string The default value 
    109    * @param string The namespace to use 
    110109   * 
    111110   * @return string The value associated with the key 
     
    113112   * @see sfParameterHolder 
    114113   */ 
    115   public function getParameter($name, $default = null, $ns = null
     114  public function getParameter($name, $default = null
    116115  { 
    117     return $this->parameterHolder->get($name, $default, $ns); 
     116    return $this->parameterHolder->get($name, $default); 
    118117  } 
    119118 
     
    126125   * 
    127126   * @param string The key name 
    128    * @param string The namespace to use 
    129127   * 
    130128   * @return boolean true if the given key exists, false otherwise 
     
    132130   * @see sfParameterHolder 
    133131   */ 
    134   public function hasParameter($name, $ns = null
     132  public function hasParameter($name
    135133  { 
    136     return $this->parameterHolder->has($name, $ns); 
     134    return $this->parameterHolder->has($name); 
    137135  } 
    138136 
     
    146144   * @param string The key name 
    147145   * @param string The value 
    148    * @param string The namespace to use 
    149146   * 
    150147   * @see sfParameterHolder 
    151148   */ 
    152   public function setParameter($name, $value, $ns = null
     149  public function setParameter($name, $value
    153150  { 
    154     return $this->parameterHolder->set($name, $value, $ns); 
     151    return $this->parameterHolder->set($name, $value); 
    155152  } 
    156153} 
  • trunk/lib/request/sfRequest.class.php

    r4957 r5016  
    297297   * @param string Attribute name 
    298298   * @param string Default attribute value 
    299    * @param string Namespace for the current request 
    300299   * 
    301300   * @return mixed An attribute value 
    302301   */ 
    303   public function getAttribute($name, $default = null, $ns = null
    304   { 
    305     return $this->attributeHolder->get($name, $default, $ns); 
     302  public function getAttribute($name, $default = null
     303  { 
     304    return $this->attributeHolder->get($name, $default); 
    306305  } 
    307306 
     
    310309   * 
    311310   * @param string Attribute name 
    312    * @param string Namespace for the current request 
    313311   * 
    314312   * @return boolean true, if the attribute exists otherwise false 
    315313   */ 
    316   public function hasAttribute($name, $ns = null
    317   { 
    318     return $this->attributeHolder->has($name, $ns); 
     314  public function hasAttribute($name
     315  { 
     316    return $this->attributeHolder->has($name); 
    319317  } 
    320318 
     
    324322   * @param string Attribute name 
    325323   * @param string Value for the attribute 
    326    * @param string Namespace for the current request 
    327    * 
    328    */ 
    329   public function setAttribute($name, $value, $ns = null) 
    330   { 
    331     $this->attributeHolder->set($name, $value, $ns); 
     324   * 
     325   */ 
     326  public function setAttribute($name, $value) 
     327  { 
     328    $this->attributeHolder->set($name, $value); 
    332329  } 
    333330 
     
    337334   * @param string Parameter name 
    338335   * @param string Parameter default value 
    339    * @param string Namespace for the current request 
    340    * 
    341    */ 
    342   public function getParameter($name, $default = null, $ns = null) 
    343   { 
    344     return $this->parameterHolder->get($name, $default, $ns); 
     336   * 
     337   */ 
     338  public function getParameter($name, $default = null) 
     339  { 
     340    return $this->parameterHolder->get($name, $default); 
    345341  } 
    346342 
     
    349345   * 
    350346   * @param string Parameter name 
    351    * @param string Namespace for the current request 
    352347   * 
    353348   * @return boolean true, if the paramater exists otherwise false 
    354349   */ 
    355   public function hasParameter($name, $ns = null
    356   { 
    357     return $this->parameterHolder->has($name, $ns); 
     350  public function hasParameter($name
     351  { 
     352    return $this->parameterHolder->has($name); 
    358353  } 
    359354 
     
    363358   * @param string Parameter name 
    364359   * @param string Parameter value 
    365    * @param string Namespace for the current request 
    366    * 
    367    */ 
    368   public function setParameter($name, $value, $ns = null) 
    369   { 
    370     $this->parameterHolder->set($name, $value, $ns); 
     360   * 
     361   */ 
     362  public function setParameter($name, $value) 
     363  { 
     364    $this->parameterHolder->set($name, $value); 
    371365  } 
    372366 
  • trunk/lib/request/sfWebRequest.class.php

    r4951 r5016  
    823823    $this->parameterHolder->add($this->postParameters); 
    824824 
    825     // move symfony parameters in a protected namespace (parameters prefixed with _sf_) 
     825    // move symfony parameters to attributes (parameters prefixed with _sf_) 
    826826    foreach ($this->parameterHolder->getAll() as $key => $value) 
    827827    { 
     
    829829      { 
    830830        $this->parameterHolder->remove($key); 
    831         $this->setParameter($key, $value, 'symfony/request/sfWebRequest'); 
     831        $this->setAttribute($key, $value); 
    832832      } 
    833833    } 
  • trunk/lib/response/sfResponse.class.php

    r4957 r5016  
    3939   * 
    4040   * @param  sfEventDispatcher  A sfEventDispatcher instance 
    41    * @param  array         An array of parameters 
     41   * @param  array              An array of parameters 
    4242   * 
    43    * @return Boolean       true, if initialization completes successfully, otherwise false 
     43   * @return Boolean            true, if initialization completes successfully, otherwise false 
    4444   * 
    4545   * @throws <b>sfInitializationException</b> If an error occurs while initializing this sfResponse 
     
    101101   * @param string A parameter name 
    102102   * @param string A default paramter value 
    103    * @param string Namespace for the current response 
    104103   * 
    105104   * @return mixed A parameter value 
    106105   */ 
    107   public function getParameter($name, $default = null, $ns = null
     106  public function getParameter($name, $default = null
    108107  { 
    109     return $this->parameterHolder->get($name, $default, $ns); 
     108    return $this->parameterHolder->get($name, $default); 
    110109  } 
    111110 
     
    114113   * 
    115114   * @param string A parameter name 
    116    * @param string Namespace for the current response 
    117115   * 
    118116   * @return boolean true, if the parameter exists otherwise false 
    119117   */ 
    120   public function hasParameter($name, $ns = null
     118  public function hasParameter($name
    121119  { 
    122     return $this->parameterHolder->has($name, $ns); 
     120    return $this->parameterHolder->has($name); 
    123121  } 
    124122 
     
    128126   * @param string A parameter name 
    129127   * @param string The parameter value to be set 
    130    * @param string Namespace for the current response 
    131128   */ 
    132   public function setParameter($name, $value, $ns = null
     129  public function setParameter($name, $value
    133130  { 
    134     $this->parameterHolder->set($name, $value, $ns); 
     131    $this->parameterHolder->set($name, $value); 
    135132  } 
    136133 
  • trunk/lib/response/sfWebResponse.class.php

    r4951 r5016  
    2626    $statusText  = 'OK', 
    2727    $statusTexts = array(), 
    28     $headerOnly  = false; 
     28    $headerOnly  = false, 
     29    $headers     = array(), 
     30    $metas       = array(), 
     31    $httpMetas   = array(), 
     32    $stylesheets = array(), 
     33    $javascripts = array(); 
    2934 
    3035  /** 
     
    3237   * 
    3338   * @param  sfEventDispatcher  A sfEventDispatcher instance 
    34    * @param  array         An array of parameters 
    35    * 
    36    * @return Boolean       true, if initialization completes successfully, otherwise false 
     39   * @param  array              An array of parameters 
     40   * 
     41   * @return Boolean            true, if initialization completes successfully, otherwise false 
    3742   * 
    3843   * @throws <b>sfInitializationException</b> If an error occurs while initializing this sfResponse 
     
    188193    if (is_null($value)) 
    189194    { 
    190       $this->getParameterHolder()->remove($name, 'symfony/response/http/headers'); 
     195      unset($this->headers[$name]); 
    191196 
    192197      return; 
     
    205210    if (!$replace) 
    206211    { 
    207       $current = $this->getParameter($name, '', 'symfony/response/http/headers')
     212      $current = isset($this->headers[$name]) ? $this->headers[$name] : ''
    208213      $value = ($current ? $current.', ' : '').$value; 
    209214    } 
    210215 
    211     $this->setParameter($name, $value, 'symfony/response/http/headers')
     216    $this->headers[$name] = $value
    212217  } 
    213218 
     
    219224  public function getHttpHeader($name, $default = null) 
    220225  { 
    221     return $this->getParameter($this->normalizeHeaderName($name), $default, 'symfony/response/http/headers'); 
     226    $name = $this->normalizeHeaderName($name); 
     227 
     228    return isset($this->headers[$name]) ? $this->headers[$name] : $default; 
    222229  } 
    223230 
     
    229236  public function hasHttpHeader($name) 
    230237  { 
    231     return $this->hasParameter($this->normalizeHeaderName($name), 'symfony/response/http/headers'); 
     238    return array_key_exists($this->normalizeHeaderName($name), $this->headers); 
    232239  } 
    233240 
     
    246253    } 
    247254 
    248     $this->setParameter('Content-Type', $value, 'symfony/response/http/headers')
     255    $this->headers['Content-Type'] = $value
    249256  } 
    250257 
     
    275282 
    276283    // headers 
    277     foreach ($this->getParameterHolder()->getAll('symfony/response/http/headers') as $name => $value) 
     284    foreach ($this->headers as $name => $value) 
    278285    { 
    279286      header($name.': '.$value); 
     
    425432  public function getHttpMetas() 
    426433  { 
    427     return $this->getParameterHolder()->getAll('helper/asset/auto/httpmeta')
     434    return $this->httpMetas
    428435  } 
    429436 
     
    444451    if (is_null($value)) 
    445452    { 
    446       $this->getParameterHolder()->remove($key, 'helper/asset/auto/httpmeta'); 
     453      unset($this->httpMetas[$key]); 
    447454 
    448455      return; 
     
    456463    if (!$replace) 
    457464    { 
    458       $current = $this->getParameter($key, '', 'helper/asset/auto/httpmeta')
     465      $current = isset($this->httpMetas[$key]) ? $this->httpMetas[$key] : ''
    459466      $value = ($current ? $current.', ' : '').$value; 
    460467    } 
    461468 
    462     $this->setParameter($key, $value, 'helper/asset/auto/httpmeta')
     469    $this->httpMetas[$key] = $value
    463470  } 
    464471 
     
    470477  public function getMetas() 
    471478  { 
    472     return $this->getParameterHolder()->getAll('helper/asset/auto/meta')
     479    return $this->metas
    473480  } 
    474481 
     
    487494    if (is_null($value)) 
    488495    { 
    489       $this->getParameterHolder()->remove($key, 'helper/asset/auto/meta'); 
     496      unset($this->metas[$key]); 
    490497 
    491498      return; 
     
    499506    } 
    500507 
    501     if ($replace || !$this->getParameter($key, null, 'helper/asset/auto/meta')) 
    502     { 
    503       $this->setParameter($key, $value, 'helper/asset/auto/meta'); 
     508    $current = isset($this->metas[$key]) ? $this->metas[$key] : null; 
     509    if ($replace || !$current) 
     510    { 
     511      $this->metas[$key] = $value; 
    504512    } 
    505513  } 
     
    512520  public function getTitle() 
    513521  { 
    514     return $this->getParameter('title', '', 'helper/asset/auto/meta')
     522    return isset($this->metas['title']) ? $this->metas['title'] : ''
    515523  } 
    516524 
     
    529537   * Retrieves stylesheets for the current web response. 
    530538   * 
    531    * @param string Direcotry delimiter 
     539   * @param string Position 
    532540   * 
    533541   * @return string Stylesheets 
     
    535543  public function getStylesheets($position = '') 
    536544  { 
    537     return $this->getParameterHolder()->getAll('helper/asset/auto/stylesheet'.($position ? '/'.$position : '')); 
     545    if ($position == 'ALL') 
     546    { 
     547      return $this->stylesheets; 
     548    } 
     549 
     550    return isset($this->stylesheets[$position]) ? $this->stylesheets[$position] : array(); 
    538551  } 
    539552 
     
    542555   * 
    543556   * @param string Stylesheet 
    544    * @param string Direcotry delimiter 
     557   * @param string Position 
    545558   * @param string Stylesheet options 
    546559   */ 
    547560  public function addStylesheet($css, $position = '', $options = array()) 
    548561  { 
    549     $this->setParameter($css, $options, 'helper/asset/auto/stylesheet'.($position ? '/'.$position : '')); 
     562    if (!isset($this->stylesheets[$position])) 
     563    { 
     564      $this->stylesheets[$position] = array(); 
     565    } 
     566 
     567    $this->stylesheets[$position][$css] = $options; 
    550568  } 
    551569 
     
    559577  public function getJavascripts($position = '') 
    560578  { 
    561     return $this->getParameterHolder()->getAll('helper/asset/auto/javascript'.($position ? '/'.$position : '')); 
     579    if ($position == 'ALL') 
     580    { 
     581      return $this->javascripts; 
     582    } 
     583 
     584    return isset($this->javascript[$position]) ? $this->javascript[$position] : array(); 
    562585  } 
    563586 
     
    571594  public function addJavascript($js, $position = '', $options = array()) 
    572595  { 
    573     $this->setParameter($js, $options, 'helper/asset/auto/javascript'.($position ? '/'.$position : '')); 
     596    if (!isset($this->javascript[$position])) 
     597    { 
     598      $this->javascript[$position] = array(); 
     599    } 
     600 
     601    $this->javascript[$position][$js] = $options; 
    574602  } 
    575603 
     
    597625  public function getHttpHeaders() 
    598626  { 
    599     return $this->getParameterHolder()->getAll('symfony/response/http/headers')
     627    return $this->headers
    600628  } 
    601629 
     
    605633  public function clearHttpHeaders() 
    606634  { 
    607     $this->getParameterHolder()->removeNamespace('symfony/response/http/headers'); 
    608   } 
    609  
    610   /** 
    611    * Copies a propertie to a new one. 
    612    * 
    613    * @param sfResponse Response instance 
    614    */ 
    615   public function mergeProperties($response) 
     635    $this->headers = array(); 
     636  } 
     637 
     638  /** 
     639   * Copies all properties from a given sfWebResponse object to the current one. 
     640   * 
     641   * @param sfWebResponse A sfWebResponse instance 
     642   */ 
     643  public function mergeProperties(sfWebResponse $response) 
    616644  { 
    617645    $this->parameterHolder = clone $response->getParameterHolder(); 
     646    $this->headers         = $response->getHttpHeaders(); 
     647    $this->metas           = $response->getMetas(); 
     648    $this->httpMetas       = $response->getHttpMetas(); 
     649    $this->stylesheets     = $response->getStylesheets('ALL'); 
     650    $this->javascripts     = $response->getJavascripts('ALL'); 
    618651  } 
    619652 
     
    625658  public function serialize() 
    626659  { 
    627     return serialize(array($this->content, $this->statusCode, $this->statusText, $this->parameterHolder, $this->cookies, $this->headerOnly)); 
     660    return serialize(array($this->content, $this->statusCode, $this->statusText, $this->parameterHolder, $this->cookies, $this->headerOnly, $this->headers, $this->metas, $this->httpMetas, $this->stylesheets, $this->javascripts)); 
    628661  } 
    629662 
     
    637670    $this->initialize(sfContext::hasInstance() ? sfContext::getInstance()->getEventDispatcher() : new sfEventDispatcher()); 
    638671 
    639     $this->content         = $data[0]; 
    640     $this->statusCode      = $data[1]; 
    641     $this->statusText      = $data[2]; 
    642     $this->parameterHolder = $data[3]; 
    643     $this->cookies         = $data[4]; 
    644     $this->headerOnly      = $data[5]; 
     672    list($this->content, $this->statusCode, $this->statusText, $this->parameterHolder, $this->cookies, $this->headerOnly, $this->headers, $this->metas, $this->httpMetas, $this->stylesheets, $this->javascripts) = $data; 
    645673  } 
    646674 
  • trunk/lib/storage/sfStorage.class.php

    r4961 r5016  
    5151  { 
    5252    $this->parameterHolder = new sfParameterHolder(); 
    53     $this->getParameterHolder()->add($parameters); 
     53    $this->parameterHolder->add($parameters); 
    5454  } 
    5555 
     
    114114   * @param string Parameter name 
    115115   * @param mixed A default parameter 
    116    * @param string Namespace for the current storage 
    117116   * 
    118117   * @return mixed A parameter value 
    119118   */ 
    120   public function getParameter($name, $default = null, $ns = null
     119  public function getParameter($name, $default = null
    121120  { 
    122     return $this->parameterHolder->get($name, $default, $ns); 
     121    return $this->parameterHolder->get($name, $default); 
    123122  } 
    124123 
     
    127126   * 
    128127   * @param string A parameter name 
    129    * @param string A parameter namespace 
    130128   * 
    131129   * @return boolean true, if parameter exists, otherwise false 
    132130   */ 
    133   public function hasParameter($name, $ns = null
     131  public function hasParameter($name
    134132  { 
    135     return $this->parameterHolder->has($name, $ns); 
     133    return $this->parameterHolder->has($name); 
    136134  } 
    137135 
     
    141139   * @param string A parameter name 
    142140   * @param mixed A parameter value 
    143    * @param string Namespace for the current storage 
    144141   */ 
    145   public function setParameter($name, $value, $ns = null
     142  public function setParameter($name, $value
    146143  { 
    147     return $this->parameterHolder->set($name, $value, $ns); 
     144    return $this->parameterHolder->set($name, $value); 
    148145  } 
    149146} 
  • trunk/lib/user/sfUser.class.php

    r4961 r5016  
    7373    $this->parameterHolder->add($parameters); 
    7474 
    75     $this->attributeHolder = new sfParameterHolder(self::ATTRIBUTE_NAMESPACE); 
     75    $this->attributeHolder = new sfNamespacedParameterHolder(self::ATTRIBUTE_NAMESPACE); 
    7676 
    7777    // read attributes from storage 
     
    218218  } 
    219219 
    220   public function getParameter($name, $default = null, $ns = null
    221   { 
    222     return $this->parameterHolder->get($name, $default, $ns); 
    223   } 
    224  
    225   public function hasParameter($name, $ns = null
    226   { 
    227     return $this->parameterHolder->has($name, $ns); 
    228   } 
    229  
    230   public function setParameter($name, $value, $ns = null
    231   { 
    232     return $this->parameterHolder->set($name, $value, $ns); 
     220  public function getParameter($name, $default = null
     221  { 
     222    return $this->parameterHolder->get($name, $default); 
     223  } 
     224 
     225  public function hasParameter($name
     226  { 
     227    return $this->parameterHolder->has($name); 
     228  } 
     229 
     230  public function setParameter($name, $value
     231  { 
     232    return $this->parameterHolder->set($name, $value); 
    233233  } 
    234234 
  • trunk/lib/util/sfParameterHolder.class.php

    r4898 r5016  
    2424class sfParameterHolder implements Serializable 
    2525{ 
    26   protected $default_namespace = null; 
    2726  protected $parameters = array(); 
    2827 
    2928  /** 
    3029   * The constructor for sfParameterHolder. 
    31    *  
    32    * The default namespace may be overridden at initialization as follows: 
    33    * <code> 
    34    * <?php 
    35    * $mySpecialPH = new sfParameterHolder('symfony/special'); 
    36    * ?> 
    37    * </code> 
    38    */ 
    39   public function __construct($namespace = 'symfony/default') 
    40   { 
    41     $this->default_namespace = $namespace; 
    42   } 
    43  
    44   /** 
    45    * Sets the default namespace value. 
    46    * 
    47    * @param string  Default namespace. 
    48    * @param Boolean Move all values of the old default namespace to the new one or not. 
    49    */ 
    50   public function setDefaultNamespace($namespace, $move = true) 
    51   { 
    52     if ($move) 
    53     { 
    54       $values = $this->removeNamespace(); 
    55       $this->addByRef($values, $namespace); 
    56     } 
    57  
    58     $this->default_namespace = $namespace; 
    59   } 
    60  
    61   /** 
    62    * Get the default namespace value. 
    63    * 
    64    * The $default_namespace is defined as 'symfony/default'. 
    65    * 
    66    * @return string The default namespace. 
    67    */ 
    68   public function getDefaultNamespace() 
    69   { 
    70     return $this->default_namespace; 
    71   } 
    72  
    73   /** 
    74    * Clear all parameters associated with this request. 
    75    * 
    76    * @return void 
     30   */ 
     31  public function __construct() 
     32  { 
     33  } 
     34 
     35  /** 
     36   * Clears all parameters associated with this request. 
    7737   */ 
    7838  public function clear() 
    7939  { 
    80     $this->parameters = null; 
    8140    $this->parameters = array(); 
    8241  } 
    8342 
    8443  /** 
    85    * Retrieve a parameter with an optionally specified namespace. 
    86    * 
    87    * An isolated namespace may be identified by providing a value for the third 
    88    * argument.  If not specified, the default namespace 'symfony/default' is 
    89    * used. 
     44   * Retrieves a parameter. 
    9045   * 
    9146   * @param string A parameter name. 
    9247   * @param mixed  A default parameter value. 
    93    * @param string A parameter namespace. 
    9448   * 
    9549   * @return mixed A parameter value, if the parameter exists, otherwise null. 
    9650   */ 
    97   public function & get($name, $default = null, $ns = null) 
    98   { 
    99     if (!$ns) 
    100     { 
    101       $ns = $this->default_namespace; 
    102     } 
    103  
    104     if (isset($this->parameters[$ns][$name])) 
    105     { 
    106       $value = & $this->parameters[$ns][$name]; 
    107     } 
    108     else if (isset($this->parameters[$ns])) 
    109     { 
    110       $value = sfToolkit::getArrayValueForPath($this->parameters[$ns], $name, $default); 
     51  public function & get($name, $default = null) 
     52  { 
     53    if (isset($this->parameters[$name])) 
     54    { 
     55      $value = & $this->parameters[$name]; 
    11156    } 
    11257    else 
    11358    { 
    114       $value = $default
     59      $value = sfToolkit::getArrayValueForPath($this->parameters, $name, $default)
    11560    } 
    11661 
     
    11964 
    12065  /** 
    121    * Retrieve an array of parameter names from an optionally specified namespace. 
    122    * 
    123    * @param string A parameter namespace. 
    124    * 
    125    * @return array An indexed array of parameter names, if the namespace exists, otherwise null. 
    126    */ 
    127   public function getNames($ns = null) 
    128   { 
    129     if (!$ns) 
    130     { 
    131       $ns = $this->default_namespace; 
    132     } 
    133  
    134     if (isset($this->parameters[$ns])) 
    135     { 
    136       return array_keys($this->parameters[$ns]); 
    137     } 
    138  
    139     return array(); 
    140   } 
    141  
    142   /** 
    143    * Retrieve an array of parameter namespaces. 
    144    * 
    145    * @return array An indexed array of parameter namespaces. 
    146    */ 
    147   public function getNamespaces() 
     66   * Retrieves an array of parameter names. 
     67   * 
     68   * @return array An indexed array of parameter names. 
     69   */ 
     70  public function getNames() 
    14871  { 
    14972    return array_keys($this->parameters); 
     
    15174 
    15275  /** 
    153    * Retrieve an array of parameters, within a namespace. 
    154    * 
    155    * This method is limited to a namespace.  Without any argument, 
    156    * it returns the parameters of the default namespace.  If a  
    157    * namespace is passed as an argument, only the parameters of the 
    158    * specified namespace are returned. 
    159    * 
    160    * @param string A parameter namespace. 
     76   * Retrieves an array of parameters. 
    16177   * 
    16278   * @return array An associative array of parameters. 
    16379   */ 
    164   public function & getAll($ns = null) 
    165   { 
    166     if (!$ns) 
    167     { 
    168       $ns = $this->default_namespace; 
    169     } 
    170  
    171     $parameters = array(); 
    172  
    173     if (isset($this->parameters[$ns])) 
    174     { 
    175       $parameters = $this->parameters[$ns]; 
    176     } 
    177  
    178     return $parameters; 
     80  public function & getAll() 
     81  { 
     82    return $this->parameters; 
    17983  } 
    18084 
     
    18387   * 
    18488   * @param string A parameter name. 
    185    * @param string A parameter namespace. 
    18689   * 
    18790   * @return bool true, if the parameter exists, otherwise false. 
    18891   */ 
    189   public function has($name, $ns = null) 
    190   { 
    191     if (!$ns) 
    192     { 
    193       $ns = $this->default_namespace; 
    194     } 
    195  
     92  public function has($name) 
     93  { 
    19694    if (false !== ($offset = strpos($name, '['))) 
    19795    { 
    198       if (isset($this->parameters[$ns][substr($name, 0, $offset)])) 
     96      if (isset($this->parameters[substr($name, 0, $offset)])) 
    19997      { 
    200         $array = $this->parameters[$ns][substr($name, 0, $offset)]; 
     98        $array = $this->parameters[substr($name, 0, $offset)]; 
    20199 
    202100        while ($pos = strpos($name, '[', $offset)) 
     
    219117      } 
    220118    } 
    221     elseif (isset($this->parameters[$ns][$name])) 
     119    elseif (isset($this->parameters[$name])) 
    222120    { 
    223121      return true; 
     
    228126 
    229127  /** 
    230    * Indicates whether or not A parameter namespace exists. 
    231    * 
    232    * @param string A parameter namespace. 
    233    * 
    234    * @return bool true, if the namespace exists, otherwise false. 
    235    */ 
    236   public function hasNamespace($ns) 
    237   { 
    238     return isset($this->parameters[$ns]); 
    239   } 
    240  
    241   /** 
    242128   * Remove a parameter. 
    243129   * 
    244130   * @param string A parameter name. 
    245    * @param string A parameter namespace. 
    246131   * 
    247132   * @return string A parameter value, if the parameter was removed, otherwise null. 
    248133   */ 
    249   public function remove($name, $ns = null) 
    250   { 
    251     if (!$ns) 
    252     { 
    253       $ns = $this->default_namespace; 
    254     } 
    255  
     134  public function remove($name) 
     135  { 
    256136    $retval = null; 
    257137 
    258     if (isset($this->parameters[$ns]) && array_key_exists($name, $this->parameters[$ns])) 
    259     { 
    260       $retval = $this->parameters[$ns][$name]; 
    261       unset($this->parameters[$ns][$name]); 
     138    if (array_key_exists($name, $this->parameters)) 
     139    { 
     140      $retval = $this->parameters[$name]; 
     141      unset($this->parameters[$name]); 
    262142    } 
    263143 
     
    266146 
    267147  /** 
    268    * Remove A parameter namespace and all of its associated parameters. 
    269    * 
    270    * @param string A parameter namespace. 
    271    * 
    272    * @return void 
    273    */ 
    274   public function & removeNamespace($ns = null) 
    275   { 
    276     if (!$ns) 
    277     { 
    278       $ns = $this->default_namespace; 
    279     } 
    280  
    281     $retval = null; 
    282  
    283     if (isset($this->parameters[$ns])) 
    284     { 
    285       $retval =& $this->parameters[$ns]; 
    286       unset($this->parameters[$ns]); 
    287     } 
    288  
    289     return $retval; 
    290   } 
    291  
    292   /** 
    293    * Set a parameter. 
     148   * Sets a parameter. 
    294149   * 
    295150   * If a parameter with the name already exists the value will be overridden. 
     
    297152   * @param string A parameter name. 
    298153   * @param mixed  A parameter value. 
    299    * @param string A parameter namespace. 
    300    * 
    301    * @return void 
    302    */ 
    303   public function set($name, $value, $ns = null) 
    304   { 
    305     if (!$ns) 
    306     { 
    307       $ns = $this->default_namespace; 
    308     } 
    309  
    310     if (!isset($this->parameters[$ns])) 
    311     { 
    312       $this->parameters[$ns] = array(); 
    313     } 
    314  
    315     $this->parameters[$ns][$name] = $value; 
    316   } 
    317  
    318   /** 
    319    * Set a parameter by reference. 
     154   */ 
     155  public function set($name, $value) 
     156  { 
     157    $this->parameters[$name] = $value; 
     158  } 
     159 
     160  /** 
     161   * Sets a parameter by reference. 
    320162   * 
    321163   * If a parameter with the name already exists the value will be overridden. 
     
    323165   * @param string A parameter name. 
    324166   * @param mixed  A reference to a parameter value. 
    325    * @param string A parameter namespace. 
    326    * 
    327    * @return void 
    328    */ 
    329   public function setByRef($name, & $value, $ns = null) 
    330   { 
    331     if (!$ns) 
    332     { 
    333       $ns = $this->default_namespace; 
    334     } 
    335  
    336     if (!isset($this->parameters[$ns])) 
    337     { 
    338       $this->parameters[$ns] = array(); 
    339     } 
    340  
    341     $this->parameters[$ns][$name] =& $value; 
    342   } 
    343  
    344   /** 
    345    * Set an array of parameters. 
     167   */ 
     168  public function setByRef($name, & $value) 
     169  { 
     170    $this->parameters[$name] =& $value; 
     171  } 
     172 
     173  /** 
     174   * Sets an array of parameters. 
    346175   * 
    347176   * If an existing parameter name matches any of the keys in the supplied 
     
    349178   * 
    350179   * @param array An associative array of parameters and their associated values. 
    351    * @param string A parameter namespace. 
    352    * 
    353    * @return void 
    354    */ 
    355   public function add($parameters, $ns = null) 
    356   { 
    357     if ($parameters === null) return; 
    358  
    359     if (!$ns) 
    360     { 
    361       $ns = $this->default_namespace; 
    362     } 
    363  
    364     if (!isset($this->parameters[$ns])) 
    365     { 
    366       $this->parameters[$ns] = array(); 
     180   */ 
     181  public function add($parameters) 
     182  { 
     183    if (is_null($parameters)) 
     184    { 
     185      return; 
    367186    } 
    368187 
    369188    foreach ($parameters as $key => $value) 
    370189    { 
    371       $this->parameters[$ns][$key] = $value; 
    372     } 
    373   } 
    374  
    375   /** 
    376    * Set an array of parameters by reference. 
     190      $this->parameters[$key] = $value; 
     191    } 
     192  } 
     193 
     194  /** 
     195   * Sets an array of parameters by reference. 
    377196   * 
    378197   * If an existing parameter name matches any of the keys in the supplied 
     
    380199   * 
    381200   * @param array An associative array of parameters and references to their associated values. 
    382    * @param string A parameter namespace. 
    383    * 
    384    * @return void 
    385    */ 
    386   public function addByRef(& $parameters, $ns = null) 
    387   { 
    388     if (!$ns) 
    389     { 
    390       $ns = $this->default_namespace; 
    391     } 
    392  
    393     if (!isset($this->parameters[$ns])) 
    394     { 
    395       $this->parameters[$ns] = array(); 
    396     } 
    397  
     201   */ 
     202  public function addByRef(& $parameters) 
     203  { 
    398204    foreach ($parameters as $key => &$value) 
    399205    { 
    400       $this->parameters[$ns][$key] =& $value; 
     206      $this->parameters[$key] =& $value; 
    401207    } 
    402208  } 
     
    409215  public function serialize() 
    410216  { 
    411     return serialize(array($this->default_namespace, $this->parameters)); 
     217    return serialize($this->parameters); 
    412218  } 
    413219 
     
    417223  public function unserialize($serialized) 
    418224  { 
    419     $data = unserialize($serialized); 
    420  
    421     $this->default_namespace = $data[0]; 
    422     $this->parameters = $data[1]; 
     225    $this->parameters = unserialize($serialized); 
    423226  } 
    424227} 
  • trunk/lib/validator/sfValidator.class.php

    r4957 r5016  
    8888   * @param string Parameter name 
    8989   * @param mixed A default parameter value 
    90    * @param string A parameter namespace 
    9190   * 
    9291   * @return mixed A parameter value 
    9392   */ 
    94   public function getParameter($name, $default = null, $ns = null
     93  public function getParameter($name, $default = null
    9594  { 
    96     return $this->parameterHolder->get($name, $default, $ns); 
     95    return $this->parameterHolder->get($name, $default); 
    9796  } 
    9897 
     
    101100   * 
    102101   * @param string A parameter name 
    103    * @param string A parameter namespace 
    104102   * 
    105103   * @return boolean true, if parameter exists, otherwise false 
    106104   */ 
    107   public function hasParameter($name, $ns = null
     105  public function hasParameter($name
    108106  { 
    109     return $this->parameterHolder->has($name, $ns); 
     107    return $this->parameterHolder->has($name); 
    110108  } 
    111109 
     
    115113   * @param string A parameter name 
    116114   * @param mixed A parameter value 
    117    * @param string A parameter namespace 
    118115   */ 
    119   public function setParameter($name, $value, $ns = null
     116  public function setParameter($name, $value
    120117  { 
    121     $this->parameterHolder->set($name, $value, $ns); 
     118    $this->parameterHolder->set($name, $value); 
    122119  } 
    123120} 
  • trunk/lib/view/sfView.class.php

    r4957 r5016  
    210210   * @param string Name of the attribute 
    211211   * @param string Value of the attribute 
    212    * @param string The current namespace 
    213212   * 
    214213   * @return mixed Attribute 
    215214   */ 
    216   public function getAttribute($name, $default = null, $ns = null
    217   { 
    218     return $this->attributeHolder->get($name, $default, $ns); 
     215  public function getAttribute($name, $default = null
     216  { 
     217    return $this->attributeHolder->get($name, $default); 
    219218  } 
    220219 
     
    223222   * 
    224223   * @param string Name of the attribute 
    225    * @param string Namespace for the current view 
    226224   * 
    227225   * @return mixed Attribute of the view 
    228226   */ 
    229   public function hasAttribute($name, $ns = null
    230   { 
    231     return $this->attributeHolder->has($name, $ns); 
     227  public function hasAttribute($name
     228  { 
     229    return $this->attributeHolder->has($name); 
    232230  } 
    233231 
     
    237235   * @param string Attribute name 
    238236   * @param string Value for the attribute 
    239    * @param string Namespace for the current 
    240    */ 
    241   public function setAttribute($name, $value, $ns = null) 
    242   { 
    243     $this->attributeHolder->set($name, $value, $ns); 
     237   */ 
     238  public function setAttribute($name, $value) 
     239  { 
     240    $this->attributeHolder->set($name, $value); 
    244241  } 
    245242 
     
    259256   * @param string Parameter name 
    260257   * @param string Default parameter value 
    261    * @param string Namespace for the current view 
    262258   * 
    263259   * @return mixed A parameter value 
    264260   */ 
    265   public function getParameter($name, $default = null, $ns = null
    266   { 
    267     return $this->parameterHolder->get($name, $default, $ns); 
     261  public function getParameter($name, $default = null
     262  { 
     263    return $this->parameterHolder->get($name, $default); 
    268264  } 
    269265 
     
    272268   * 
    273269   * @param string Name of the paramater 
    274    * @param string Namespace for the current view 
    275270   * 
    276271   * @return boolean true, if the parameter exists otherwise false 
    277272   */ 
    278   public function hasParameter($name, $ns = null
    279   { 
    280     return $this->parameterHolder->has($name, $ns); 
     273  public function hasParameter($name
     274  { 
     275    return $this->parameterHolder->has($name); 
    281276  } 
    282277 
     
    286281   * @param string Name of the parameter 
    287282   * @param string The parameter value 
    288    * @param string Namespace for the current view 
    289    */ 
    290   public function setParameter($name, $value, $ns = null) 
    291   { 
    292     $this->parameterHolder->set($name, $value, $ns); 
     283   */ 
     284  public function setParameter($name, $value) 
     285  { 
     286    $this->parameterHolder->set($name, $value); 
    293287  } 
    294288 
  • trunk/lib/view/sfViewCacheManager.class.php

    r4961 r5016  
    358358  { 
    359359    // ignore cache parameter? (only available in debug mode) 
    360     if (sfConfig::get('sf_debug') && $this->context->getRequest()->getParameter('_sf_ignore_cache', false, 'symfony/request/sfWebRequest') == true
     360    if (sfConfig::get('sf_debug') && $this->context->getRequest()->getAttribute('_sf_ignore_cache')
    361361    { 
    362362      if (sfConfig::get('sf_logging_enabled')) 
  • trunk/lib/view/sfViewParameterHolder.class.php

    r4934 r5016  
    8686    $tmp->context = null; 
    8787 
    88     return serialize(array($tmp->default_namespace, $tmp->parameters)); 
     88    return serialize($tmp->parameters); 
    8989  } 
    9090 
  • trunk/test/bootstrap/unit.php

    r4840 r5016  
    2121$autoload->register(); 
    2222 
     23sfConfig::set('sf_test_cache_dir', sfToolkit::getTmpDir()); 
     24 
    2325class sfException extends Exception 
    2426{ 
  • trunk/test/unit/database/sfDatabaseTest.php

    r4440 r5016  
    1212require_once($_test_dir.'/unit/sfContextMock.class.php'); 
    1313 
    14 $t = new lime_test(13, new lime_output_color()); 
     14$t = new lime_test(10, new lime_output_color()); 
    1515 
    1616class myDatabase extends sfDatabase 
  • trunk/test/unit/filter/sfFilterTest.php

    r4440 r5016  
    1212require_once($_test_dir.'/unit/sfContextMock.class.php'); 
    1313 
    14 $t = new lime_test(20, new lime_output_color()); 
     14$t = new lime_test(17, new lime_output_color()); 
    1515 
    1616class myFilter extends sfFilter 
     
    2323 
    2424$context = sfContext::getInstance(); 
    25 $filter = new myFilter(); 
     25$filter = new myFilter($context); 
    2626 
    2727// ->initialize() 
    2828$t->diag('->initialize()'); 
    29 $filter = new myFilter(); 
    30 $t->is($filter->getContext(), null, '->initialize() takes a sfContext object as its first argument'); 
     29$filter = new myFilter($context); 
     30$t->is($filter->getContext(), $context, '->initialize() takes a sfContext object as its first argument'); 
    3131$filter->initialize($context, array('foo' => 'bar')); 
    3232$t->is($filter->getParameter('foo'), 'bar', '->initialize() takes an array of parameters as its second argument'); 
     
    4343$t->is($filter->isFirstCall('beforeExecution'), false, '->isFirstCall() returns false if this is not the first call with this argument'); 
    4444 
    45 $filter = new myFilter(); 
     45$filter = new myFilter($context); 
    4646$filter->initialize($context); 
    4747$t->is($filter->isFirstCall('beforeExecution'), false, '->isFirstCall() returns false if this is not the first call with this argument'); 
  • trunk/test/unit/request/sfRequestTest.php

    r4957 r5016  
    2323} 
    2424 
    25 $t = new lime_test(50, new lime_output_color()); 
     25$t = new lime_test(44, new lime_output_color()); 
    2626 
    2727$dispatcher = new sfEventDispatcher(); 
  • trunk/test/unit/response/sfResponseTest.php

    r4957 r5016  
    2121} 
    2222 
    23 $t = new lime_test(20, new lime_output_color()); 
     23$t = new lime_test(17, new lime_output_color()); 
    2424 
    2525$dispatcher = new sfEventDispatcher(); 
  • trunk/test/unit/response/sfWebResponseTest.php

    r4957 r5016  
    169169 
    170170$response2->mergeProperties($response1); 
    171 $t->is($response1->getHttpHeader('symfony'), $response2->getHttpHeader('symfony'), '->mergerProperties() merges http headers'); 
    172 $t->is($response1->getContentType(), $response2->getContentType(), '->mergerProperties() merges content type'); 
    173 $t->is($response1->getTitle(), $response2->getTitle(), '->mergerProperties() merges titles'); 
     171$t->is($response1->getHttpHeader('symfony'), $response2->getHttpHeader('symfony'), '->mergeProperties() merges http headers'); 
     172$t->is($response1->getContentType(), $response2->getContentType(), '->mergeProperties() merges content type'); 
     173$t->is($response1->getTitle(), $response2->getTitle(), '->mergeProperties() merges titles'); 
    174174 
    175175// ->addStylesheet() 
     
    177177$response = new myWebResponse($dispatcher); 
    178178$response->addStylesheet('test'); 
    179 $t->ok($response->getParameterHolder()->has('test', 'helper/asset/auto/stylesheet'), '->addStylesheet() adds a new stylesheet for the response'); 
     179$t->ok(array_key_exists('test', $response->getStylesheets()), '->addStylesheet() adds a new stylesheet for the response'); 
    180180$response->addStylesheet('foo', ''); 
    181 $t->ok($response->getParameterHolder()->has('foo', 'helper/asset/auto/stylesheet'), '->addStylesheet() adds a new stylesheet for the response'); 
     181$t->ok(array_key_exists('foo', $response->getStylesheets()), '->addStylesheet() adds a new stylesheet for the response'); 
    182182$response->addStylesheet('first', 'first'); 
    183 $t->ok($response->getParameterHolder()->has('first', 'helper/asset/auto/stylesheet/first'), '->addStylesheet() takes a position as its second argument'); 
     183$t->ok(array_key_exists('first', $response->getStylesheets('first')), '->addStylesheet() takes a position as its second argument'); 
    184184$response->addStylesheet('last', 'last'); 
    185 $t->ok($response->getParameterHolder()->has('last', 'helper/asset/auto/stylesheet/last'), '->addStylesheet() takes a position as its second argument'); 
     185$t->ok(array_key_exists('last', $response->getStylesheets('last')), '->addStylesheet() takes a position as its second argument'); 
    186186$response->addStylesheet('bar', '', array('media' => 'print')); 
    187 $t->is($response->getParameterHolder()->get('bar', null, 'helper/asset/auto/stylesheet'), array('media' => 'print'), '->addStylesheet() takes an array of parameters as its third argument'); 
     187$stylesheets = $response->getStylesheets(); 
     188$t->is($stylesheets['bar'], array('media' => 'print'), '->addStylesheet() takes an array of parameters as its third argument'); 
    188189 
    189190// ->getStylesheets() 
     
    197198$response = new myWebResponse($dispatcher); 
    198199$response->addJavascript('test'); 
    199 $t->ok($response->getParameterHolder()->has('test', 'helper/asset/auto/javascript'), '->addJavascript() adds a new javascript for the response'); 
     200$t->ok(array_key_exists('test', $response->getJavascripts()), '->addJavascript() adds a new javascript for the response'); 
    200201$response->addJavascript('foo', '', array('raw_name' => true)); 
    201 $t->ok($response->getParameterHolder()->has('foo', 'helper/asset/auto/javascript'), '->addJavascript() adds a new javascript for the response'); 
     202$t->ok(array_key_exists('foo', $response->getJavascripts()), '->addJavascript() adds a new javascript for the response'); 
    202203$response->addJavascript('first_js', 'first'); 
    203 $t->ok($response->getParameterHolder()->has('first_js', 'helper/asset/auto/javascript/first'), '->addJavascript() takes a position as its second argument'); 
     204$t->ok(array_key_exists('first_js', $response->getJavascripts('first')), '->addJavascript() takes a position as its second argument'); 
    204205$response->addJavascript('last_js', 'last'); 
    205 $t->ok($response->getParameterHolder()->has('last_js', 'helper/asset/auto/javascript/last'), '->addJavascript() takes a position as its second argument'); 
     206$t->ok(array_key_exists('last_js', $response->getJavascripts('last')), '->addJavascript() takes a position as its second argument'); 
    206207 
    207208// ->getJavascripts() 
  • trunk/test/unit/sfParameterHolderTest.class.php

    r2111 r5016  
    3030    $t->diag(ucfirst($methodName).' holder proxy'); 
    3131 
    32     $t->isa_ok($object->$holderMethod(), 'sfParameterHolder', "->$holderMethod() returns a parameter holder instance"); 
     32    $namespaced = $object->$holderMethod() instanceof sfNamespacedParameterHolder ? true : false; 
     33 
     34    $t->isa_ok($object->$holderMethod(), $namespaced ? 'sfNamespacedParameterHolder' : 'sfParameterHolder', "->$holderMethod() returns a parameter holder instance"); 
    3335    $t->is($object->$hasMethod('foo'), false, "->$hasMethod() returns false if the $methodName does not exist"); 
    3436    $t->is($object->$getMethod('foo', 'default'), 'default', "->$getMethod() returns the default value if $methodName does not exist"); 
     
    3941    $t->is($object->$getMethod('foo'), $object->$holderMethod()->get('foo'), "->$getMethod() is a proxy method"); 
    4042    $t->is($object->$getMethod('foo', 'default'), 'bar', "->$getMethod() does not return the default value if the $methodName exists"); 
    41     $object->$setMethod('foo1', 'bar1', 'mynamespace'); 
    42     $t->is($object->$hasMethod('foo1'), false, "->$hasMethod() takes a namespace as its second parameter"); 
    43     $t->is($object->$hasMethod('foo1', 'mynamespace'), true, "->$hasMethod() takes a namespace as its second parameter"); 
    44     $t->is($object->$getMethod('foo1', 'default', 'mynamespace'), 'bar1', "->$getMethod() takes a namespace as its third parameter"); 
     43 
     44    if ($namespaced) 
     45    { 
     46      $object->$setMethod('foo1', 'bar1', 'mynamespace'); 
     47      $t->is($object->$hasMethod('foo1'), false, "->$hasMethod() takes a namespace as its second parameter"); 
     48      $t->is($object->$hasMethod('foo1', 'mynamespace'), true, "->$hasMethod() takes a namespace as its second parameter"); 
     49      $t->is($object->$getMethod('foo1', 'default', 'mynamespace'), 'bar1', "->$getMethod() takes a namespace as its third parameter"); 
     50    } 
     51 
    4552    $object->$setMethod('foo2', 'bar2'); 
    4653    $object->$holderMethod()->set('foo3', 'bar3'); 
  • trunk/test/unit/storage/sfStorageTest.php

    r4957 r5016  
    1111require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 
    1212 
    13 $t = new lime_test(14, new lime_output_color()); 
     13$t = new lime_test(11, new lime_output_color()); 
    1414 
    1515class myStorage extends sfStorage 
  • trunk/test/unit/user/sfUserTest.php

    r4957 r5016  
    1111require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 
    1212 
    13 $t = new lime_test(39, new lime_output_color()); 
     13$t = new lime_test(36, new lime_output_color()); 
    1414 
    1515$_SERVER['session_id'] = 'test'; 
    16 sfConfig::set('sf_test_cache_dir', sfToolkit::getTmpDir()); 
     16sfToolkit::clearDirectory(sfConfig::get('sf_test_cache_dir').'/sessions'); 
    1717 
    1818$dispatcher = new sfEventDispatcher(); 
  • trunk/test/unit/util/sfNamespacedParameterHolderTest.php

    r4645 r5016  
    1515// ->clear() 
    1616$t->diag('->clear()'); 
    17 $ph = new sfParameterHolder(); 
     17$ph = new sfNamespacedParameterHolder(); 
    1818$ph->clear(); 
    1919$t->is($ph->getAll(), null, '->clear() clears all parameters'); 
     
    2525// ->get() 
    2626$t->diag('->get()'); 
    27 $ph = new sfParameterHolder(); 
     27$ph = new sfNamespacedParameterHolder(); 
    2828$ph->set('foo', 'bar'); 
    2929$t->is($ph->get('foo'), 'bar', '->get() returns the parameter value for the given key'); 
    3030$t->is($ph->get('bar'), null, '->get() returns null if the key does not exist'); 
    3131 
    32 $ph = new sfParameterHolder(); 
     32$ph = new sfNamespacedParameterHolder(); 
    3333$t->is('default_value', $ph->get('foo1', 'default_value'), '->get() takes the default value as its second argument'); 
    3434 
    35 $ph = new sfParameterHolder(); 
     35$ph = new sfNamespacedParameterHolder(); 
    3636$ph->set('myfoo', 'bar', 'symfony/mynamespace'); 
    3737$t->is('bar', $ph->get('myfoo', null, 'symfony/mynamespace'), '->get() takes an optional namespace as its third argument'); 
    3838$t->is(null, $ph->get('myfoo'), '->get() can have the same key for several namespaces'); 
    3939 
    40 $ph = new sfParameterHolder(); 
     40$ph = new sfNamespacedParameterHolder(); 
    4141$ph->add(array('foo' => array( 
    4242  'bar' => array( 
     
    5353// ->getNames() 
    5454$t->diag('->getNames()'); 
    55 $ph = new sfParameterHolder(); 
     55$ph = new sfNamespacedParameterHolder(); 
    5656$ph->set('foo', 'bar'); 
    5757$ph->set('yourfoo', 'bar'); 
     
    6363// ->getNamespaces() 
    6464$t->diag('->getNamespaces()'); 
    65 $ph = new sfParameterHolder(); 
     65$ph = new sfNamespacedParameterHolder(); 
    6666$ph->set('foo', 'bar'); 
    6767$ph->set('yourfoo', 'bar'); 
     
    7272// ->setDefaultNamespace() 
    7373$t->diag('->setDefaultNamespace()'); 
    74 $ph = new sfParameterHolder('symfony/mynamespace'); 
     74$ph = new sfNamespacedParameterHolder('symfony/mynamespace'); 
    7575$ph->setDefaultNamespace('othernamespace'); 
    7676 
     
    9292$t->diag('->getAll()'); 
    9393$parameters = array('foo' => 'bar', 'myfoo' => 'bar'); 
    94 $ph = new sfParameterHolder(); 
     94$ph = new sfNamespacedParameterHolder(); 
    9595$ph->add($parameters); 
    9696$ph->set('myfoo', 'bar', 'symfony/mynamespace'); 
     
    9999// ->has() 
    100100$t->diag('->has()'); 
    101 $ph = new sfParameterHolder(); 
     101$ph = new sfNamespacedParameterHolder(); 
    102102$ph->set('foo', 'bar'); 
    103103$ph->set('myfoo', 'bar', 'symfony/mynamespace'); 
     
    107107$t->is($ph->has('myfoo', 'symfony/mynamespace'), true, '->has() returns true if the key exists in the namespace given as its second argument'); 
    108108 
    109 $ph = new sfParameterHolder(); 
     109$ph = new sfNamespacedParameterHolder(); 
    110110$ph->add(array('foo' => array( 
    111111  'bar' => array( 
     
    122122// ->hasNamespace() 
    123123$t->diag('->hasNamespace()'); 
    124 $ph = new sfParameterHolder(); 
     124$ph = new sfNamespacedParameterHolder(); 
    125125$ph->set('foo', 'bar'); 
    126126$ph->set('myfoo', 'bar', 'symfony/mynamespace'); 
     
    131131// ->remove() 
    132132$t->diag('->remove()'); 
    133 $ph = new sfParameterHolder(); 
     133$ph = new sfNamespacedParameterHolder(); 
    134134$ph->set('foo', 'bar'); 
    135135$ph->set('myfoo', 'bar'); 
     
    150150// ->removeNamespace() 
    151151$t->diag('->removeNamespace()'); 
    152 $ph = new sfParameterHolder(); 
     152$ph = new sfNamespacedParameterHolder(); 
    153153$ph->set('foo', 'bar'); 
    154154$ph->set('myfoo', 'bar'); 
     
    178178$foo = 'bar'; 
    179179 
    180 $ph = new sfParameterHolder(); 
     180$ph = new sfNamespacedParameterHolder(); 
    181181$ph->set('foo', $foo); 
    182182$t->is($ph->get('foo'), $foo, '->set() sets the value for a key'); 
     
    192192$foo = 'bar'; 
    193193 
    194 $ph = new sfParameterHolder(); 
     194$ph = new sfNamespacedParameterHolder(); 
    195195$ph->setByRef('foo', $foo); 
    196196$t->is($ph->get('foo'), $foo, '->setByRef() sets the value for a key'); 
     
    209209$myparameters = array('myfoo' => 'bar', 'mybar' => 'bar'); 
    210210 
    211 $ph = new sfParameterHolder(); 
     211$ph = new sfNamespacedParameterHolder(); 
    212212$ph->add($parameters); 
    213213$ph->add($myparameters, 'symfony/mynamespace'); 
     
    225225$myparameters = array('myfoo' => 'bar', 'mybar' => 'bar'); 
    226226 
    227 $ph = new sfParameterHolder(); 
     227$ph = new sfNamespacedParameterHolder(); 
    228228$ph->addByRef($parameters); 
    229229$ph->addByRef($myparameters, 'symfony/mynamespace'); 
     
    237237// ->serialize() ->unserialize() 
    238238$t->diag('->serialize() ->unserialize()'); 
    239 $t->ok($ph == unserialize(serialize($ph)), 'sfParameterHolder implements the Serializable interface'); 
     239$t->ok($ph == unserialize(serialize($ph)), 'sfNamespacedParameterHolder implements the Serializable interface'); 
  • trunk/test/unit/validator/sfValidatorTest.php

    r4440 r5016  
    1212require_once($_test_dir.'/unit/sfContextMock.class.php'); 
    1313 
    14 $t = new lime_test(14, new lime_output_color()); 
     14$t = new lime_test(11, new lime_output_color()); 
    1515 
    1616class myValidator extends sfValidator 
  • trunk/test/unit/view/sfViewTest.php

    r4957 r5016  
    1212require_once($_test_dir.'/unit/sfContextMock.class.php'); 
    1313 
    14 $t = new lime_test(17, new lime_output_color()); 
     14$t = new lime_test(14, new lime_output_color()); 
    1515 
    1616class myView extends sfView 

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting, and supporting several large Open-Source projects.