Annotation of embedaddon/php/ext/phar/tests/pharfileinfo_setmetadata.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Phar: PharFileInfo::setMetadata/delMetadata extra code coverage
        !             3: --SKIPIF--
        !             4: <?php if (!extension_loaded("phar")) die("skip"); ?>
        !             5: --INI--
        !             6: phar.readonly=0
        !             7: --FILE--
        !             8: <?php
        !             9: $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar';
        !            10: $pname = 'phar://' . $fname;
        !            11: 
        !            12: $phar = new Phar($fname);
        !            13: 
        !            14: $phar['a/b'] = 'hi there';
        !            15: $tar = $phar->convertToData(Phar::TAR);
        !            16: 
        !            17: $b = $phar['a/b'];
        !            18: try {
        !            19: $phar['a']->setMetadata('hi');
        !            20: } catch (Exception $e) {
        !            21: echo $e->getMessage(), "\n";
        !            22: }
        !            23: try {
        !            24: $phar['a']->delMetadata();
        !            25: } catch (Exception $e) {
        !            26: echo $e->getMessage(), "\n";
        !            27: }
        !            28: ini_set('phar.readonly', 1);
        !            29: try {
        !            30: $b->setMetadata('hi');
        !            31: } catch (Exception $e) {
        !            32: echo $e->getMessage(), "\n";
        !            33: }
        !            34: try {
        !            35: $b->delMetadata();
        !            36: } catch (Exception $e) {
        !            37: echo $e->getMessage(), "\n";
        !            38: }
        !            39: ini_set('phar.readonly', 0);
        !            40: $b->setMetadata(1,2,3);
        !            41: ?>
        !            42: ===DONE===
        !            43: --CLEAN--
        !            44: <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar'); ?>
        !            45: <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.tar'); ?>
        !            46: --EXPECTF--
        !            47: Phar entry is a temporary directory (not an actual entry in the archive), cannot set metadata
        !            48: Phar entry is a temporary directory (not an actual entry in the archive), cannot delete metadata
        !            49: Write operations disabled by the php.ini setting phar.readonly
        !            50: Write operations disabled by the php.ini setting phar.readonly
        !            51: 
        !            52: Warning: PharFileInfo::setMetadata() expects exactly 1 parameter, 3 given in %spharfileinfo_setmetadata.php on line %d
        !            53: ===DONE===

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