[limb-svn] r6396 - in 3.x/trunk/limb/validation: src/rule tests/cases/rule

svn at limb-project.com svn at limb-project.com
Mon Oct 8 17:13:58 MSD 2007


Author: 3dmax
Date: 2007-10-08 17:13:58 +0400 (Mon, 08 Oct 2007)
New Revision: 6396
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6396

Modified:
   3.x/trunk/limb/validation/src/rule/lmbEmailRule.class.php
   3.x/trunk/limb/validation/tests/cases/rule/lmbEmailRuleTest.class.php
Log:
-- email validation rule improved

Modified: 3.x/trunk/limb/validation/src/rule/lmbEmailRule.class.php
===================================================================
--- 3.x/trunk/limb/validation/src/rule/lmbEmailRule.class.php	2007-10-08 07:01:46 UTC (rev 6395)
+++ 3.x/trunk/limb/validation/src/rule/lmbEmailRule.class.php	2007-10-08 13:13:58 UTC (rev 6396)
@@ -2,9 +2,9 @@
 /*
  * Limb PHP Framework
  *
- * @link http://limb-project.com 
+ * @link http://limb-project.com
  * @copyright  Copyright © 2004-2007 BIT(http://bit-creative.com)
- * @license    LGPL http://www.gnu.org/copyleft/lesser.html 
+ * @license    LGPL http://www.gnu.org/copyleft/lesser.html
  */
 lmb_require('limb/validation/src/rule/lmbDomainRule.class.php');
 
@@ -29,7 +29,7 @@
 
   protected function _checkUser($value)
   {
-    if (!preg_match('/^[a-z0-9]+([_.-][a-z0-9]+)*$/i', $value))
+    if (!preg_match('/^[a-z0-9]+([_.-][a-z0-9]+|[_])*$/i', $value))
         $this->error('Invalid user in {Field}.');
   }
 

Modified: 3.x/trunk/limb/validation/tests/cases/rule/lmbEmailRuleTest.class.php
===================================================================
--- 3.x/trunk/limb/validation/tests/cases/rule/lmbEmailRuleTest.class.php	2007-10-08 07:01:46 UTC (rev 6395)
+++ 3.x/trunk/limb/validation/tests/cases/rule/lmbEmailRuleTest.class.php	2007-10-08 13:13:58 UTC (rev 6396)
@@ -2,9 +2,9 @@
 /*
  * Limb PHP Framework
  *
- * @link http://limb-project.com 
+ * @link http://limb-project.com
  * @copyright  Copyright © 2004-2007 BIT(http://bit-creative.com)
- * @license    LGPL http://www.gnu.org/copyleft/lesser.html 
+ * @license    LGPL http://www.gnu.org/copyleft/lesser.html
  */
 require_once(dirname(__FILE__) . '/lmbValidationRuleTestCase.class.php');
 lmb_require('limb/validation/src/rule/lmbEmailRule.class.php');
@@ -91,6 +91,18 @@
 
     $rule->validate($dataspace, $this->error_list);
   }
+
+  function testEmailRuleUnderscoreBeforeAt()
+  {
+    $rule = new lmbEmailRule('testfield');
+
+    $dataspace = new lmbSet();
+    $dataspace->set('testfield', 'bill_gates_ at microsoft.com');
+
+    $this->error_list->expectNever('addError');
+
+    $rule->validate($dataspace, $this->error_list);
+  }
 }
 
 



More information about the limb-svn mailing list