Annotation of embedaddon/php/Zend/tests/011.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: property_exists() tests
! 3: --FILE--
! 4: <?php
! 5:
! 6: class foo {
! 7: public $pp1 = 1;
! 8: private $pp2 = 2;
! 9: protected $pp3 = 3;
! 10:
! 11: function bar() {
! 12: var_dump(property_exists("foo","pp1"));
! 13: var_dump(property_exists("foo","pp2"));
! 14: var_dump(property_exists("foo","pp3"));
! 15: }
! 16: }
! 17:
! 18: class bar extends foo {
! 19: function test() {
! 20: var_dump(property_exists("foo","pp1"));
! 21: var_dump(property_exists("foo","pp2"));
! 22: var_dump(property_exists("foo","pp3"));
! 23: }
! 24: }
! 25:
! 26: var_dump(property_exists());
! 27: var_dump(property_exists(""));
! 28: var_dump(property_exists("foo","pp1"));
! 29: var_dump(property_exists("foo","pp2"));
! 30: var_dump(property_exists("foo","pp3"));
! 31: var_dump(property_exists("foo","nonexistent"));
! 32: var_dump(property_exists("fo","nonexistent"));
! 33: var_dump(property_exists("foo",""));
! 34: var_dump(property_exists("","test"));
! 35: var_dump(property_exists("",""));
! 36:
! 37: $foo = new foo;
! 38:
! 39: var_dump(property_exists($foo,"pp1"));
! 40: var_dump(property_exists($foo,"pp2"));
! 41: var_dump(property_exists($foo,"pp3"));
! 42: var_dump(property_exists($foo,"nonexistent"));
! 43: var_dump(property_exists($foo,""));
! 44: var_dump(property_exists(array(),"test"));
! 45: var_dump(property_exists(1,"test"));
! 46: var_dump(property_exists(true,"test"));
! 47:
! 48: $foo->bar();
! 49:
! 50: $bar = new bar;
! 51: $bar->test();
! 52:
! 53: echo "Done\n";
! 54: ?>
! 55: --EXPECTF--
! 56: Warning: property_exists() expects exactly 2 parameters, 0 given in %s on line %d
! 57: NULL
! 58:
! 59: Warning: property_exists() expects exactly 2 parameters, 1 given in %s on line %d
! 60: NULL
! 61: bool(true)
! 62: bool(true)
! 63: bool(true)
! 64: bool(false)
! 65: bool(false)
! 66: bool(false)
! 67: bool(false)
! 68: bool(false)
! 69: bool(true)
! 70: bool(true)
! 71: bool(true)
! 72: bool(false)
! 73: bool(false)
! 74:
! 75: Warning: First parameter must either be an object or the name of an existing class in %s on line %d
! 76: NULL
! 77:
! 78: Warning: First parameter must either be an object or the name of an existing class in %s on line %d
! 79: NULL
! 80:
! 81: Warning: First parameter must either be an object or the name of an existing class in %s on line %d
! 82: NULL
! 83: bool(true)
! 84: bool(true)
! 85: bool(true)
! 86: bool(true)
! 87: bool(true)
! 88: bool(true)
! 89: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>