Changeset 4296
- Timestamp:
- 06/20/07 22:29:55 (1 year ago)
- Files:
-
- branches/dwhittle/lib/action/sfAction.class.php (modified) (3 diffs)
- branches/dwhittle/lib/config/sfLoader.class.php (modified) (4 diffs)
- branches/dwhittle/lib/exception/sfError404Exception.class.php (modified) (1 diff)
- branches/dwhittle/lib/i18n/sfMessageFormat.class.php (modified) (3 diffs)
- branches/dwhittle/lib/i18n/sfMessageSource_MySQL.class.php (modified) (4 diffs)
- branches/dwhittle/lib/util/sfBrowser.class.php (modified) (4 diffs)
- branches/dwhittle/lib/validator/sfValidatorManager.class.php (modified) (1 diff)
- branches/dwhittle/test/functional/fixtures/project/apps/frontend/modules/browser (copied) (copied from trunk/test/functional/fixtures/project/apps/frontend/modules/browser)
- branches/dwhittle/test/functional/fixtures/project/apps/frontend/modules/browser/actions (copied) (copied from trunk/test/functional/fixtures/project/apps/frontend/modules/browser/actions)
- branches/dwhittle/test/functional/fixtures/project/apps/frontend/modules/browser/actions/actions.class.php (copied) (copied from trunk/test/functional/fixtures/project/apps/frontend/modules/browser/actions/actions.class.php)
- branches/dwhittle/test/functional/routingTest.php (modified) (3 diffs)
- branches/dwhittle/test/functional/sfTestBrowserTest.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/dwhittle/lib/action/sfAction.class.php
r4271 r4296 291 291 */ 292 292 public function renderMultiformat($format_param = 'format', $accepted_formats = array()) 293 { 294 // FIXME: Make the exceptions of this method redirect to a 404 in production 295 293 { 296 294 if(!$format = $this->getRequestParameter($format_param)) 297 295 { 298 throw new sfE xception(sprintf('The format parameter "%s" is not defined in the request', $format_param));296 throw new sfError404Exception(sprintf('The format parameter "%s" is not defined in the request', $format_param)); 299 297 } 300 298 … … 304 302 { 305 303 // format not in the list of allowed formats 306 throw new sfE xception(sprintf('The format "%s" is not allowed in this action. If you want to use this format, add it to the list of allowed formats in the second argument of the call to renderMultiformat()', $format));304 throw new sfError404Exception(sprintf('The format "%s" is not allowed in this action. If you want to use this format, add it to the list of allowed formats in the second argument of the call to renderMultiformat()', $format)); 307 305 } 308 306 … … 313 311 if(!isset($default_classes[$format])) 314 312 { 315 throw new sfE xception(sprintf('There is no default view for format "%s". You can define one in the settings.yml file, under the multiformat: label.', $format));313 throw new sfError404Exception(sprintf('There is no default view for format "%s". You can define one in the settings.yml file, under the multiformat: label.', $format)); 316 314 } 317 315 $this->setViewClass($default_classes[$format]); branches/dwhittle/lib/config/sfLoader.class.php
r3328 r4296 167 167 static public function getGeneratorTemplateDirs($class, $theme) 168 168 { 169 $dirs = array( );169 $dirs = array(sfConfig::get('sf_data_dir').'/generator/'.$class.'/'.$theme.'/template'); // project 170 170 171 171 if ($pluginDirs = glob(sfConfig::get('sf_plugins_dir').'/*/data/generator/'.$class.'/'.$theme.'/template')) … … 174 174 } 175 175 176 $dirs[] = sfConfig::get('sf_data_dir').'/generator/'.$class.'/'.$theme.'/template'; // project177 176 $dirs[] = sfConfig::get('sf_symfony_data_dir').'/generator/'.$class.'/default/template'; // default theme 178 177 … … 190 189 static public function getGeneratorSkeletonDirs($class, $theme) 191 190 { 192 $dirs = array( );191 $dirs = array(sfConfig::get('sf_data_dir').'/generator/'.$class.'/'.$theme.'/skeleton'); // project 193 192 194 193 if ($pluginDirs = glob(sfConfig::get('sf_plugins_dir').'/*/data/generator/'.$class.'/'.$theme.'/skeleton')) … … 197 196 } 198 197 199 $dirs[] = sfConfig::get('sf_data_dir').'/generator/'.$class.'/'.$theme.'/skeleton'; // project200 198 $dirs[] = sfConfig::get('sf_symfony_data_dir').'/generator/'.$class.'/default/skeleton'; // default theme 201 199 branches/dwhittle/lib/exception/sfError404Exception.class.php
r3248 r4296 38 38 public function printStackTrace($exception = null) 39 39 { 40 sfContext::getInstance()->getController()->forward(sfConfig::get('sf_error_404_module'), sfConfig::get('sf_error_404_action')); 40 if (sfConfig::get('sf_debug')) 41 { 42 return parent::printStackTrace($exception); 43 } 44 else 45 { 46 sfContext::getInstance()->getController()->forward(sfConfig::get('sf_error_404_module'), sfConfig::get('sf_error_404_action')); 47 } 41 48 } 42 49 } branches/dwhittle/lib/i18n/sfMessageFormat.class.php
r3112 r4296 60 60 * @var array 61 61 */ 62 protected $cata gloues = array();62 protected $catalogues = array(); 63 63 64 64 /** … … 136 136 protected function loadCatalogue($catalogue) 137 137 { 138 if (in_array($catalogue,$this->cata gloues))138 if (in_array($catalogue,$this->catalogues)) 139 139 { 140 140 return; … … 144 144 { 145 145 $this->messages[$catalogue] = $this->source->read(); 146 $this->cata gloues[] = $catalogue;146 $this->catalogues[] = $catalogue; 147 147 } 148 148 } branches/dwhittle/lib/i18n/sfMessageSource_MySQL.class.php
r4249 r4296 47 47 * @var array 48 48 */ 49 protected $d ns;49 protected $dsn; 50 50 51 51 /** … … 65 65 { 66 66 $this->source = (string)$source; 67 $this->d ns= parseDSN($this->source);67 $this->dsn = parseDSN($this->source); 68 68 $this->db = $this->connect(); 69 69 } … … 85 85 protected function connect() 86 86 { 87 $dsninfo = $this->d ns;87 $dsninfo = $this->dsn; 88 88 89 89 if (isset($dsninfo['protocol']) && $dsninfo['protocol'] == 'unix') … … 130 130 if (!@mysql_select_db($dsninfo['database'], $conn)) 131 131 { 132 throw new sfException('Error in connecting database, d ns:'.$dsninfo);132 throw new sfException('Error in connecting database, dsn:'.$dsninfo); 133 133 } 134 134 } branches/dwhittle/lib/util/sfBrowser.class.php
r3688 r4296 208 208 $this->domCssSelector = new sfDomCssSelector($this->dom); 209 209 } 210 else 211 { 212 $this->dom = null; 213 $this->domCssSelector = null; 214 } 210 215 211 216 return $this; … … 246 251 public function getResponseDomCssSelector() 247 252 { 253 if (is_null($this->dom)) 254 { 255 throw new sfException('The DOM is not accessible because the browser response content type is not HMTL.'); 256 } 257 248 258 return $this->domCssSelector; 249 259 } … … 251 261 public function getResponseDom() 252 262 { 263 if (is_null($this->dom)) 264 { 265 throw new sfException('The DOM is not accessible because the browser response content type is not HMTL.'); 266 } 267 253 268 return $this->dom; 254 269 } … … 295 310 public function click($name, $arguments = array()) 296 311 { 297 if (!$this->dom) 312 $dom = $this->getResponseDom(); 313 314 if (!$dom) 298 315 { 299 316 throw new sfException('Cannot click because there is no current page in the browser'); 300 317 } 301 318 302 $xpath = new DomXpath($this->dom); 303 $dom = $this->dom; 319 $xpath = new DomXpath($dom); 304 320 305 321 // text link branches/dwhittle/lib/validator/sfValidatorManager.class.php
r3248 r4296 255 255 ($data['is_file'] && !$value['name']) 256 256 || 257 (!$data['is_file'] && (is_array($value) ? sfToolkit::isArrayValuesEmpty($value) : ($value == null || strlen($value) == 0)))257 (!$data['is_file'] && (is_array($value) ? sfToolkit::isArrayValuesEmpty($value) : ($value === null || strlen($value) == 0))) 258 258 ) 259 259 { branches/dwhittle/test/functional/routingTest.php
r4271 r4296 119 119 $b-> 120 120 get('/test_multiformat.titi')-> 121 responseContains('sfError404Exception')-> 121 122 responseContains('There is no default view for format "titi"') 122 123 ; 123 124 $b-> 124 125 get('/test_multiformat.toto')-> 126 responseContains('sfError404Exception')-> 125 127 responseContains('The format "toto" is not allowed in this action') 126 128 ; … … 145 147 $b-> 146 148 get('/test_multiformat_defaults.toto')-> 149 responseContains('sfError404Exception')-> 147 150 responseContains('There is no default view for format "toto"') 148 151 ; … … 153 156 isRequestParameter('module', 'test')-> 154 157 isRequestParameter('action', 'testMultiformatUndefined')-> 158 responseContains('sfError404Exception')-> 155 159 responseContains('The format parameter "format" is not defined in the request') 156 160 ; branches/dwhittle/test/functional/sfTestBrowserTest.php
r3112 r4296 42 42 throwsException('sfException', 'sfException message') 43 43 ; 44 45 $b-> 46 get('/browser')-> 47 responseContains('html')-> 48 checkResponseElement('h1', 'html')-> 49 50 get('/browser/text')-> 51 responseContains('text') 52 ; 53 54 try 55 { 56 $b->checkResponseElement('h1', 'text'); 57 $b->test()->fail('The DOM is not accessible if the response content type is not HTML'); 58 } 59 catch (sfException $e) 60 { 61 $b->test()->pass('The DOM is not accessible if the response content type is not HTML'); 62 }