Annotation of embedaddon/php/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: ReflectionClass::getStaticPropertyValue() - bad params
                      3: --CREDITS--
                      4: Robin Fernandes <robinf@php.net>
                      5: Steve Seear <stevseea@php.net>
                      6: --FILE--
                      7: <?php
                      8: class C {
                      9:        public static $x;
                     10: }
                     11: 
                     12: $rc = new ReflectionClass('C');
                     13: try {
                     14:        var_dump($rc->setStaticPropertyValue("x", "default value", 'blah'));
                     15: } catch (Exception $e) {
                     16:        echo $e->getMessage() . "\n";
                     17: }
                     18: try {
                     19:        var_dump($rc->setStaticPropertyValue());
                     20: } catch (Exception $e) {
                     21:        echo $e->getMessage() . "\n";
                     22: }
                     23: try {
                     24:        var_dump($rc->setStaticPropertyValue(null));
                     25: } catch (Exception $e) {
                     26:        echo $e->getMessage() . "\n";
                     27: }
                     28: try {
                     29:        var_dump($rc->setStaticPropertyValue(null,null));
                     30: } catch (Exception $e) {
                     31:        echo $e->getMessage() . "\n";
                     32: }
                     33: try {
                     34:        var_dump($rc->setStaticPropertyValue(1.5, 'def'));
                     35: } catch (Exception $e) {
                     36:        echo $e->getMessage() . "\n";
                     37: }
                     38: try {
                     39:        var_dump($rc->setStaticPropertyValue(array(1,2,3), 'blah'));
                     40: } catch (Exception $e) {
                     41:        echo $e->getMessage() . "\n";
                     42: }
                     43: 
                     44: 
                     45: ?>
                     46: --EXPECTF--
                     47: 
                     48: Warning: ReflectionClass::setStaticPropertyValue() expects exactly 2 parameters, 3 given in %s on line 8
                     49: NULL
                     50: 
                     51: Warning: ReflectionClass::setStaticPropertyValue() expects exactly 2 parameters, 0 given in %s on line 13
                     52: NULL
                     53: 
                     54: Warning: ReflectionClass::setStaticPropertyValue() expects exactly 2 parameters, 1 given in %s on line 18
                     55: NULL
                     56: Class C does not have a property named 
                     57: Class C does not have a property named 1.5
                     58: 
                     59: Warning: ReflectionClass::setStaticPropertyValue() expects parameter 1 to be string, array given in %s on line 33
                     60: NULL

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>