Annotation of embedaddon/php/ext/intl/tests/idn_uts46_basic.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: IDN UTS #46 API basic tests
        !             3: --SKIPIF--
        !             4: <?php
        !             5:        if (!extension_loaded('intl'))
        !             6:                die('skip');
        !             7:        if (!defined('INTL_IDNA_VARIANT_UTS46'))
        !             8:                die('skip no UTS #46 API');
        !             9: --FILE--
        !            10: <?php
        !            11: $utf8dn = "www.fußball.com";
        !            12: $asciiNonTrans = "www.xn--fuball-cta.com";
        !            13: 
        !            14: echo "all ok, no details:", "\n";
        !            15: var_dump(idn_to_ascii($utf8dn, 
        !            16:        IDNA_NONTRANSITIONAL_TO_ASCII, INTL_IDNA_VARIANT_UTS46));
        !            17:        
        !            18: echo "all ok, no details, transitional:", "\n";
        !            19: var_dump(idn_to_ascii($utf8dn, 0, INTL_IDNA_VARIANT_UTS46));
        !            20: 
        !            21: echo "all ok, with details:", "\n";
        !            22: var_dump(idn_to_ascii($utf8dn, IDNA_NONTRANSITIONAL_TO_ASCII,
        !            23:        INTL_IDNA_VARIANT_UTS46, $info));
        !            24: var_dump($info);
        !            25: 
        !            26: echo "reverse, ok, with details:", "\n";
        !            27: var_dump(idn_to_utf8($asciiNonTrans, 0, INTL_IDNA_VARIANT_UTS46, $info));
        !            28: var_dump($info);
        !            29: --EXPECT--
        !            30: all ok, no details:
        !            31: string(22) "www.xn--fuball-cta.com"
        !            32: all ok, no details, transitional:
        !            33: string(16) "www.fussball.com"
        !            34: all ok, with details:
        !            35: string(22) "www.xn--fuball-cta.com"
        !            36: array(3) {
        !            37:   ["result"]=>
        !            38:   string(22) "www.xn--fuball-cta.com"
        !            39:   ["isTransitionalDifferent"]=>
        !            40:   bool(true)
        !            41:   ["errors"]=>
        !            42:   int(0)
        !            43: }
        !            44: reverse, ok, with details:
        !            45: string(16) "www.fußball.com"
        !            46: array(3) {
        !            47:   ["result"]=>
        !            48:   string(16) "www.fußball.com"
        !            49:   ["isTransitionalDifferent"]=>
        !            50:   bool(false)
        !            51:   ["errors"]=>
        !            52:   int(0)
        !            53: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>