]> granicus.if.org Git - php/commitdiff
new failing test for commitWrite()
authorGreg Beaver <cellog@php.net>
Sun, 28 Jan 2007 05:11:41 +0000 (05:11 +0000)
committerGreg Beaver <cellog@php.net>
Sun, 28 Jan 2007 05:11:41 +0000 (05:11 +0000)
ext/phar/tests/phar_commitwrite.phpt [new file with mode: 0644]

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