Annotation of embedaddon/php/ext/reflection/tests/ReflectionProperty_export_error.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test ReflectionProperty::export() errors.
3: --FILE--
4: <?php
5:
6: class TestClass {
7: }
8:
9: $a = 5;
10:
11: echo "Non-existent class:\n";
12: try {
13: ReflectionProperty::export("NonExistentClass", "prop", true);
14: }
15: catch(Exception $e) {
16: echo $e->getMessage();
17: }
18:
19: echo "\n\nWrong property parameter type:\n";
20: try {
21: ReflectionProperty::export($a, 'TestClass', false);
22: }
23: catch(ReflectionException $e) {
24: echo $e->getMessage();
25: }
26:
27: echo "\n\nNon-existent property:\n";
28: try {
29: ReflectionProperty::export('TestClass', "nonExistentProperty", true);
30: }
31: catch(Exception $e) {
32: echo $e->getMessage();
33: }
34:
35: echo "\n\nIncorrect number of args:\n";
36: ReflectionProperty::export();
37: ReflectionProperty::export('TestClass', "nonExistentProperty", true, false);
38:
39: ?>
40: --EXPECTF--
41: Non-existent class:
42: Class NonExistentClass does not exist
43:
44: Wrong property parameter type:
45: The parameter class is expected to be either a string or an object
46:
47: Non-existent property:
48: Property TestClass::$nonExistentProperty does not exist
49:
50: Incorrect number of args:
51:
52: Warning: ReflectionProperty::export() expects at least 2 parameters, 0 given in %s on line %d
53:
54: Warning: ReflectionProperty::export() expects at most 3 parameters, 4 given in %s on line %d
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>