Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Validate Punycoded TLDs #67

Merged
merged 4 commits into from
May 12, 2016
Merged

Conversation

BreyndotEchse
Copy link
Contributor

Method isValid must return true for IDN top level domains.

{
$validator = new Hostname(Hostname::ALLOW_ALL);
// Check UTF-8 TLD matching
$valuesExpected = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please refactor using data providers.

Also split the test in two tests, one when is valid and another one when is not

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When refactor please add a description for each case using the key of the array

['invalid foo' => 'xn--3-owe4au9mpa.xn--xkc2al3hye2a']

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only for testAdditionalPunycodedTLDs or also for testAdditionalUTF8TLDs (merged)?

Example dataProvider (valid hostnames):

public function validTLDHostnames()
{
    // @codingStandardsIgnoreStart
    return [
        'test123.онлайн' => 'test123.онлайн',
        'test123.онлайн' => 'test123.xn--80asehdb',
        'тест.рф'        => 'тест.рф',
        'тест.рф'        => 'xn--e1aybc.xn--p1ai',
        'туршилтын.мон'  => 'туршилтын.мон',
        'туршилтын.мон'  => 'xn--h1aggjjdd5b4a.xn--l1acc',
    ];
    // @codingStandardsIgnoreEnd
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll appreciate if you can do it testAdditionalUTF8TLDs as well.

What I miss with the descriptions I don't quickly understand why that case is significative.

return [
        'UTF8 TLD' => 'test123.онлайн',
        'Punyencoded TLD' => 'test123.xn--80asehdb',
...
    ];

@weierophinney weierophinney added this to the 2.7.3 milestone May 12, 2016
@weierophinney weierophinney self-assigned this May 12, 2016
weierophinney added a commit that referenced this pull request May 12, 2016
@weierophinney weierophinney merged commit 6e43a59 into zendframework:master May 12, 2016
weierophinney added a commit that referenced this pull request May 12, 2016
weierophinney added a commit that referenced this pull request May 12, 2016
weierophinney added a commit that referenced this pull request May 12, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants