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