- Add test

This commit is contained in:
Marcus Boerger 2006-03-04 22:49:34 +00:00
parent c818d09f6d
commit 87cd1a45ef

49
ext/phar/tests/phar_oo_006.phpt Executable file
View file

@ -0,0 +1,49 @@
--TEST--
Phar object: array access
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--FILE--
<?php
require_once 'phar_oo_test.inc';
class MyFile extends SplFileObject
{
function __construct($what)
{
echo __METHOD__ . "($what)\n";
parent::__construct($what);
}
}
$phar = new Phar($fname);
try
{
$phar->setFileClass('SplFileInfo');
}
catch (UnexpectedValueException $e)
{
echo $e->getMessage() . "\n";
}
$phar->setFileClass('MyFile');
echo $phar['a.php']->getFilename() . "\n";
echo $phar['b/c.php']->getFilename() . "\n";
echo $phar['b.php']->getFilename() . "\n";
?>
===DONE===
--CLEAN--
<?php
unlink(dirname(__FILE__) . '/phar_oo_test.phar.php');
__halt_compiler();
?>
--EXPECTF--
SplFileInfo::setFileClass() expects parameter 1 to be a class name derived from SplFileObject, 'SplFileInfo' given
MyFile::__construct(phar://%s/a.php)
phar://%s/a.php
MyFile::__construct(phar://%s/b/c.php)
phar://%s/b/c.php
MyFile::__construct(phar://%s/b.php)
phar://%s/b.php
===DONE===