ReflectionCasterTest.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\VarDumper\Tests\Caster;
  11. use Symfony\Component\VarDumper\Test\VarDumperTestCase;
  12. /**
  13. * @author Nicolas Grekas <p@tchwork.com>
  14. */
  15. class ReflectionCasterTest extends VarDumperTestCase
  16. {
  17. public function testReflectionCaster()
  18. {
  19. $var = new \ReflectionClass('ReflectionClass');
  20. $this->assertDumpMatchesFormat(
  21. <<<'EOTXT'
  22. ReflectionClass {
  23. +name: "ReflectionClass"
  24. %Aimplements: array:%d [
  25. 0 => "Reflector"
  26. %A]
  27. constants: array:3 [
  28. "IS_IMPLICIT_ABSTRACT" => 16
  29. "IS_EXPLICIT_ABSTRACT" => 32
  30. "IS_FINAL" => %d
  31. ]
  32. properties: array:%d [
  33. "name" => ReflectionProperty {
  34. %A +name: "name"
  35. +class: "ReflectionClass"
  36. %A modifiers: "public"
  37. extra: null
  38. }
  39. %A]
  40. methods: array:%d [
  41. %A
  42. "export" => ReflectionMethod {
  43. +name: "export"
  44. +class: "ReflectionClass"
  45. parameters: array:2 [
  46. "$%s" => ReflectionParameter {
  47. %A position: 0
  48. %A }
  49. ]
  50. modifiers: "public static"
  51. }
  52. %A
  53. }
  54. EOTXT
  55. , $var
  56. );
  57. }
  58. }