Changeset 11098
- Timestamp:
- 08/25/08 11:10:13 (10 months ago)
- Files:
-
- branches/1.2/UPGRADE_TO_1_2 (modified) (1 diff)
- branches/1.2/lib/response/sfWebResponse.class.php (modified) (2 diffs)
- branches/1.2/test/unit/response/sfWebResponseTest.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.2/UPGRADE_TO_1_2
r11090 r11098 99 99 sfWebResponse::LAST === 'last' 100 100 101 The `removeStylesheet()` and `removeJavascript()` methods now only take one argument, 102 the file to remove from the response. It will remove the file in all the available 103 positions. In symfony 1.1, they take the position as a second argument. 104 101 105 Validators 102 106 ---------- branches/1.2/lib/response/sfWebResponse.class.php
r11089 r11098 634 634 * Removes a stylesheet from the current web response. 635 635 * 636 * @param string $css The stylesheet file637 * @param string $position Position638 */639 public function removeStylesheet($file, $position = '')640 {641 $this->validatePosition($position);642 643 unset($this->stylesheets[$position][$file]);636 * @param string $css The stylesheet file to remove 637 */ 638 public function removeStylesheet($file) 639 { 640 foreach ($this->getPositions() as $position) 641 { 642 unset($this->stylesheets[$position][$file]); 643 } 644 644 } 645 645 … … 696 696 * Removes a JavaScript file from the current web response. 697 697 * 698 * @param string $file The Javascript file699 * @param string $position Position700 */701 public function removeJavascript($file, $position = '')702 {703 $this->validatePosition($position);704 705 unset($this->javascripts[$position][$file]);698 * @param string $file The Javascript file to remove 699 */ 700 public function removeJavascript($file) 701 { 702 foreach ($this->getPositions() as $position) 703 { 704 unset($this->javascripts[$position][$file]); 705 } 706 706 } 707 707 branches/1.2/test/unit/response/sfWebResponseTest.php
r11059 r11098 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 12 13 $t = new lime_test(7 7, new lime_output_color());13 $t = new lime_test(79, new lime_output_color()); 14 14 15 15 class myWebResponse extends sfWebResponse … … 224 224 $t->diag('->removeStylesheet()'); 225 225 $response->removeStylesheet('foo'); 226 $t->is($response->getStylesheets(), array('test' => array(), 'bar' => array('media' => 'print')), '->getStylesheets() does no longer contain removed stylesheets'); 226 $t->is(array_keys($response->getStylesheets(sfWebResponse::ALL)), array('first', 'test', 'bar', 'last'), '->getStylesheets() removes a stylesheet from the response'); 227 228 $response->removeStylesheet('first'); 229 $t->is(array_keys($response->getStylesheets(sfWebResponse::ALL)), array('test', 'bar', 'last'), '->getStylesheets() removes a stylesheet from the response'); 227 230 228 231 // ->addJavascript() … … 256 259 $t->diag('->removeJavascript()'); 257 260 $response->removeJavascript('test'); 258 $t->is($response->getJavascripts(), array('foo' => array('raw_name' => true)), '->getJavascripts() does no longer contain removed javascripts'); 261 $t->is(array_keys($response->getJavascripts(sfWebResponse::ALL)), array('first_js', 'foo', 'last_js'), '->removeJavascripts() removes a javascript file'); 262 263 $response->removeJavascript('first_js'); 264 $t->is(array_keys($response->getJavascripts(sfWebResponse::ALL)), array('foo', 'last_js'), '->removeJavascripts() removes a javascript file'); 259 265 260 266 // ->setCookie() ->getCookies()

