Annotation of embedaddon/php/ext/spl/tests/fileobject_003.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: SPL: SplFileInfo cloning
        !             3: --FILE--
        !             4: <?php
        !             5: 
        !             6: function test($name, $lc, $lp)
        !             7: {
        !             8:        static $i = 0;
        !             9:        echo "===$i===\n";
        !            10:        $i++;
        !            11: 
        !            12:        $o = new SplFileInfo($name);
        !            13: 
        !            14:        var_dump($o);
        !            15:        $c = clone $o;
        !            16:        var_dump($c);
        !            17:        var_dump($o === $c);
        !            18:        var_dump($o == $c);
        !            19:        var_dump($o->getPathname() == $c->getPathname());
        !            20:        
        !            21:        $f = new SplFileObject($name);
        !            22:        var_dump($name);
        !            23:        var_dump($f->getPathName());
        !            24:        $l = substr($f->getPathName(), -1);
        !            25:        var_dump($l != '/' && $l != '\\' && $l == $lc);
        !            26:        var_dump($f->getFileName());
        !            27:        $l = substr($f->getFileName(), -1);
        !            28:        var_dump($l != '/' && $l != '\\' && $l == $lc);
        !            29:        var_dump($f->getPath());
        !            30:        $l = substr($f->getPath(), -1);
        !            31:        var_dump($l != '/' && $l != '\\' && $l == $lp);
        !            32: 
        !            33:        $fo = $o->openFile();
        !            34:        var_dump($fo->getPathName(), $fo->getFileName(), $fo->getPath());
        !            35: }
        !            36: 
        !            37: test(dirname(__FILE__) . '/' . 'fileobject_001a.txt', 't', substr(dirname(__FILE__),-1));
        !            38: test(dirname(__FILE__) . '/', substr(dirname(__FILE__),-1), 'l');
        !            39: test(dirname(__FILE__),       substr(dirname(__FILE__),-1), 'l');
        !            40: 
        !            41: ?>
        !            42: ===DONE===
        !            43: <?php exit(0); ?>
        !            44: --EXPECTF--
        !            45: ===0===
        !            46: object(SplFileInfo)#%d (2) {
        !            47:   ["pathName":"SplFileInfo":private]=>
        !            48:   string(%d) "%s"
        !            49:   ["fileName":"SplFileInfo":private]=>
        !            50:   string(%d) "fileobject_001a.txt"
        !            51: }
        !            52: object(SplFileInfo)#%d (2) {
        !            53:   ["pathName":"SplFileInfo":private]=>
        !            54:   string(%d) "%s"
        !            55:   ["fileName":"SplFileInfo":private]=>
        !            56:   string(%d) "fileobject_001a.txt"
        !            57: }
        !            58: bool(false)
        !            59: bool(true)
        !            60: bool(true)
        !            61: %s(%d) "%sfileobject_001a.txt"
        !            62: string(%d) "%sfileobject_001a.txt"
        !            63: bool(true)
        !            64: string(19) "fileobject_001a.txt"
        !            65: bool(true)
        !            66: string(%d) "%stests"
        !            67: bool(true)
        !            68: string(%d) "%sfileobject_001a.txt"
        !            69: string(19) "fileobject_001a.txt"
        !            70: string(%d) "%stests"
        !            71: ===1===
        !            72: object(SplFileInfo)#%d (2) {
        !            73:   ["pathName":"SplFileInfo":private]=>
        !            74:   string(%d) "%s"
        !            75:   ["fileName":"SplFileInfo":private]=>
        !            76:   string(%d) "%s"
        !            77: }
        !            78: object(SplFileInfo)#%d (2) {
        !            79:   ["pathName":"SplFileInfo":private]=>
        !            80:   string(%d) "%s"
        !            81:   ["fileName":"SplFileInfo":private]=>
        !            82:   string(%d) "%s"
        !            83: }
        !            84: bool(false)
        !            85: bool(true)
        !            86: bool(true)
        !            87: %s(%d) "%stests/"
        !            88: string(%d) "%stests"
        !            89: bool(true)
        !            90: string(5) "tests"
        !            91: bool(true)
        !            92: string(%d) "%sspl"
        !            93: bool(true)
        !            94: string(%d) "%stests"
        !            95: string(%d) "tests"
        !            96: string(%d) "%sspl"
        !            97: ===2===
        !            98: object(SplFileInfo)#%d (2) {
        !            99:   ["pathName":"SplFileInfo":private]=>
        !           100:   string(%d) "%s"
        !           101:   ["fileName":"SplFileInfo":private]=>
        !           102:   string(%d) "%s"
        !           103: }
        !           104: object(SplFileInfo)#%d (2) {
        !           105:   ["pathName":"SplFileInfo":private]=>
        !           106:   string(%d) "%s"
        !           107:   ["fileName":"SplFileInfo":private]=>
        !           108:   string(%d) "%s"
        !           109: }
        !           110: bool(false)
        !           111: bool(true)
        !           112: bool(true)
        !           113: %s(%d) "%stests"
        !           114: string(%d) "%stests"
        !           115: bool(true)
        !           116: string(%d) "tests"
        !           117: bool(true)
        !           118: string(%d) "%sspl"
        !           119: bool(true)
        !           120: string(%d) "%stests"
        !           121: string(5) "tests"
        !           122: string(%d) "%sspl"
        !           123: ===DONE===

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