Changeset 5016
- Timestamp:
- 09/09/07 17:11:05 (2 years ago)
- Files:
-
- trunk/lib/addon/sfPager.class.php (modified) (1 diff)
- trunk/lib/cache/sfCache.class.php (modified) (1 diff)
- trunk/lib/database/sfDatabase.class.php (modified) (5 diffs)
- trunk/lib/debug/sfDebug.class.php (modified) (1 diff)
- trunk/lib/event/sfEvent.class.php (modified) (1 diff)
- trunk/lib/filter/sfFilter.class.php (modified) (5 diffs)
- trunk/lib/request/sfRequest.class.php (modified) (6 diffs)
- trunk/lib/request/sfWebRequest.class.php (modified) (2 diffs)
- trunk/lib/response/sfResponse.class.php (modified) (4 diffs)
- trunk/lib/response/sfWebResponse.class.php (modified) (24 diffs)
- trunk/lib/storage/sfStorage.class.php (modified) (4 diffs)
- trunk/lib/user/sfUser.class.php (modified) (2 diffs)
- trunk/lib/util/sfNamespacedParameterHolder.class.php (added)
- trunk/lib/util/sfParameterHolder.class.php (modified) (13 diffs)
- trunk/lib/validator/sfValidator.class.php (modified) (3 diffs)
- trunk/lib/view/sfView.class.php (modified) (6 diffs)
- trunk/lib/view/sfViewCacheManager.class.php (modified) (1 diff)
- trunk/lib/view/sfViewParameterHolder.class.php (modified) (1 diff)
- trunk/test/bootstrap/unit.php (modified) (1 diff)
- trunk/test/unit/database/sfDatabaseTest.php (modified) (1 diff)
- trunk/test/unit/filter/sfFilterTest.php (modified) (3 diffs)
- trunk/test/unit/request/sfRequestTest.php (modified) (1 diff)
- trunk/test/unit/response/sfResponseTest.php (modified) (1 diff)
- trunk/test/unit/response/sfWebResponseTest.php (modified) (3 diffs)
- trunk/test/unit/sfParameterHolderTest.class.php (modified) (2 diffs)
- trunk/test/unit/storage/sfStorageTest.php (modified) (1 diff)
- trunk/test/unit/user/sfUserTest.php (modified) (1 diff)
- trunk/test/unit/util/sfNamespacedParameterHolderTest.php (moved) (moved from trunk/test/unit/util/sfParameterHolderTest.php) (16 diffs)
- trunk/test/unit/validator/sfValidatorTest.php (modified) (1 diff)
- trunk/test/unit/view/sfViewTest.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/addon/sfPager.class.php
r4659 r5016 281 281 } 282 282 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); 296 296 } 297 297 } trunk/lib/cache/sfCache.class.php
r4957 r5016 200 200 } 201 201 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); 215 215 } 216 216 trunk/lib/database/sfDatabase.class.php
r4957 r5016 115 115 * @param string The key name 116 116 * @param string The default value 117 * @param string The namespace to use118 117 * 119 118 * @return string The value associated with the key … … 121 120 * @see sfParameterHolder 122 121 */ 123 public function getParameter($name, $default = null , $ns = null)122 public function getParameter($name, $default = null) 124 123 { 125 return $this->parameterHolder->get($name, $default , $ns);124 return $this->parameterHolder->get($name, $default); 126 125 } 127 126 … … 134 133 * 135 134 * @param string The key name 136 * @param string The namespace to use137 135 * 138 136 * @return boolean true if the given key exists, false otherwise … … 140 138 * @see sfParameterHolder 141 139 */ 142 public function hasParameter($name , $ns = null)140 public function hasParameter($name) 143 141 { 144 return $this->parameterHolder->has($name , $ns);142 return $this->parameterHolder->has($name); 145 143 } 146 144 … … 154 152 * @param string The key name 155 153 * @param string The value 156 * @param string The namespace to use157 154 * 158 155 * @see sfParameterHolder 159 156 */ 160 public function setParameter($name, $value , $ns = null)157 public function setParameter($name, $value) 161 158 { 162 $this->parameterHolder->set($name, $value , $ns);159 $this->parameterHolder->set($name, $value); 163 160 } 164 161 trunk/lib/debug/sfDebug.class.php
r3786 r5016 152 152 { 153 153 $values = array(); 154 foreach ($parameterHolder->getNamespaces() as $ns)154 if ($parameterHolder instanceof sfNamespacedParameterHolder) 155 155 { 156 $values[$ns] = array(); 157 foreach ($parameterHolder->getAll($ns) as $key => $value) 156 foreach ($parameterHolder->getNamespaces() as $ns) 158 157 { 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]); 160 164 } 161 ksort($values[$ns]); 165 } 166 else 167 { 168 foreach ($parameterHolder->getAll() as $key => $value) 169 { 170 $values[$key] = $value; 171 } 162 172 } 163 173 trunk/lib/event/sfEvent.class.php
r5015 r5016 107 107 } 108 108 109 public function getParameter($name, $default = null , $ns = null)109 public function getParameter($name, $default = null) 110 110 { 111 return $this->parameterHolder->get($name, $default , $ns);111 return $this->parameterHolder->get($name, $default); 112 112 } 113 113 114 public function hasParameter($name , $ns = null)114 public function hasParameter($name) 115 115 { 116 return $this->parameterHolder->has($name , $ns);116 return $this->parameterHolder->has($name); 117 117 } 118 118 119 public function setParameter($name, $value , $ns = null)119 public function setParameter($name, $value) 120 120 { 121 return $this->parameterHolder->set($name, $value , $ns);121 return $this->parameterHolder->set($name, $value); 122 122 } 123 123 } trunk/lib/filter/sfFilter.class.php
r4957 r5016 107 107 * @param string The key name 108 108 * @param string The default value 109 * @param string The namespace to use110 109 * 111 110 * @return string The value associated with the key … … 113 112 * @see sfParameterHolder 114 113 */ 115 public function getParameter($name, $default = null , $ns = null)114 public function getParameter($name, $default = null) 116 115 { 117 return $this->parameterHolder->get($name, $default , $ns);116 return $this->parameterHolder->get($name, $default); 118 117 } 119 118 … … 126 125 * 127 126 * @param string The key name 128 * @param string The namespace to use129 127 * 130 128 * @return boolean true if the given key exists, false otherwise … … 132 130 * @see sfParameterHolder 133 131 */ 134 public function hasParameter($name , $ns = null)132 public function hasParameter($name) 135 133 { 136 return $this->parameterHolder->has($name , $ns);134 return $this->parameterHolder->has($name); 137 135 } 138 136 … … 146 144 * @param string The key name 147 145 * @param string The value 148 * @param string The namespace to use149 146 * 150 147 * @see sfParameterHolder 151 148 */ 152 public function setParameter($name, $value , $ns = null)149 public function setParameter($name, $value) 153 150 { 154 return $this->parameterHolder->set($name, $value , $ns);151 return $this->parameterHolder->set($name, $value); 155 152 } 156 153 } trunk/lib/request/sfRequest.class.php
r4957 r5016 297 297 * @param string Attribute name 298 298 * @param string Default attribute value 299 * @param string Namespace for the current request300 299 * 301 300 * @return mixed An attribute value 302 301 */ 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); 306 305 } 307 306 … … 310 309 * 311 310 * @param string Attribute name 312 * @param string Namespace for the current request313 311 * 314 312 * @return boolean true, if the attribute exists otherwise false 315 313 */ 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); 319 317 } 320 318 … … 324 322 * @param string Attribute name 325 323 * @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); 332 329 } 333 330 … … 337 334 * @param string Parameter name 338 335 * @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); 345 341 } 346 342 … … 349 345 * 350 346 * @param string Parameter name 351 * @param string Namespace for the current request352 347 * 353 348 * @return boolean true, if the paramater exists otherwise false 354 349 */ 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); 358 353 } 359 354 … … 363 358 * @param string Parameter name 364 359 * @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); 371 365 } 372 366 trunk/lib/request/sfWebRequest.class.php
r4951 r5016 823 823 $this->parameterHolder->add($this->postParameters); 824 824 825 // move symfony parameters in a protected namespace(parameters prefixed with _sf_)825 // move symfony parameters to attributes (parameters prefixed with _sf_) 826 826 foreach ($this->parameterHolder->getAll() as $key => $value) 827 827 { … … 829 829 { 830 830 $this->parameterHolder->remove($key); 831 $this->set Parameter($key, $value, 'symfony/request/sfWebRequest');831 $this->setAttribute($key, $value); 832 832 } 833 833 } trunk/lib/response/sfResponse.class.php
r4957 r5016 39 39 * 40 40 * @param sfEventDispatcher A sfEventDispatcher instance 41 * @param array An array of parameters41 * @param array An array of parameters 42 42 * 43 * @return Boolean true, if initialization completes successfully, otherwise false43 * @return Boolean true, if initialization completes successfully, otherwise false 44 44 * 45 45 * @throws <b>sfInitializationException</b> If an error occurs while initializing this sfResponse … … 101 101 * @param string A parameter name 102 102 * @param string A default paramter value 103 * @param string Namespace for the current response104 103 * 105 104 * @return mixed A parameter value 106 105 */ 107 public function getParameter($name, $default = null , $ns = null)106 public function getParameter($name, $default = null) 108 107 { 109 return $this->parameterHolder->get($name, $default , $ns);108 return $this->parameterHolder->get($name, $default); 110 109 } 111 110 … … 114 113 * 115 114 * @param string A parameter name 116 * @param string Namespace for the current response117 115 * 118 116 * @return boolean true, if the parameter exists otherwise false 119 117 */ 120 public function hasParameter($name , $ns = null)118 public function hasParameter($name) 121 119 { 122 return $this->parameterHolder->has($name , $ns);120 return $this->parameterHolder->has($name); 123 121 } 124 122 … … 128 126 * @param string A parameter name 129 127 * @param string The parameter value to be set 130 * @param string Namespace for the current response131 128 */ 132 public function setParameter($name, $value , $ns = null)129 public function setParameter($name, $value) 133 130 { 134 $this->parameterHolder->set($name, $value , $ns);131 $this->parameterHolder->set($name, $value); 135 132 } 136 133 trunk/lib/response/sfWebResponse.class.php
r4951 r5016 26 26 $statusText = 'OK', 27 27 $statusTexts = array(), 28 $headerOnly = false; 28 $headerOnly = false, 29 $headers = array(), 30 $metas = array(), 31 $httpMetas = array(), 32 $stylesheets = array(), 33 $javascripts = array(); 29 34 30 35 /** … … 32 37 * 33 38 * @param sfEventDispatcher A sfEventDispatcher instance 34 * @param array An array of parameters35 * 36 * @return Boolean true, if initialization completes successfully, otherwise false39 * @param array An array of parameters 40 * 41 * @return Boolean true, if initialization completes successfully, otherwise false 37 42 * 38 43 * @throws <b>sfInitializationException</b> If an error occurs while initializing this sfResponse … … 188 193 if (is_null($value)) 189 194 { 190 $this->getParameterHolder()->remove($name, 'symfony/response/http/headers');195 unset($this->headers[$name]); 191 196 192 197 return; … … 205 210 if (!$replace) 206 211 { 207 $current = $this->getParameter($name, '', 'symfony/response/http/headers');212 $current = isset($this->headers[$name]) ? $this->headers[$name] : ''; 208 213 $value = ($current ? $current.', ' : '').$value; 209 214 } 210 215 211 $this-> setParameter($name, $value, 'symfony/response/http/headers');216 $this->headers[$name] = $value; 212 217 } 213 218 … … 219 224 public function getHttpHeader($name, $default = null) 220 225 { 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; 222 229 } 223 230 … … 229 236 public function hasHttpHeader($name) 230 237 { 231 return $this->hasParameter($this->normalizeHeaderName($name), 'symfony/response/http/headers');238 return array_key_exists($this->normalizeHeaderName($name), $this->headers); 232 239 } 233 240 … … 246 253 } 247 254 248 $this-> setParameter('Content-Type', $value, 'symfony/response/http/headers');255 $this->headers['Content-Type'] = $value; 249 256 } 250 257 … … 275 282 276 283 // headers 277 foreach ($this-> getParameterHolder()->getAll('symfony/response/http/headers')as $name => $value)284 foreach ($this->headers as $name => $value) 278 285 { 279 286 header($name.': '.$value); … … 425 432 public function getHttpMetas() 426 433 { 427 return $this-> getParameterHolder()->getAll('helper/asset/auto/httpmeta');434 return $this->httpMetas; 428 435 } 429 436 … … 444 451 if (is_null($value)) 445 452 { 446 $this->getParameterHolder()->remove($key, 'helper/asset/auto/httpmeta');453 unset($this->httpMetas[$key]); 447 454 448 455 return; … … 456 463 if (!$replace) 457 464 { 458 $current = $this->getParameter($key, '', 'helper/asset/auto/httpmeta');465 $current = isset($this->httpMetas[$key]) ? $this->httpMetas[$key] : ''; 459 466 $value = ($current ? $current.', ' : '').$value; 460 467 } 461 468 462 $this-> setParameter($key, $value, 'helper/asset/auto/httpmeta');469 $this->httpMetas[$key] = $value; 463 470 } 464 471 … … 470 477 public function getMetas() 471 478 { 472 return $this-> getParameterHolder()->getAll('helper/asset/auto/meta');479 return $this->metas; 473 480 } 474 481 … … 487 494 if (is_null($value)) 488 495 { 489 $this->getParameterHolder()->remove($key, 'helper/asset/auto/meta');496 unset($this->metas[$key]); 490 497 491 498 return; … … 499 506 } 500 507 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; 504 512 } 505 513 } … … 512 520 public function getTitle() 513 521 { 514 return $this->getParameter('title', '', 'helper/asset/auto/meta');522 return isset($this->metas['title']) ? $this->metas['title'] : ''; 515 523 } 516 524 … … 529 537 * Retrieves stylesheets for the current web response. 530 538 * 531 * @param string Direcotry delimiter539 * @param string Position 532 540 * 533 541 * @return string Stylesheets … … 535 543 public function getStylesheets($position = '') 536 544 { 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(); 538 551 } 539 552 … … 542 555 * 543 556 * @param string Stylesheet 544 * @param string Direcotry delimiter557 * @param string Position 545 558 * @param string Stylesheet options 546 559 */ 547 560 public function addStylesheet($css, $position = '', $options = array()) 548 561 { 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; 550 568 } 551 569 … … 559 577 public function getJavascripts($position = '') 560 578 { 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(); 562 585 } 563 586 … … 571 594 public function addJavascript($js, $position = '', $options = array()) 572 595 { 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; 574 602 } 575 603 … … 597 625 public function getHttpHeaders() 598 626 { 599 return $this-> getParameterHolder()->getAll('symfony/response/http/headers');627 return $this->headers; 600 628 } 601 629 … … 605 633 public function clearHttpHeaders() 606 634 { 607 $this-> getParameterHolder()->removeNamespace('symfony/response/http/headers');608 } 609 610 /** 611 * Copies a propertie to a newone.612 * 613 * @param sf ResponseResponse instance614 */ 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) 616 644 { 617 645 $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'); 618 651 } 619 652 … … 625 658 public function serialize() 626 659 { 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)); 628 661 } 629 662 … … 637 670 $this->initialize(sfContext::hasInstance() ? sfContext::getInstance()->getEventDispatcher() : new sfEventDispatcher()); 638 671 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; 645 673 } 646 674 trunk/lib/storage/sfStorage.class.php
r4961 r5016 51 51 { 52 52 $this->parameterHolder = new sfParameterHolder(); 53 $this-> getParameterHolder()->add($parameters);53 $this->parameterHolder->add($parameters); 54 54 } 55 55 … … 114 114 * @param string Parameter name 115 115 * @param mixed A default parameter 116 * @param string Namespace for the current storage117 116 * 118 117 * @return mixed A parameter value 119 118 */ 120 public function getParameter($name, $default = null , $ns = null)119 public function getParameter($name, $default = null) 121 120 { 122 return $this->parameterHolder->get($name, $default , $ns);121 return $this->parameterHolder->get($name, $default); 123 122 } 124 123 … … 127 126 * 128 127 * @param string A parameter name 129 * @param string A parameter namespace130 128 * 131 129 * @return boolean true, if parameter exists, otherwise false 132 130 */ 133 public function hasParameter($name , $ns = null)131 public function hasParameter($name) 134 132 { 135 return $this->parameterHolder->has($name , $ns);133 return $this->parameterHolder->has($name); 136 134 } 137 135 … … 141 139 * @param string A parameter name 142 140 * @param mixed A parameter value 143 * @param string Namespace for the current storage144 141 */ 145 public function setParameter($name, $value , $ns = null)142 public function setParameter($name, $value) 146 143 { 147 return $this->parameterHolder->set($name, $value , $ns);144 return $this->parameterHolder->set($name, $value); 148 145 } 149 146 } trunk/lib/user/sfUser.class.php
r4961 r5016 73 73 $this->parameterHolder->add($parameters); 74 74 75 $this->attributeHolder = new sf ParameterHolder(self::ATTRIBUTE_NAMESPACE);75 $this->attributeHolder = new sfNamespacedParameterHolder(self::ATTRIBUTE_NAMESPACE); 76 76 77 77 // read attributes from storage … … 218 218 } 219 219 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); 233 233 } 234 234 trunk/lib/util/sfParameterHolder.class.php
r4898 r5016 24 24 class sfParameterHolder implements Serializable 25 25 { 26 protected $default_namespace = null;27 26 protected $parameters = array(); 28 27 29 28 /** 30 29 * 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. 77 37 */ 78 38 public function clear() 79 39 { 80 $this->parameters = null;81 40 $this->parameters = array(); 82 41 } 83 42 84 43 /** 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. 90 45 * 91 46 * @param string A parameter name. 92 47 * @param mixed A default parameter value. 93 * @param string A parameter namespace.94 48 * 95 49 * @return mixed A parameter value, if the parameter exists, otherwise null. 96 50 */ 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]; 111 56 } 112 57 else 113 58 { 114 $value = $default;59 $value = sfToolkit::getArrayValueForPath($this->parameters, $name, $default); 115 60 } 116 61 … … 119 64 120 65 /** 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() 148 71 { 149 72 return array_keys($this->parameters); … … 151 74 152 75 /** 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. 161 77 * 162 78 * @return array An associative array of parameters. 163 79 */ 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; 179 83 } 180 84 … … 183 87 * 184 88 * @param string A parameter name. 185 * @param string A parameter namespace.186 89 * 187 90 * @return bool true, if the parameter exists, otherwise false. 188 91 */ 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 { 196 94 if (false !== ($offset = strpos($name, '['))) 197 95 { 198 if (isset($this->parameters[ $ns][substr($name, 0, $offset)]))96 if (isset($this->parameters[substr($name, 0, $offset)])) 199 97 { 200 $array = $this->parameters[ $ns][substr($name, 0, $offset)];98 $array = $this->parameters[substr($name, 0, $offset)]; 201 99 202 100 while ($pos = strpos($name, '[', $offset)) … … 219 117 } 220 118 } 221 elseif (isset($this->parameters[$n s][$name]))119 elseif (isset($this->parameters[$name])) 222 120 { 223 121 return true; … … 228 126 229 127 /** 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 /**242 128 * Remove a parameter. 243 129 * 244 130 * @param string A parameter name. 245 * @param string A parameter namespace.246 131 * 247 132 * @return string A parameter value, if the parameter was removed, otherwise null. 248 133 */ 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 { 256 136 $retval = null; 257 137 258 if ( isset($this->parameters[$ns]) && array_key_exists($name, $this->parameters[$ns]))259 { 260 $retval = $this->parameters[$n s][$name];261 unset($this->parameters[$n s][$name]);138 if (array_key_exists($name, $this->parameters)) 139 { 140 $retval = $this->parameters[$name]; 141 unset($this->parameters[$name]); 262 142 } 263 143 … … 266 146 267 147 /** 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. 294 149 * 295 150 * If a parameter with the name already exists the value will be overridden. … … 297 152 * @param string A parameter name. 298 153 * @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. 320 162 * 321 163 * If a parameter with the name already exists the value will be overridden. … … 323 165 * @param string A parameter name. 324 166 * @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. 346 175 * 347 176 * If an existing parameter name matches any of the keys in the supplied … … 349 178 * 350 179 * @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; 367 186 } 368 187 369 188 foreach ($parameters as $key => $value) 370 189 { 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. 377 196 * 378 197 * If an existing parameter name matches any of the keys in the supplied … … 380 199 * 381 200 * @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 { 398 204 foreach ($parameters as $key => &$value) 399 205 { 400 $this->parameters[$ ns][$key] =& $value;206 $this->parameters[$key] =& $value; 401 207 } 402 208 } … … 409 215 public function serialize() 410 216 { 411 return serialize( array($this->default_namespace, $this->parameters));217 return serialize($this->parameters); 412 218 } 413 219 … … 417 223 public function unserialize($serialized) 418 224 { 419 $data = unserialize($serialized); 420 421 $this->default_namespace = $data[0]; 422 $this->parameters = $data[1]; 225 $this->parameters = unserialize($serialized); 423 226 } 424 227 } trunk/lib/validator/sfValidator.class.php
r4957 r5016 88 88 * @param string Parameter name 89 89 * @param mixed A default parameter value 90 * @param string A parameter namespace91 90 * 92 91 * @return mixed A parameter value 93 92 */ 94 public function getParameter($name, $default = null , $ns = null)93 public function getParameter($name, $default = null) 95 94 { 96 return $this->parameterHolder->get($name, $default , $ns);95 return $this->parameterHolder->get($name, $default); 97 96 } 98 97 … … 101 100 * 102 101 * @param string A parameter name 103 * @param string A parameter namespace104 102 * 105 103 * @return boolean true, if parameter exists, otherwise false 106 104 */ 107 public function hasParameter($name , $ns = null)105 public function hasParameter($name) 108 106 { 109 return $this->parameterHolder->has($name , $ns);107 return $this->parameterHolder->has($name); 110 108 } 111 109 … … 115 113 * @param string A parameter name 116 114 * @param mixed A parameter value 117 * @param string A parameter namespace118 115 */ 119 public function setParameter($name, $value , $ns = null)116 public function setParameter($name, $value) 120 117 { 121 $this->parameterHolder->set($name, $value , $ns);118 $this->parameterHolder->set($name, $value); 122 119 } 123 120 } trunk/lib/view/sfView.class.php
r4957 r5016 210 210 * @param string Name of the attribute 211 211 * @param string Value of the attribute 212 * @param string The current namespace213 212 * 214 213 * @return mixed Attribute 215 214 */ 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); 219 218 } 220 219 … … 223 222 * 224 223 * @param string Name of the attribute 225 * @param string Namespace for the current view226 224 * 227 225 * @return mixed Attribute of the view 228 226 */ 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); 232 230 } 233 231 … … 237 235 * @param string Attribute name 238 236 * @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); 244 241 } 245 242 … … 259 256 * @param string Parameter name 260 257 * @param string Default parameter value 261 * @param string Namespace for the current view262 258 * 263 259 * @return mixed A parameter value 264 260 */ 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); 268 264 } 269 265 … … 272 268 * 273 269 * @param string Name of the paramater 274 * @param string Namespace for the current view275 270 * 276 271 * @return boolean true, if the parameter exists otherwise false 277 272 */ 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); 281 276 } 282 277 … … 286 281 * @param string Name of the parameter 287 282 * @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); 293 287 } 294 288 trunk/lib/view/sfViewCacheManager.class.php
r4961 r5016 358 358 { 359 359 // ignore cache parameter? (only available in debug mode) 360 if (sfConfig::get('sf_debug') && $this->context->getRequest()->get Parameter('_sf_ignore_cache', false, 'symfony/request/sfWebRequest') == true)360 if (sfConfig::get('sf_debug') && $this->context->getRequest()->getAttribute('_sf_ignore_cache')) 361 361 { 362 362 if (sfConfig::get('sf_logging_enabled')) trunk/lib/view/sfViewParameterHolder.class.php
r4934 r5016 86 86 $tmp->context = null; 87 87 88 return serialize( array($tmp->default_namespace, $tmp->parameters));88 return serialize($tmp->parameters); 89 89 } 90 90 trunk/test/bootstrap/unit.php
r4840 r5016 21 21 $autoload->register(); 22 22 23 sfConfig::set('sf_test_cache_dir', sfToolkit::getTmpDir()); 24 23 25 class sfException extends Exception 24 26 { trunk/test/unit/database/sfDatabaseTest.php
r4440 r5016 12 12 require_once($_test_dir.'/unit/sfContextMock.class.php'); 13 13 14 $t = new lime_test(1 3, new lime_output_color());14 $t = new lime_test(10, new lime_output_color()); 15 15 16 16 class myDatabase extends sfDatabase trunk/test/unit/filter/sfFilterTest.php
r4440 r5016 12 12 require_once($_test_dir.'/unit/sfContextMock.class.php'); 13 13 14 $t = new lime_test( 20, new lime_output_color());14 $t = new lime_test(17, new lime_output_color()); 15 15 16 16 class myFilter extends sfFilter … … 23 23 24 24 $context = sfContext::getInstance(); 25 $filter = new myFilter( );25 $filter = new myFilter($context); 26 26 27 27 // ->initialize() 28 28 $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'); 31 31 $filter->initialize($context, array('foo' => 'bar')); 32 32 $t->is($filter->getParameter('foo'), 'bar', '->initialize() takes an array of parameters as its second argument'); … … 43 43 $t->is($filter->isFirstCall('beforeExecution'), false, '->isFirstCall() returns false if this is not the first call with this argument'); 44 44 45 $filter = new myFilter( );45 $filter = new myFilter($context); 46 46 $filter->initialize($context); 47 47 $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 23 23 } 24 24 25 $t = new lime_test( 50, new lime_output_color());25 $t = new lime_test(44, new lime_output_color()); 26 26 27 27 $dispatcher = new sfEventDispatcher(); trunk/test/unit/response/sfResponseTest.php
r4957 r5016 21 21 } 22 22 23 $t = new lime_test( 20, new lime_output_color());23 $t = new lime_test(17, new lime_output_color()); 24 24 25 25 $dispatcher = new sfEventDispatcher(); trunk/test/unit/response/sfWebResponseTest.php
r4957 r5016 169 169 170 170 $response2->mergeProperties($response1); 171 $t->is($response1->getHttpHeader('symfony'), $response2->getHttpHeader('symfony'), '->merge rProperties() merges http headers');172 $t->is($response1->getContentType(), $response2->getContentType(), '->merge rProperties() merges content type');173 $t->is($response1->getTitle(), $response2->getTitle(), '->merge rProperties() 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'); 174 174 175 175 // ->addStylesheet() … … 177 177 $response = new myWebResponse($dispatcher); 178 178 $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'); 180 180 $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'); 182 182 $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'); 184 184 $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'); 186 186 $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'); 188 189 189 190 // ->getStylesheets() … … 197 198 $response = new myWebResponse($dispatcher); 198 199 $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'); 200 201 $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'); 202 203 $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'); 204 205 $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'); 206 207 207 208 // ->getJavascripts() trunk/test/unit/sfParameterHolderTest.class.php
r2111 r5016 30 30 $t->diag(ucfirst($methodName).' holder proxy'); 31 31 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"); 33 35 $t->is($object->$hasMethod('foo'), false, "->$hasMethod() returns false if the $methodName does not exist"); 34 36 $t->is($object->$getMethod('foo', 'default'), 'default', "->$getMethod() returns the default value if $methodName does not exist"); … … 39 41 $t->is($object->$getMethod('foo'), $object->$holderMethod()->get('foo'), "->$getMethod() is a proxy method"); 40 42 $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 45 52 $object->$setMethod('foo2', 'bar2'); 46 53 $object->$holderMethod()->set('foo3', 'bar3'); trunk/test/unit/storage/sfStorageTest.php
r4957 r5016 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 12 13 $t = new lime_test(1 4, new lime_output_color());13 $t = new lime_test(11, new lime_output_color()); 14 14 15 15 class myStorage extends sfStorage trunk/test/unit/user/sfUserTest.php
r4957 r5016 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 12 13 $t = new lime_test(3 9, new lime_output_color());13 $t = new lime_test(36, new lime_output_color()); 14 14 15 15 $_SERVER['session_id'] = 'test'; 16 sf Config::set('sf_test_cache_dir', sfToolkit::getTmpDir());16 sfToolkit::clearDirectory(sfConfig::get('sf_test_cache_dir').'/sessions'); 17 17 18 18 $dispatcher = new sfEventDispatcher(); trunk/test/unit/util/sfNamespacedParameterHolderTest.php
r4645 r5016 15 15 // ->clear() 16 16 $t->diag('->clear()'); 17 $ph = new sf ParameterHolder();17 $ph = new sfNamespacedParameterHolder(); 18 18 $ph->clear(); 19 19 $t->is($ph->getAll(), null, '->clear() clears all parameters'); … … 25 25 // ->get() 26 26 $t->diag('->get()'); 27 $ph = new sf ParameterHolder();27 $ph = new sfNamespacedParameterHolder(); 28 28 $ph->set('foo', 'bar'); 29 29 $t->is($ph->get('foo'), 'bar', '->get() returns the parameter value for the given key'); 30 30 $t->is($ph->get('bar'), null, '->get() returns null if the key does not exist'); 31 31 32 $ph = new sf ParameterHolder();32 $ph = new sfNamespacedParameterHolder(); 33 33 $t->is('default_value', $ph->get('foo1', 'default_value'), '->get() takes the default value as its second argument'); 34 34 35 $ph = new sf ParameterHolder();35 $ph = new sfNamespacedParameterHolder(); 36 36 $ph->set('myfoo', 'bar', 'symfony/mynamespace'); 37 37 $t->is('bar', $ph->get('myfoo', null, 'symfony/mynamespace'), '->get() takes an optional namespace as its third argument'); 38 38 $t->is(null, $ph->get('myfoo'), '->get() can have the same key for several namespaces'); 39 39 40 $ph = new sf ParameterHolder();40 $ph = new sfNamespacedParameterHolder(); 41 41 $ph->add(array('foo' => array( 42 42 'bar' => array( … … 53 53 // ->getNames() 54 54 $t->diag('->getNames()'); 55 $ph = new sf ParameterHolder();55 $ph = new sfNamespacedParameterHolder(); 56 56 $ph->set('foo', 'bar'); 57 57 $ph->set('yourfoo', 'bar'); … … 63 63 // ->getNamespaces() 64 64 $t->diag('->getNamespaces()'); 65 $ph = new sf ParameterHolder();65 $ph = new sfNamespacedParameterHolder(); 66 66 $ph->set('foo', 'bar'); 67 67 $ph->set('yourfoo', 'bar'); … … 72 72 // ->setDefaultNamespace() 73 73 $t->diag('->setDefaultNamespace()'); 74 $ph = new sf ParameterHolder('symfony/mynamespace');74 $ph = new sfNamespacedParameterHolder('symfony/mynamespace'); 75 75 $ph->setDefaultNamespace('othernamespace'); 76 76 … … 92 92 $t->diag('->getAll()'); 93 93 $parameters = array('foo' => 'bar', 'myfoo' => 'bar'); 94 $ph = new sf ParameterHolder();94 $ph = new sfNamespacedParameterHolder(); 95 95 $ph->add($parameters); 96 96 $ph->set('myfoo', 'bar', 'symfony/mynamespace'); … … 99 99 // ->has() 100 100 $t->diag('->has()'); 101 $ph = new sf ParameterHolder();101 $ph = new sfNamespacedParameterHolder(); 102 102 $ph->set('foo', 'bar'); 103 103 $ph->set('myfoo', 'bar', 'symfony/mynamespace'); … … 107 107 $t->is($ph->has('myfoo', 'symfony/mynamespace'), true, '->has() returns true if the key exists in the namespace given as its second argument'); 108 108 109 $ph = new sf ParameterHolder();109 $ph = new sfNamespacedParameterHolder(); 110 110 $ph->add(array('foo' => array( 111 111 'bar' => array( … … 122 122 // ->hasNamespace() 123 123 $t->diag('->hasNamespace()'); 124 $ph = new sf ParameterHolder();124 $ph = new sfNamespacedParameterHolder(); 125 125 $ph->set('foo', 'bar'); 126 126 $ph->set('myfoo', 'bar', 'symfony/mynamespace'); … … 131 131 // ->remove() 132 132 $t->diag('->remove()'); 133 $ph = new sf ParameterHolder();133 $ph = new sfNamespacedParameterHolder(); 134 134 $ph->set('foo', 'bar'); 135 135 $ph->set('myfoo', 'bar'); … … 150 150 // ->removeNamespace() 151 151 $t->diag('->removeNamespace()'); 152 $ph = new sf ParameterHolder();152 $ph = new sfNamespacedParameterHolder(); 153 153 $ph->set('foo', 'bar'); 154 154 $ph->set('myfoo', 'bar'); … … 178 178 $foo = 'bar'; 179 179 180 $ph = new sf ParameterHolder();180 $ph = new sfNamespacedParameterHolder(); 181 181 $ph->set('foo', $foo); 182 182 $t->is($ph->get('foo'), $foo, '->set() sets the value for a key'); … … 192 192 $foo = 'bar'; 193 193 194 $ph = new sf ParameterHolder();194 $ph = new sfNamespacedParameterHolder(); 195 195 $ph->setByRef('foo', $foo); 196 196 $t->is($ph->get('foo'), $foo, '->setByRef() sets the value for a key'); … … 209 209 $myparameters = array('myfoo' => 'bar', 'mybar' => 'bar'); 210 210 211 $ph = new sf ParameterHolder();211 $ph = new sfNamespacedParameterHolder(); 212 212 $ph->add($parameters); 213 213 $ph->add($myparameters, 'symfony/mynamespace'); … … 225 225 $myparameters = array('myfoo' => 'bar', 'mybar' => 'bar'); 226 226 227 $ph = new sf ParameterHolder();227 $ph = new sfNamespacedParameterHolder(); 228 228 $ph->addByRef($parameters); 229 229 $ph->addByRef($myparameters, 'symfony/mynamespace'); … … 237 237 // ->serialize() ->unserialize() 238 238 $t->diag('->serialize() ->unserialize()'); 239 $t->ok($ph == unserialize(serialize($ph)), 'sf ParameterHolder implements the Serializable interface');239 $t->ok($ph == unserialize(serialize($ph)), 'sfNamespacedParameterHolder implements the Serializable interface'); trunk/test/unit/validator/sfValidatorTest.php
r4440 r5016 12 12 require_once($_test_dir.'/unit/sfContextMock.class.php'); 13 13 14 $t = new lime_test(1 4, new lime_output_color());14 $t = new lime_test(11, new lime_output_color()); 15 15 16 16 class myValidator extends sfValidator trunk/test/unit/view/sfViewTest.php
r4957 r5016 12 12 require_once($_test_dir.'/unit/sfContextMock.class.php'); 13 13 14 $t = new lime_test(1 7, new lime_output_color());14 $t = new lime_test(14, new lime_output_color()); 15 15 16 16 class myView extends sfView

