[dev] [commits] Horde branch develop updated. 2cd26a26e02a3c15e50c6a7bbf2f59397288f9bf

Michael M Slusarz slusarz at horde.org
Wed Aug 29 14:58:47 UTC 2012


Quoting Jan Schneider <jan at horde.org>:

> Zitat von Michael M Slusarz <slusarz at horde.org>:
>
>> Quoting Jan Schneider <jan at horde.org>:
>>
>>> Zitat von Michael M Slusarz <slusarz at horde.org>:
>>>
>>>> Quoting Jan Schneider <jan at horde.org>:
>>>>
>>>>> commit a1d6e4df3fed121da78ca4a55a7131ac156785f8
>>>>> Author: Jan Schneider <jan at horde.org>
>>>>> Date:   Tue Aug 28 23:54:10 2012 +0200
>>>>>
>>>>> This won't work with some TLDs. Add failing test.
>>>>>
>>>>> framework/Mail/test/Horde/Mail/AddressTest.php |   14 +++++++++++++-
>>>>> 1 files changed, 13 insertions(+), 1 deletions(-)
>>>>>
>>>>> http://git.horde.org/horde-git/-/commit/a1d6e4df3fed121da78ca4a55a7131ac156785f8
>>>>
>>>> Your tests are incorrect.  The documentation clearly states that  
>>>> base_domain returns the TLD + 1 subdomain level only.
>>>>
>>>> Your tests indicate that base_domain may be of dubious (or no)  
>>>> usefulness.  But it is not a failing test.
>>>
>>> The documentation might say that, but that's not what the property  
>>> or method name that you used in the latest revision implies. And  
>>> it's useless for the purpose you made this for.
>>
>> As (hopefully) was eventually seen, this was already replaced by  
>> the matchDomain() method.
>
> That's what I meant with "method name". It still doesn't work as  
> expected, e.g. with co.uk domains.

Sure it does.  There's not an explicit 'co.uk' test in the unit tests,  
but I can verify that this works:

$address = new Horde_Mail_Rfc822_Address('Test <test at foo.test.co.uk>');
$this->assertTrue($address->matchDomain('test.co.uk'));

This is correct given the method description of matchDomain():

     /**
      * Do a case-insensitive match on the address for a given domain.
      * Matches as many parts of the subdomain in the address as is given in
      * the input.
      *
      * @param string $domain  Domain to match.
      *
      * @return boolean  True if the address matches the given domain.
      */

The address is test at foo.test.co.uk.  This is address is in the domain  
'test.co.uk'.  So matchDomain() should (and does) return true.

michael

___________________________________
Michael Slusarz [slusarz at horde.org]



More information about the dev mailing list