From: Greg Beaver Date: Sat, 26 Apr 2008 17:47:31 +0000 (+0000) Subject: new test/updated test to ensure stub integrity (I was wrong, zip is fine) X-Git-Tag: RELEASE_2_0_0b1~186 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5b85b2074bdab472429802928545e6473503334a;p=php new test/updated test to ensure stub integrity (I was wrong, zip is fine) --- diff --git a/ext/phar/tests/tar/phar_stub.phpt b/ext/phar/tests/tar/phar_stub.phpt index e42038fd01..e0d728f6f8 100644 --- a/ext/phar/tests/tar/phar_stub.phpt +++ b/ext/phar/tests/tar/phar_stub.phpt @@ -53,6 +53,9 @@ $phar->setStub($fp, strlen($file)); fclose($fp); echo $phar->getStub(); +$phar['testing'] = 'hi'; + +echo $phar->getStub(); ?> ===DONE=== --CLEAN-- @@ -68,4 +71,5 @@ __HALT_COMPILER(); booya + ===DONE=== diff --git a/ext/phar/tests/zip/phar_stub.phpt b/ext/phar/tests/zip/phar_stub.phpt new file mode 100644 index 0000000000..a2a6aa6f2a --- /dev/null +++ b/ext/phar/tests/zip/phar_stub.phpt @@ -0,0 +1,75 @@ +--TEST-- +Phar::setStub() (zip-based) +--SKIPIF-- + +--INI-- +phar.require_hash=0 +phar.readonly=0 +--FILE-- +setStub(''); +$p['a'] = 'a'; +$p['b'] = 'b'; +$p['c'] = 'c'; +copy($fname2, $fname); + +$phar = new Phar($fname); +echo $phar->getStub(); + +$file = ''; + +//// 2 +$phar->setStub($file); +echo $phar->getStub(); + +$fname3 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phartmp.php'; +$file = ''; +$fp = fopen($fname3, 'wb'); +fwrite($fp, $file); +fclose($fp); +$fp = fopen($fname3, 'rb'); + +//// 3 +$phar->setStub($fp); +fclose($fp); + +echo $phar->getStub(); + +$fp = fopen($fname3, 'ab'); +fwrite($fp, 'booya'); +fclose($fp); +echo file_get_contents($fname3) . "\n"; + +$fp = fopen($fname3, 'rb'); + +//// 4 +$phar->setStub($fp, strlen($file)); +fclose($fp); +echo $phar->getStub(); + +$phar['testing'] = 'hi'; + +echo $phar->getStub(); +?> +===DONE=== +--CLEAN-- + +--EXPECT-- + + + +booya + + +===DONE===