Yaffs site version 1.1
[yaffs-website] / vendor / symfony / var-dumper / Tests / Caster / ExceptionCasterTest.php
1 <?php
2
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 namespace Symfony\Component\VarDumper\Tests\Caster;
13
14 use Symfony\Component\VarDumper\Caster\FrameStub;
15 use Symfony\Component\VarDumper\Test\VarDumperTestCase;
16
17 class ExceptionCasterTest extends VarDumperTestCase
18 {
19     /**
20      * @requires function Twig\Template::getSourceContext
21      */
22     public function testFrameWithTwig()
23     {
24         require_once dirname(__DIR__).'/Fixtures/Twig.php';
25
26         $f = array(
27             new FrameStub(array(
28                 'file' => dirname(__DIR__).'/Fixtures/Twig.php',
29                 'line' => 21,
30                 'class' => '__TwigTemplate_VarDumperFixture_u75a09',
31             )),
32             new FrameStub(array(
33                 'file' => dirname(__DIR__).'/Fixtures/Twig.php',
34                 'line' => 21,
35                 'class' => '__TwigTemplate_VarDumperFixture_u75a09',
36                 'object' => new \__TwigTemplate_VarDumperFixture_u75a09(null, false),
37             )),
38         );
39
40         $expectedDump = <<<'EODUMP'
41 array:2 [
42   0 => {
43     class: "__TwigTemplate_VarDumperFixture_u75a09"
44     src: {
45       %sTwig.php:21: """
46             // line 2\n
47             throw new \Exception('Foobar');\n
48         }\n
49         """
50       bar.twig:2: """
51         foo bar\n
52           twig source\n
53         \n
54         """
55     }
56   }
57   1 => {
58     class: "__TwigTemplate_VarDumperFixture_u75a09"
59     object: __TwigTemplate_VarDumperFixture_u75a09 {
60     %A
61     }
62     src: {
63       %sTwig.php:21: """
64             // line 2\n
65             throw new \Exception('Foobar');\n
66         }\n
67         """
68       foo.twig:2: """
69         foo bar\n
70           twig source\n
71         \n
72         """
73     }
74   }
75 ]
76
77 EODUMP;
78
79         $this->assertDumpMatchesFormat($expectedDump, $f);
80     }
81 }