]> granicus.if.org Git - php/commitdiff
new test increases code coverage
authorGreg Beaver <cellog@php.net>
Sat, 26 Apr 2008 17:20:50 +0000 (17:20 +0000)
committerGreg Beaver <cellog@php.net>
Sat, 26 Apr 2008 17:20:50 +0000 (17:20 +0000)
ext/phar/tests/zip/exists_as_phar.phpt [new file with mode: 0644]

diff --git a/ext/phar/tests/zip/exists_as_phar.phpt b/ext/phar/tests/zip/exists_as_phar.phpt
new file mode 100644 (file)
index 0000000..d7e739c
--- /dev/null
@@ -0,0 +1,37 @@
+--TEST--
+Phar: phar-based phar named with ".zip" fails
+--SKIPIF--
+<?php if (!extension_loaded("phar")) die("skip"); ?>
+--INI--
+phar.readonly=0
+phar.require_hash=0
+--FILE--
+<?php
+
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar';
+$tname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.zip';
+$alias = 'phar://hio';
+
+$phar = new Phar($fname);
+$phar['a.php'] = '<?php echo "This is a\n"; include "'.$alias.'/b.php"; ?>';
+$phar->setAlias('hio');
+$phar->addEmptyDir('test');
+$phar->stopBuffering();
+copy($fname, $tname);
+
+try {
+       $p = new Phar($tname);
+} catch (Exception $e) {
+       echo $e->getMessage() . "\n";
+}
+
+?>
+===DONE===
+--CLEAN--
+<?php
+unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.zip');
+unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar');
+?>
+--EXPECTF--
+phar zip error: phar "%sexists_as_phar.phar.zip" already exists as a regular phar and must be deleted from disk prior to creating as a zip-based phar
+===DONE===