1--TEST-- 2Phar::setAlias() zip-based 3--SKIPIF-- 4<?php if (!extension_loaded("phar")) die("skip"); ?> 5<?php if (!extension_loaded("zlib")) die("skip no zlib"); ?> 6<?php if (!extension_loaded("bz2")) die("skip no bz2"); ?> 7--INI-- 8phar.require_hash=0 9phar.readonly=0 10--FILE-- 11<?php 12 13$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.zip'; 14$fname2 = __DIR__ . '/' . basename(__FILE__, '.php') . '2.phar.zip'; 15$fname3 = __DIR__ . '/' . basename(__FILE__, '.php') . '3.phar.zip'; 16 17$phar = new Phar($fname); 18$phar->setStub('<?php echo "first stub\n"; __HALT_COMPILER(); ?>'); 19$phar->setAlias('hio'); 20 21$files = array(); 22 23$files['a'] = 'a'; 24$files['b'] = 'b'; 25$files['c'] = 'c'; 26 27foreach ($files as $n => $file) { 28 $phar[$n] = $file; 29} 30$phar->stopBuffering(); 31 32echo $phar->getAlias() . "\n"; 33$phar->setAlias('test'); 34echo $phar->getAlias() . "\n"; 35 36// test compression 37 38$phar->compressFiles(Phar::GZ); 39copy($fname, $fname2); 40$phar->setAlias('unused'); 41$p2 = new Phar($fname2); 42echo $p2->getAlias(), "\n"; 43$p2->compressFiles(Phar::BZ2); 44copy($fname2, $fname3); 45$p2->setAlias('unused2'); 46$p3 = new Phar($fname3); 47echo $p3->getAlias(), "\n"; 48?> 49--CLEAN-- 50<?php 51unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip'); 52unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '2.phar.zip'); 53unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '3.phar.zip'); 54__HALT_COMPILER(); 55?> 56--EXPECT-- 57hio 58test 59test 60test 61