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

1.1     ! misho       1: --TEST--
        !             2: Phar: addFile/addFromString
        !             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.php';
        !            10: $pname = 'phar://' . $fname;
        !            11: $phar = new Phar($fname);
        !            12: $phar->addFromString('a', 'hi');
        !            13: echo file_get_contents($pname . '/a') . "\n";
        !            14: $phar->addFile($pname . '/a', 'b');
        !            15: echo file_get_contents($pname . '/b') . "\n";
        !            16: try {
        !            17: $phar->addFile($pname . '/a');
        !            18: } catch (Exception $e) {
        !            19: echo $e->getMessage() . "\n";
        !            20: }
        !            21: try {
        !            22: $phar->addFile($pname . '/a', 'a');
        !            23: } catch (Exception $e) {
        !            24: echo $e->getMessage() . "\n";
        !            25: }
        !            26: try {
        !            27: $phar->addFile(dirname(__FILE__) . '/does/not/exist');
        !            28: } catch (Exception $e) {
        !            29: echo $e->getMessage() . "\n";
        !            30: }
        !            31: try {
        !            32: $phar->addFile($pname . '/a', '.phar/stub.php');
        !            33: } catch (Exception $e) {
        !            34: echo $e->getMessage() . "\n";
        !            35: }
        !            36: try {
        !            37: $phar->addFromString('.phar/stub.php', 'hi');
        !            38: } catch (Exception $e) {
        !            39: echo $e->getMessage() . "\n";
        !            40: }
        !            41: ?>
        !            42: ===DONE===
        !            43: --CLEAN--
        !            44: <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
        !            45: --EXPECTF--
        !            46: hi
        !            47: hi
        !            48: Entry phar://%saddfuncs.phar.php/a does not exist and cannot be created: phar error: invalid path "phar://%saddfuncs.phar.php/a" contains double slash
        !            49: Entry a does not exist and cannot be created: phar error: file "a" in phar "%saddfuncs.phar.php" cannot be opened for writing, readable file pointers are open
        !            50: phar error: unable to open file "%s/does/not/exist" to add to phar archive
        !            51: Cannot create any files in magic ".phar" directory
        !            52: Cannot create any files in magic ".phar" directory
        !            53: ===DONE===

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