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