]> granicus.if.org Git - php/commitdiff
new test for creation of phar in current directory
authorGreg Beaver <cellog@php.net>
Sun, 28 Jan 2007 21:47:29 +0000 (21:47 +0000)
committerGreg Beaver <cellog@php.net>
Sun, 28 Jan 2007 21:47:29 +0000 (21:47 +0000)
ext/phar/tests/phar_create_in_cwd.phpt [new file with mode: 0644]

diff --git a/ext/phar/tests/phar_create_in_cwd.phpt b/ext/phar/tests/phar_create_in_cwd.phpt
new file mode 100644 (file)
index 0000000..8545880
--- /dev/null
@@ -0,0 +1,41 @@
+--TEST--
+Phar: create a Phar with relative path
+--SKIPIF--
+<?php if (!extension_loaded("phar")) print "skip"; ?>
+--INI--
+phar.require_hash=0
+phar.readonly=0
+--FILE--
+<?php
+$p = new Phar('brandnewphar.phar');
+$p['file1.txt'] = 'hi';
+$p->commit();
+var_dump($p->getStub());
+$p->commit("<?php
+function __autoload(\$class)
+{
+    include 'phar://' . str_replace('_', '/', \$class);
+}
+Phar::mapPhar('brandnewphar.phar');
+include 'phar://brandnewphar.phar/startup.php';
+__HALT_COMPILER();
+?>");
+var_dump($p->getStub());
+?>
+===DONE===
+--CLEAN--
+<?php 
+unlink(dirname(__FILE__) . '/brandnewphar.phar');
+?>
+--EXPECT--
+string(24) "<?php __HALT_COMPILER();"
+string(198) "<?php
+function __autoload($class)
+{
+    include 'phar://' . str_replace('_', '/', $class);
+}
+Phar::mapPhar('brandnewphar.phar');
+include 'phar://brandnewphar.phar/startup.php';
+__HALT_COMPILER();
+?>"
+===DONE===
\ No newline at end of file