forked from laruence/yaf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
007.phpt
96 lines (85 loc) · 1.73 KB
/
007.phpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
--TEST--
Check for Yaf_Config_Simple
--SKIPIF--
<?php if (!extension_loaded("yaf")) print "skip"; ?>
--INI--
yaf.use_namespace=0
--FILE--
<?php
$config = array(
'section1' => array(
'name' => 'value',
'dummy' => 'foo',
),
'section2' => "laruence",
);
$config1 = new Yaf_Config_Simple($config, 'section2');
print_r($config1);
$config2 = new Yaf_Config_Simple($config, 'section1');
var_dump($config2->readonly());
$config2->new = "value";
var_dump(isset($config->new));
$config3 = new Yaf_Config_Simple($config);
unset($config);
echo "Isset config3 section:";
var_dump(isset($config3["section2"]));
$config3->new = "value";
echo "Config3 readonly:";
var_dump($config3->readonly());
foreach($config3 as $key => $val) {
print_r($key);
print_r("=>");
print_r($val);
print_r("\n");
}
print_r($config3->toArray());
$sick = @new Yaf_Config_Simple();
var_dump($sick->__isset(1));
var_dump($sick->__get(2));
$sick->total = 1;
var_dump(count($sick));
var_dump($sick->total);
?>
--EXPECTF--
Yaf_Config_Simple Object
(
[_config:protected] => Array
(
[section1] => Array
(
[name] => value
[dummy] => foo
)
[section2] => laruence
)
[_readonly:protected] => 1
)
bool(true)
bool(false)
Isset config3 section:bool(true)
Config3 readonly:bool(false)
section1=>Yaf_Config_Simple Object
(
[_config:protected] => Array
(
[name] => value
[dummy] => foo
)
[_readonly:protected] =>
)
section2=>laruence
new=>value
Array
(
[section1] => Array
(
[name] => value
[dummy] => foo
)
[section2] => laruence
[new] => value
)
bool(false)
bool(false)
int(1)
int(1)