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

1.1     ! misho       1: --TEST--
        !             2: SPL: SplFileObject truncate tests
        !             3: --CREDITS--
        !             4: Mark Ammann
        !             5: #Hackday Webtuesday 2008-05-24
        !             6: --FILE--
        !             7: <?php
        !             8: 
        !             9: set_include_path(dirname(dirname(__FILE__)));
        !            10: 
        !            11: $path = dirname(__FILE__).DIRECTORY_SEPARATOR.'fileobject_005.txt';
        !            12: touch($path);
        !            13: 
        !            14: $fo = new SplFileObject('tests'.DIRECTORY_SEPARATOR.'fileobject_005.txt', 'w+', true);
        !            15: $fo->fwrite("blahlubba");
        !            16: var_dump($fo->ftruncate(4));
        !            17: 
        !            18: $fo->rewind();
        !            19: var_dump($fo->fgets(8));
        !            20: 
        !            21: $fo->rewind();
        !            22: $fo->fwrite("blahlubba");
        !            23: 
        !            24: // This should throw a warning and return NULL since an argument is missing 
        !            25: var_dump($fo->ftruncate());
        !            26: 
        !            27: ?>
        !            28: ==DONE==
        !            29: --CLEAN--
        !            30: <?php
        !            31: $path = dirname(__FILE__).DIRECTORY_SEPARATOR.'fileobject_005.txt';
        !            32: unlink($path);
        !            33: ?>
        !            34: --EXPECTF--
        !            35: bool(true)
        !            36: 
        !            37: Warning: SplFileObject::fgets() expects exactly 0 parameters, 1 given in %s on line %d
        !            38: NULL
        !            39: 
        !            40: Warning: SplFileObject::ftruncate() expects exactly 1 parameter, 0 given in %s on line %d
        !            41: NULL
        !            42: ==DONE==

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