Changeset 8922
- Timestamp:
- 05/13/08 10:20:09 (1 year ago)
- Files:
-
- branches/1.0/lib/filter/sfExecutionFilter.class.php (modified) (1 diff)
- branches/1.0/test/functional/fixtures/project/apps/frontend/modules/validation/actions/actions.class.php (modified) (1 diff)
- branches/1.0/test/functional/fixtures/project/apps/frontend/modules/validation/validate/Index2.yml (added)
- branches/1.0/test/functional/validationTest.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.0/lib/filter/sfExecutionFilter.class.php
r7791 r8922 72 72 $validated = true; 73 73 74 // the case of the first letter of the action is insignificant 74 75 // get the current action validation configuration 75 $validationConfig = $moduleName.'/'.sfConfig::get('sf_app_module_validate_dir_name').'/'.$actionName.'.yml'; 76 $validationConfigWithFirstLetterLower = $moduleName.'/'.sfConfig::get('sf_app_module_validate_dir_name').'/'.strtolower(substr($actionName, 0, 1)).substr($actionName, 1).'.yml'; 77 $validationConfigWithFirstLetterUpper = $moduleName.'/'.sfConfig::get('sf_app_module_validate_dir_name').'/'.ucfirst($actionName).'.yml'; 78 79 // determine $validateFile by testing both the uppercase and lowercase 80 // types of validation configurations. 81 $validateFile = null; 82 if (!is_null($testValidateFile = sfConfigCache::getInstance()->checkConfig(sfConfig::get('sf_app_module_dir_name').'/'.$validationConfigWithFirstLetterLower, true))) 83 { 84 $validateFile = $testValidateFile; 85 } 86 else if (!is_null($testValidateFile = sfConfigCache::getInstance()->checkConfig(sfConfig::get('sf_app_module_dir_name').'/'.$validationConfigWithFirstLetterUpper, true))) 87 { 88 $validateFile = $testValidateFile; 89 } 76 90 77 91 // load validation configuration 78 92 // do NOT use require_once 79 if ( null !== $validateFile = sfConfigCache::getInstance()->checkConfig(sfConfig::get('sf_app_module_dir_name').'/'.$validationConfig, true))93 if (!is_null($validateFile)) 80 94 { 81 95 // create validator manager branches/1.0/test/functional/fixtures/project/apps/frontend/modules/validation/actions/actions.class.php
r3168 r8922 13 13 public function executeIndex() 14 14 { 15 if (sfWebRequest::POST == $this->getRequest()->getMethod()) 16 { 17 $this->getResponse()->setHttpHeader('X-Validated', 'ok'); 18 } 15 19 } 16 20 17 21 public function handleErrorIndex() 18 22 { 23 $this->getResponse()->setHttpHeader('X-Validated', 'ko'); 24 25 return sfView::SUCCESS; 26 } 27 28 public function executeIndex2() 29 { 30 if (sfWebRequest::POST == $this->getRequest()->getMethod()) 31 { 32 $this->getResponse()->setHttpHeader('X-Validated', 'ok'); 33 } 34 } 35 36 public function handleErrorIndex2() 37 { 38 $this->getResponse()->setHttpHeader('X-Validated', 'ko'); 39 19 40 return sfView::SUCCESS; 20 41 } branches/1.0/test/functional/validationTest.php
r3168 r8922 138 138 checkResponseElement('body ul[class="errors"] li[class="input4"]', 'Required') 139 139 ; 140 141 // check that /validation/index and /validation/Index both uses the index.yml validation file (see #1617) 142 // those tests are only relevant on machines where filesystems are case sensitive. 143 $b-> 144 post('/validation/index')-> 145 isStatusCode(200)-> 146 isRequestParameter('module', 'validation')-> 147 isRequestParameter('action', 'index')-> 148 isResponseHeader('X-Validated', 'ko') 149 ; 150 151 $b-> 152 post('/validation/Index')-> 153 isStatusCode(200)-> 154 isRequestParameter('module', 'validation')-> 155 isRequestParameter('action', 'Index')-> 156 isResponseHeader('X-Validated', 'ko') 157 ; 158 159 $b-> 160 post('/validation/INdex')-> 161 isStatusCode(404) 162 ; 163 164 $b-> 165 post('/validation/index2')-> 166 isStatusCode(200)-> 167 isRequestParameter('module', 'validation')-> 168 isRequestParameter('action', 'index2')-> 169 isResponseHeader('X-Validated', 'ko') 170 ; 171 172 $b-> 173 post('/validation/Index2')-> 174 isStatusCode(200)-> 175 isRequestParameter('module', 'validation')-> 176 isRequestParameter('action', 'Index2')-> 177 isResponseHeader('X-Validated', 'ko') 178 ;

