Drupal investigation

ExceptionCasterTest.php 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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\Caster\FrameStub;
  12. use Symfony\Component\VarDumper\Test\VarDumperTestCase;
  13. class ExceptionCasterTest extends VarDumperTestCase
  14. {
  15. /**
  16. * @requires function Twig_Template::getSourceContext
  17. */
  18. public function testFrameWithTwig()
  19. {
  20. require_once dirname(__DIR__).'/Fixtures/Twig.php';
  21. $f = array(
  22. new FrameStub(array(
  23. 'file' => dirname(__DIR__).'/Fixtures/Twig.php',
  24. 'line' => 21,
  25. 'class' => '__TwigTemplate_VarDumperFixture_u75a09',
  26. )),
  27. new FrameStub(array(
  28. 'file' => dirname(__DIR__).'/Fixtures/Twig.php',
  29. 'line' => 21,
  30. 'class' => '__TwigTemplate_VarDumperFixture_u75a09',
  31. 'object' => new \__TwigTemplate_VarDumperFixture_u75a09(null, false),
  32. )),
  33. );
  34. $expectedDump = <<<'EODUMP'
  35. array:2 [
  36. 0 => {
  37. class: "__TwigTemplate_VarDumperFixture_u75a09"
  38. src: {
  39. %sTwig.php:21: """
  40. // line 2\n
  41. throw new \Exception('Foobar');\n
  42. }\n
  43. """
  44. bar.twig:2: """
  45. foo bar\n
  46. twig source\n
  47. \n
  48. """
  49. }
  50. }
  51. 1 => {
  52. class: "__TwigTemplate_VarDumperFixture_u75a09"
  53. object: __TwigTemplate_VarDumperFixture_u75a09 {
  54. %A
  55. }
  56. src: {
  57. %sTwig.php:21: """
  58. // line 2\n
  59. throw new \Exception('Foobar');\n
  60. }\n
  61. """
  62. foo.twig:2: """
  63. foo bar\n
  64. twig source\n
  65. \n
  66. """
  67. }
  68. }
  69. ]
  70. EODUMP;
  71. $this->assertDumpMatchesFormat($expectedDump, $f);
  72. }
  73. }