Annotation of embedaddon/php/ext/phar/tests/zip/033.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Phar::chmod zip-based
                      3: --SKIPIF--
                      4: <?php if (!extension_loaded("phar")) die("skip"); ?>
                      5: --INI--
                      6: phar.readonly=0
                      7: phar.require_hash=0
                      8: --FILE--
                      9: <?php
                     10: 
                     11: $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.zip';
                     12: $fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.phar.zip';
                     13: $alias = 'phar://hio';
                     14: 
                     15: $phar = new Phar($fname);
                     16: $phar['a.php'] = '<?php echo "This is a\n"; include "'.$alias.'/b.php"; ?>';
                     17: $phar->setAlias('hio');
                     18: $phar->addEmptyDir('test');
                     19: $phar->stopBuffering();
                     20: 
                     21: try {
                     22:        var_dump($phar['a.php']->isExecutable());
                     23:        $phar['a.php']->chmod(0777);
                     24:        copy($fname, $fname2);
                     25:        $phar->setAlias('unused');
                     26:        $phar2 = new Phar($fname2);
                     27:        var_dump($phar2['a.php']->isExecutable());
                     28:        $phar['a.php']->chmod(0666);
                     29:        var_dump($phar['a.php']->isExecutable());
                     30:        echo "test dir\n";
                     31:        var_dump($phar['test']->isDir());
                     32:        var_dump($phar['test']->isReadable());
                     33:        $phar['test']->chmod(0000);
                     34:        var_dump($phar['test']->isReadable());
                     35:        $phar['test']->chmod(0666);
                     36:        var_dump($phar['test']->isReadable());
                     37: } catch (Exception $e) {
                     38:        echo $e->getMessage() . "\n";
                     39: }
                     40: ?>
                     41: ===DONE===
                     42: --CLEAN--
                     43: <?php
                     44: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.zip');
                     45: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.2.phar.zip');
                     46: ?>
                     47: --EXPECT--
                     48: bool(false)
                     49: bool(true)
                     50: bool(false)
                     51: test dir
                     52: bool(true)
                     53: bool(true)
                     54: bool(false)
                     55: bool(true)
                     56: ===DONE===

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