xref: /PHP-7.3/ext/phar/tests/phar_oo_001.phpt (revision 17ccbeec)
1--TEST--
2Phar object: basics
3--SKIPIF--
4<?php
5if (!extension_loaded("phar")) die("skip");
6?>
7--INI--
8phar.require_hash=0
9phar.readonly=0
10--FILE--
11<?php
12
13require_once 'files/phar_oo_test.inc';
14
15$phar = new Phar($fname);
16var_dump($phar->getVersion());
17var_dump(count($phar));
18
19class MyPhar extends Phar
20{
21	function __construct()
22	{
23	}
24}
25
26try
27{
28	$phar = new MyPhar();
29	var_dump($phar->getVersion());
30}
31catch (LogicException $e)
32{
33	var_dump($e->getMessage());
34}
35try {
36	$phar = new Phar('test.phar');
37	$phar->__construct('oops');
38} catch (LogicException $e)
39{
40	var_dump($e->getMessage());
41}
42
43?>
44===DONE===
45--CLEAN--
46<?php
47unlink(dirname(__FILE__) . '/files/phar_oo_001.phar.php');
48__halt_compiler();
49?>
50--EXPECT--
51string(5) "1.0.0"
52int(5)
53string(50) "Cannot call method on an uninitialized Phar object"
54string(29) "Cannot call constructor twice"
55===DONE===
56