ReflectionClass_toString_002.phpt 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. --TEST--
  2. ReflectionClass::__toString() - verify 'inherits', 'overwrites' and 'prototype' parts of method representation
  3. --CREDITS--
  4. Robin Fernandes <robinf@php.net>
  5. Steve Seear <stevseea@php.net>
  6. --FILE--
  7. <?php
  8. Class A {
  9. function f() {}
  10. }
  11. Class B extends A {
  12. function f() {}
  13. }
  14. Class C extends B {
  15. }
  16. Class D extends C {
  17. function f() {}
  18. }
  19. foreach (array('A', 'B', 'C', 'D') as $class) {
  20. echo "\n\n----( Reflection class $class: )----\n";
  21. $rc = new ReflectionClass($class);
  22. echo $rc;
  23. }
  24. ?>
  25. --EXPECTF--
  26. ----( Reflection class A: )----
  27. Class [ <user> class A ] {
  28. @@ %s 2-4
  29. - Constants [0] {
  30. }
  31. - Static properties [0] {
  32. }
  33. - Static methods [0] {
  34. }
  35. - Properties [0] {
  36. }
  37. - Methods [1] {
  38. Method [ <user> public method f ] {
  39. @@ %s 3 - 3
  40. }
  41. }
  42. }
  43. ----( Reflection class B: )----
  44. Class [ <user> class B extends A ] {
  45. @@ %s 5-7
  46. - Constants [0] {
  47. }
  48. - Static properties [0] {
  49. }
  50. - Static methods [0] {
  51. }
  52. - Properties [0] {
  53. }
  54. - Methods [1] {
  55. Method [ <user, overwrites A, prototype A> public method f ] {
  56. @@ %s 6 - 6
  57. }
  58. }
  59. }
  60. ----( Reflection class C: )----
  61. Class [ <user> class C extends B ] {
  62. @@ %s 8-10
  63. - Constants [0] {
  64. }
  65. - Static properties [0] {
  66. }
  67. - Static methods [0] {
  68. }
  69. - Properties [0] {
  70. }
  71. - Methods [1] {
  72. Method [ <user, inherits B, prototype A> public method f ] {
  73. @@ %s 6 - 6
  74. }
  75. }
  76. }
  77. ----( Reflection class D: )----
  78. Class [ <user> class D extends C ] {
  79. @@ %s 11-13
  80. - Constants [0] {
  81. }
  82. - Static properties [0] {
  83. }
  84. - Static methods [0] {
  85. }
  86. - Properties [0] {
  87. }
  88. - Methods [1] {
  89. Method [ <user, overwrites B, prototype A> public method f ] {
  90. @@ %s 12 - 12
  91. }
  92. }
  93. }