Annotation of embedaddon/php/ext/reflection/tests/ReflectionObject_getConstant_error.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: ReflectionObject::getConstant() - invalid params
3: --FILE--
4: <?php
5: class C {
6: const myConst = 1;
7: }
8:
9: $rc = new ReflectionObject(new C);
10: var_dump($rc->getConstant());
11: var_dump($rc->getConstant("myConst", "myConst"));
12: var_dump($rc->getConstant(null));
13: var_dump($rc->getConstant(1));
14: var_dump($rc->getConstant(1.5));
15: var_dump($rc->getConstant(true));
16: var_dump($rc->getConstant(array(1,2,3)));
17: var_dump($rc->getConstant(new C));
18: ?>
19: --EXPECTF--
20: Warning: ReflectionClass::getConstant() expects exactly 1 parameter, 0 given in %s on line 7
21: NULL
22:
23: Warning: ReflectionClass::getConstant() expects exactly 1 parameter, 2 given in %s on line 8
24: NULL
25: bool(false)
26: bool(false)
27: bool(false)
28: bool(false)
29:
30: Warning: ReflectionClass::getConstant() expects parameter 1 to be string, array given in %s on line 13
31: NULL
32:
33: Warning: ReflectionClass::getConstant() expects parameter 1 to be string, object given in %s on line 14
34: NULL
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>