[pLog-svn] r3920 - plog/trunk/class/data/validator/rules
Oscar Renalias
oscar at renalias.net
Sun Sep 3 17:20:34 GMT 2006
Sorry, I just finished writing one (because we really needed it...)
But please have a look at other classes that might benefit from
having test cases and work on them, or improve some of the current ones.
On 3 Sep 2006, at 20:18, Mark Wu wrote:
> Sorry, busy in last several weeks .... But I think I can have time
> in this
> week. I will try to finish it as soon as I can.
>
> Mark
>
>> -----Original Message-----
>> From: plog-svn-bounces at devel.lifetype.net
>> [mailto:plog-svn-bounces at devel.lifetype.net] On Behalf Of
>> Oscar Renalias
>> Sent: Sunday, September 03, 2006 1:46 AM
>> To: plog-svn at devel.lifetype.net
>> Cc: /var/svn/plog at devel.lifetype.net; 3920 at devel.lifetype.net
>> Subject: Re: [pLog-svn] r3920 - plog/trunk/class/data/validator/rules
>>
>> Anybody up for some unit testing practice? :-)
>>
>> We should definitely write a test case for this case, as it
>> seems to be causing some trouble.
>>
>> On 29 Aug 2006, at 19:18, mark at devel.lifetype.net wrote:
>>
>>> Author: mark
>>> Date: 2006-08-29 16:18:33 +0000 (Tue, 29 Aug 2006) New
>> Revision: 3920
>>>
>>> Modified:
>>> plog/trunk/class/data/validator/rules/emailformatrule.class.php
>>> Log:
>>> Fixed a bug http://bugs.lifetype.net/view.php?id=1022.
>>>
>>> The original e-mail validator from PEAR, does not allow 163.com or
>>> 126.com. So, we have to tweak the original regexp to get it work.
>>>
>>> Still have no time write a e-mail unit test. :(
>>>
>>> Modified: plog/trunk/class/data/validator/rules/
>>> emailformatrule.class.php
>>> ===================================================================
>>> ---
>> plog/trunk/class/data/validator/rules/emailformatrule.cl
>> ass.php
>>> 2006-08-29 15:01:17 UTC (rev 3919)
>>> +++
>> plog/trunk/class/data/validator/rules/emailformatrule.cl
>> ass.php
>>> 2006-08-29 16:18:33 UTC (rev 3920)
>>> @@ -32,17 +32,17 @@
>>> */
>>> function validate($value)
>>> {
>>> -
>>> - // the base regexp for address
>>> - $regex = '&^(?:
>> #
>>> recipient:
>>> - ("\s*(?:[^"\f\n\r\t\v\b\s]+\s*)+")|
>>
>>> #1 quoted name
>>> -
>> ([-\w!\#\$%\&\'*+~/^`|{}]+(?:\.[-\w!\#\$%\&\'*+~/^`|{}]+)*))
>>> #2 OR dot-atom
>>> - @(((\[)? #3
>> domain, 4 as IPv4, 5
>>> optionally bracketed
>>> -
>> (?:(?:(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:[0-1]?[0-9]?[0-9]))\.){3}
>>> -
>> (?:(?:25[0-5])|(?:2[0-4][0-9])|(?:[0-1]?[0-9]?[0-9]))))(?(5)
>>> \])|
>>> -
>> ((?:[a-z0-9](?:[-a-z0-9]*[a-z0-9])?\.)*[a-z](?:[-a-z0-9]*[a-
>>> z0-9])?)) #6 domain as hostname
>>> - \.((?:[a-z]*[a-z])?) #7 ICANN domain names
>>> - $&xi';
>>> + // the base regexp for address
>>> + // I get these code from PEAR::Validate v0.64
>>> + $regex = '&^
>>> (?: # recipient:
>>> + ("\s*(?:[^"\f\n\r\t\v\b\s]+\s*)
>>> +")| #1 quoted name
>>> +
>> ([-\w!\#\$%\&\'*+~/^`|{}]+(?:\.[-\w!\#\$%\&\'*+~/^`|{}]+)
>>> *)) #2 OR dot-atom
>>> + @(((\[)? #3 domain, 4 as IPv4, 5
>>> optionally bracketed
>>> + (?:(?:(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:[0-1]?[0-9]?
>>> [0-9]))\.){3}
>>> + (?:(?:25[0-5])|(?:2[0-4][0-9])|(?:[0-1]?[0-9]?
>>> [0-9]))))(?(5)\])|
>>> + ((?:[a-z0-9](?:[-a-z0-9]*[a-z0-9])?\.)*[a-z0-9](?:[-a-
>>> z0-9]*[a-z0-9])?) #6 domain as hostname
>>> + \.((?:([^-])[-a-z]*[-a-z])?)) #7 ICANN domain names
>>> + $&xi';
>>>
>>> if( preg_match($regex, $value) ){
>>> $this->_setError(false);
>>>
>>> _______________________________________________
>>> pLog-svn mailing list
>>> pLog-svn at devel.lifetype.net
>>> http://devel.lifetype.net/mailman/listinfo/plog-svn
>>>
>>
>> _______________________________________________
>> pLog-svn mailing list
>> pLog-svn at devel.lifetype.net
>> http://devel.lifetype.net/mailman/listinfo/plog-svn
>
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://devel.lifetype.net/mailman/listinfo/plog-svn
>
More information about the pLog-svn
mailing list