Changeset 8925
- Timestamp:
- 05/13/08 11:03:01 (5 years ago)
- Files:
-
- branches/1.1/lib/plugins/sfCompat10Plugin/lib/filter/sfValidationExecutionFilter.class.php (modified) (1 diff)
- branches/1.1/lib/plugins/sfCompat10Plugin/test/functional/fixtures/apps/frontend/modules/validation/actions/actions.class.php (modified) (1 diff)
- branches/1.1/lib/plugins/sfCompat10Plugin/test/functional/fixtures/apps/frontend/modules/validation/templates/Index2Success.php (copied) (copied from branches/1.1/lib/plugins/sfCompat10Plugin/test/functional/fixtures/apps/frontend/modules/validation/templates/indexSuccess.php)
- branches/1.1/lib/plugins/sfCompat10Plugin/test/functional/fixtures/apps/frontend/modules/validation/validate/Index2.yml (added)
- branches/1.1/lib/plugins/sfCompat10Plugin/test/functional/validationTest.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.1/lib/plugins/sfCompat10Plugin/lib/filter/sfValidationExecutionFilter.class.php
r7792 r8925 108 108 $validated = true; 109 109 110 // the case of the first letter of the action is insignificant 110 111 // get the current action validation configuration 111 $validationConfig = $moduleName.'/validate/'.$actionName.'.yml'; 112 $validationConfigWithFirstLetterLower = strtolower(substr($actionName, 0, 1)).substr($actionName, 1).'.yml'; 113 $validationConfigWithFirstLetterUpper = ucfirst($actionName).'.yml'; 114 115 // determine $validateFile by testing both the uppercase and lowercase 116 // types of validation configurations. 117 $validateFile = null; 118 if (!is_null($testValidateFile = $this->context->getConfigCache()->checkConfig('modules/'.$moduleName.'/validate/'.$validationConfigWithFirstLetterLower, true))) 119 { 120 $validateFile = $testValidateFile; 121 } 122 else if (!is_null($testValidateFile = $this->context->getConfigCache()->checkConfig('modules/'.$moduleName.'/validate/'.$validationConfigWithFirstLetterUpper, true))) 123 { 124 $validateFile = $testValidateFile; 125 } 112 126 113 127 // load validation configuration 114 128 // do NOT use require_once 115 if ( null !== $validateFile = $this->context->getConfigCache()->checkConfig('modules/'.$validationConfig, true))129 if (!is_null($validateFile)) 116 130 { 117 131 // create validator manager branches/1.1/lib/plugins/sfCompat10Plugin/test/functional/fixtures/apps/frontend/modules/validation/actions/actions.class.php
r3168 r8925 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.1/lib/plugins/sfCompat10Plugin/test/functional/validationTest.php
r6482 r8925 137 137 checkResponseElement('body ul[class="errors"] li[class="input4"]', 'Required') 138 138 ; 139 140 // check that /validation/index and /validation/Index both uses the index.yml validation file (see #1617) 141 // those tests are only relevant on machines where filesystems are case sensitive. 142 $b-> 143 post('/validation/index')-> 144 isStatusCode(200)-> 145 isRequestParameter('module', 'validation')-> 146 isRequestParameter('action', 'index')-> 147 isResponseHeader('X-Validated', 'ko') 148 ; 149 150 $b-> 151 post('/validation/Index')-> 152 isStatusCode(200)-> 153 isRequestParameter('module', 'validation')-> 154 isRequestParameter('action', 'Index')-> 155 isResponseHeader('X-Validated', 'ko') 156 ; 157 158 // needed to pass tests on case and non case sensitive machines 159 if (!file_exists(dirname(__FILE__).'/fixtures/apps/frontend/modules/validation/templates/IndexSuccess.php')) 160 { 161 $b->throwsException('sfRenderException'); 162 } 163 164 $b-> 165 post('/validation/INdex')-> 166 isStatusCode(404) 167 ; 168 169 $b-> 170 post('/validation/index2')-> 171 isStatusCode(200)-> 172 isRequestParameter('module', 'validation')-> 173 isRequestParameter('action', 'index2')-> 174 isResponseHeader('X-Validated', 'ko') 175 ; 176 177 if (!is_readable(dirname(__FILE__).'/fixtures/apps/frontend/modules/validation/templates/index2Success.php')) 178 { 179 $b->throwsException('sfRenderException'); 180 } 181 182 $b-> 183 post('/validation/Index2')-> 184 isStatusCode(200)-> 185 isRequestParameter('module', 'validation')-> 186 isRequestParameter('action', 'Index2')-> 187 isResponseHeader('X-Validated', 'ko') 188 ;