Changeset 7594
- Timestamp:
- 02/24/08 00:38:36 (2 years ago)
- Files:
-
- branches/dwhittle/1.0/lib/cache/sfProcessCache.class.php (modified) (1 diff)
- branches/dwhittle/1.0/lib/debug/sfWebDebug.class.php (modified) (2 diffs)
- branches/dwhittle/1.0/lib/validator/sfNumberValidator.class.php (modified) (1 diff)
- branches/dwhittle/1.0/test/unit/validator/sfNumberValidatorTest.php (modified) (2 diffs)
- branches/dwhittle/1.1/lib/debug/sfWebDebug.class.php (modified) (1 diff)
- branches/dwhittle/1.1/lib/plugins/sfCompat10Plugin/lib/validator/sfNumberValidator.class.php (modified) (1 diff)
- branches/dwhittle/1.1/lib/plugins/sfCompat10Plugin/test/unit/validator/sfNumberValidatorTest.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/dwhittle/1.0/lib/cache/sfProcessCache.class.php
r6598 r7594 79 79 * @param string The key name 80 80 * @param string The content to put in cache 81 * @param int The life time to keep the content in the cache 81 * @param int The life time to keep the content in the cache in seconds 82 82 * 83 83 * @return boolean true if ok branches/dwhittle/1.0/lib/debug/sfWebDebug.class.php
r7490 r7594 224 224 225 225 ++$line_nb; 226 $logs .= sprintf("<tr class='sfWebDebugLogLine sfWebDebug%s %s'><td class=\"sfWebDebugLogNumber\">%s</td><td class=\"sfWebDebugLogType\">%s %s</td><td>%s%s</td></tr>\n", 226 $logs .= sprintf("<tr class='sfWebDebugLogLine sfWebDebug%s %s'><td class=\"sfWebDebugLogNumber\">%s</td><td class=\"sfWebDebugLogType\">%s %s</td><td>%s%s</td></tr>\n", 227 227 ucfirst($priority), 228 228 $logEntry['type'], … … 432 432 <div id="main_'.$id.'" class="sfWebDebugActionCache" style="border: 1px solid #f00"> 433 433 <div id="sub_main_'.$id.'" class="sfWebDebugCache" style="background-color: '.$bg_color.'; border-right: 1px solid #f00; border-bottom: 1px solid #f00;"> 434 <div style="height: 16px; padding: 2px"><a href="#" onclick="sfWebDebugToggle(\' '.$id.'\'); return false;"><strong>cache information</strong></a> <a href="#" onclick="sfWebDebugToggle(\'sub_main_'.$id.'\'); document.getElementById(\'main_'.$id.'\').style.border = \'none\'; return false;">'.image_tag(sfConfig::get('sf_web_debug_web_dir').'/images/close.png').'</a> </div>435 <div style="padding: 2px; display: none" id=" '.$id.'">436 [uri] '. $internalUri.'<br />434 <div style="height: 16px; padding: 2px"><a href="#" onclick="sfWebDebugToggle(\'sub_main_info_'.$id.'\'); return false;"><strong>cache information</strong></a> <a href="#" onclick="sfWebDebugToggle(\'sub_main_'.$id.'\'); document.getElementById(\'main_'.$id.'\').style.border = \'none\'; return false;">'.image_tag(sfConfig::get('sf_web_debug_web_dir').'/images/close.png').'</a> </div> 435 <div style="padding: 2px; display: none" id="sub_main_info_'.$id.'"> 436 [uri] '.htmlentities($internalUri, ENT_QUOTES, sfConfig::get('sf_charset')).'<br /> 437 437 [life time] '.$cache->getLifeTime($internalUri).' seconds<br /> 438 438 [last modified] '.(time() - $last_modified).' seconds<br /> branches/dwhittle/1.0/lib/validator/sfNumberValidator.class.php
r6598 r7594 46 46 public function execute(&$value, &$error) 47 47 { 48 if (! is_numeric($value))48 if (!preg_match('/^\d+(\.\d+)?$/', $value)) 49 49 { 50 50 // it's NaN, what nerve! branches/dwhittle/1.0/test/unit/validator/sfNumberValidatorTest.php
r6598 r7594 13 13 require_once($_test_dir.'/unit/sfValidatorTestHelper.class.php'); 14 14 15 $t = new lime_test( 49, new lime_output_color());15 $t = new lime_test(51, new lime_output_color()); 16 16 17 17 $context = new sfContext(); … … 25 25 $t->ok($v->execute($number, $error), '->execute() returns true if you don\'t define any parameter'); 26 26 27 $number = 'not a number'; 28 $error = null; 29 $t->ok(!$v->execute($number, $error), '->execute() returns "nan_error" if value is not a number'); 30 $t->is($error, 'Input is not a number', '->execute() changes "$error" with a default message if it returns false'); 27 foreach (array('not a number', '0xFE') as $number) 28 { 29 $error = null; 30 $t->ok(!$v->execute($number, $error), '->execute() returns "nan_error" if value is not a number'); 31 $t->is($error, 'Input is not a number', '->execute() changes "$error" with a default message if it returns false'); 32 } 31 33 32 34 foreach (array('any', 'decimal', 'float', 'int', 'integer') as $type) branches/dwhittle/1.1/lib/debug/sfWebDebug.class.php
r7548 r7594 388 388 <div id="main_'.$id.'" class="sfWebDebugActionCache" style="border: 1px solid #f00"> 389 389 <div id="sub_main_'.$id.'" class="sfWebDebugCache" style="background-color: '.$bgColor.'; border-right: 1px solid #f00; border-bottom: 1px solid #f00;"> 390 <div style="height: 16px; padding: 2px"><a href="#" onclick="sfWebDebugToggle(\' '.$id.'\'); return false;"><strong>cache information</strong></a> <a href="#" onclick="sfWebDebugToggle(\'sub_main_'.$id.'\'); document.getElementById(\'main_'.$id.'\').style.border = \'none\'; return false;">'.image_tag(sfConfig::get('sf_web_debug_web_dir').'/images/close.png').'</a> </div>391 <div style="padding: 2px; display: none" id=" '.$id.'">390 <div style="height: 16px; padding: 2px"><a href="#" onclick="sfWebDebugToggle(\'sub_main_info_'.$id.'\'); return false;"><strong>cache information</strong></a> <a href="#" onclick="sfWebDebugToggle(\'sub_main_'.$id.'\'); document.getElementById(\'main_'.$id.'\').style.border = \'none\'; return false;">'.image_tag(sfConfig::get('sf_web_debug_web_dir').'/images/close.png').'</a> </div> 391 <div style="padding: 2px; display: none" id="sub_main_info_'.$id.'"> 392 392 [uri] '.htmlentities($internalUri, ENT_QUOTES, sfConfig::get('sf_charset')).'<br /> 393 393 [life time] '.$cache->getLifeTime($internalUri).' seconds<br /> branches/dwhittle/1.1/lib/plugins/sfCompat10Plugin/lib/validator/sfNumberValidator.class.php
r5386 r7594 46 46 public function execute(&$value, &$error) 47 47 { 48 if (! is_numeric($value))48 if (!preg_match('/^\d+(\.\d+)?$/', $value)) 49 49 { 50 50 // it's NaN, what nerve! branches/dwhittle/1.1/lib/plugins/sfCompat10Plugin/test/unit/validator/sfNumberValidatorTest.php
r5386 r7594 13 13 require_once(dirname(__FILE__).'/sfValidatorTestHelper.class.php'); 14 14 15 $t = new lime_test( 49, new lime_output_color());15 $t = new lime_test(51, new lime_output_color()); 16 16 17 17 $context = sfContext::getInstance(); … … 24 24 $t->ok($v->execute($number, $error), '->execute() returns true if you don\'t define any parameter'); 25 25 26 $number = 'not a number'; 27 $error = null; 28 $t->ok(!$v->execute($number, $error), '->execute() returns "nan_error" if value is not a number'); 29 $t->is($error, 'Input is not a number', '->execute() changes "$error" with a default message if it returns false'); 26 foreach (array('not a number', '0xFE') as $number) 27 { 28 $error = null; 29 $t->ok(!$v->execute($number, $error), '->execute() returns "nan_error" if value is not a number'); 30 $t->is($error, 'Input is not a number', '->execute() changes "$error" with a default message if it returns false'); 31 } 30 32 31 33 foreach (array('any', 'decimal', 'float', 'int', 'integer') as $type)

