2007-08-23 23:23:26 +00:00
|
|
|
--TEST--
|
|
|
|
Phar::setAlias() error
|
|
|
|
--SKIPIF--
|
2008-01-04 16:26:44 +00:00
|
|
|
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
2007-08-23 23:23:26 +00:00
|
|
|
--INI--
|
|
|
|
phar.require_hash=0
|
|
|
|
phar.readonly=0
|
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
|
|
|
|
$pname = 'phar://' . $fname;
|
|
|
|
$file = '<?php echo "first stub\n"; __HALT_COMPILER(); ?>';
|
|
|
|
|
|
|
|
$files = array();
|
|
|
|
$files['a'] = 'a';
|
|
|
|
$files['b'] = 'b';
|
|
|
|
$files['c'] = 'c';
|
|
|
|
|
2008-02-20 13:11:40 +00:00
|
|
|
include 'files/phar_test.inc';
|
2007-08-23 23:23:26 +00:00
|
|
|
|
|
|
|
$phar = new Phar($fname);
|
|
|
|
echo $phar->getAlias() . "\n";
|
|
|
|
$phar->setAlias('test');
|
|
|
|
echo $phar->getAlias() . "\n";
|
2008-05-06 21:14:53 +00:00
|
|
|
$b = $phar;
|
2007-08-23 23:23:26 +00:00
|
|
|
$phar = new Phar(dirname(__FILE__) . '/notphar.phar');
|
|
|
|
try {
|
|
|
|
$phar->setAlias('test');
|
|
|
|
} catch (Exception $e) {
|
|
|
|
echo $e->getMessage() . "\n";
|
|
|
|
}
|
2008-04-16 03:42:29 +00:00
|
|
|
try {
|
|
|
|
$b = new Phar(dirname(__FILE__) . '/nope.phar', 0, 'test');
|
|
|
|
} catch (Exception $e) {
|
|
|
|
echo $e->getMessage() . "\n";
|
|
|
|
}
|
2007-08-23 23:23:26 +00:00
|
|
|
?>
|
|
|
|
===DONE===
|
|
|
|
--CLEAN--
|
|
|
|
<?php
|
|
|
|
unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
|
|
|
|
unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phartmp.php');
|
2008-01-28 08:52:08 +00:00
|
|
|
unlink(dirname(__FILE__) . '/notphar.phar');
|
2007-08-23 23:23:26 +00:00
|
|
|
__HALT_COMPILER();
|
|
|
|
?>
|
|
|
|
--EXPECTF--
|
|
|
|
hio
|
|
|
|
test
|
|
|
|
alias "test" is already used for archive "%sphar_setalias2.phar.php" and cannot be used for other archives
|
2008-04-16 03:42:29 +00:00
|
|
|
archive "%snope.phar" cannot be associated with alias "test", already in use
|
2007-08-23 23:23:26 +00:00
|
|
|
===DONE===
|