Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[VarDumper] Fix source links with latests Twig versions
- Loading branch information
1 parent
ee8203a
commit f3b09d9
Showing
4 changed files
with
113 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
src/Symfony/Component/VarDumper/Tests/Caster/ExceptionCasterTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\VarDumper\Tests\Caster; | ||
|
||
use Symfony\Component\VarDumper\Caster\FrameStub; | ||
use Symfony\Component\VarDumper\Test\VarDumperTestCase; | ||
|
||
class ExceptionCasterTest extends VarDumperTestCase | ||
{ | ||
/** | ||
* @requires function Twig_Template::getSourceContext | ||
*/ | ||
public function testFrameWithTwig() | ||
{ | ||
require_once dirname(__DIR__).'/Fixtures/Twig.php'; | ||
|
||
$f = array( | ||
new FrameStub(array( | ||
'file' => dirname(__DIR__).'/Fixtures/Twig.php', | ||
'line' => 19, | ||
'class' => '__TwigTemplate_VarDumperFixture_u75a09', | ||
'object' => new \__TwigTemplate_VarDumperFixture_u75a09(new \Twig_Environment(new \Twig_Loader_Filesystem())), | ||
)), | ||
new FrameStub(array( | ||
'file' => dirname(__DIR__).'/Fixtures/Twig.php', | ||
'line' => 19, | ||
'class' => '__TwigTemplate_VarDumperFixture_u75a09', | ||
'object' => new \__TwigTemplate_VarDumperFixture_u75a09(new \Twig_Environment(new \Twig_Loader_Filesystem()), null), | ||
)), | ||
); | ||
|
||
$expectedDump = <<<'EODUMP' | ||
array:2 [ | ||
0 => { | ||
class: "__TwigTemplate_VarDumperFixture_u75a09" | ||
object: __TwigTemplate_VarDumperFixture_u75a09 { | ||
%A | ||
} | ||
src: { | ||
%sTwig.php:19: """ | ||
// line 2\n | ||
throw new \Exception('Foobar');\n | ||
}\n | ||
""" | ||
bar.twig:2: """ | ||
foo bar\n | ||
twig source\n | ||
\n | ||
""" | ||
} | ||
} | ||
1 => { | ||
class: "__TwigTemplate_VarDumperFixture_u75a09" | ||
object: __TwigTemplate_VarDumperFixture_u75a09 { | ||
%A | ||
} | ||
src: { | ||
%sTwig.php:19: """ | ||
// line 2\n | ||
throw new \Exception('Foobar');\n | ||
}\n | ||
""" | ||
foo.twig:2: """ | ||
foo bar\n | ||
twig source\n | ||
\n | ||
""" | ||
} | ||
} | ||
] | ||
EODUMP; | ||
|
||
$this->assertDumpMatchesFormat($expectedDump, $f); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters