mirror of
https://github.com/php/php-src.git
synced 2025-08-20 01:14:28 +02:00
- Add test
This commit is contained in:
parent
c818d09f6d
commit
87cd1a45ef
1 changed files with 49 additions and 0 deletions
49
ext/phar/tests/phar_oo_006.phpt
Executable file
49
ext/phar/tests/phar_oo_006.phpt
Executable 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===
|
Loading…
Add table
Add a link
Reference in a new issue