Skip to content

Commit ab661bd

Browse files
committed
minor symfony#23567 [TwigBridge] fix tests (xabbuh)
This PR was merged into the 3.4 branch. Discussion ---------- [TwigBridge] fix tests | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | ~The changed test did not pass locally. I do probably miss something important, but I fail to see why this did not occur when running the tests on Travis CI.~ Never mind, I was looking at the wrong build. It fails on Travis CI too. Commits ------- 62410b6 [TwigBridge] fix tests
2 parents a0795c7 + 62410b6 commit ab661bd

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/Symfony/Bridge/Twig/Tests/Node/FormThemeTest.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313

1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Bridge\Twig\Node\FormThemeNode;
16+
use Symfony\Bridge\Twig\Tests\Extension\RuntimeLoaderProvider;
17+
use Symfony\Component\Form\FormRenderer;
18+
use Symfony\Component\Form\FormRendererEngineInterface;
1619
use Twig\Compiler;
1720
use Twig\Environment;
1821
use Twig\Node\Expression\ArrayExpression;
@@ -22,6 +25,8 @@
2225

2326
class FormThemeTest extends TestCase
2427
{
28+
use RuntimeLoaderProvider;
29+
2530
public function testConstructor()
2631
{
2732
$form = new NameExpression('form', 0);
@@ -48,11 +53,14 @@ public function testCompile()
4853

4954
$node = new FormThemeNode($form, $resources, 0);
5055

51-
$compiler = new Compiler(new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock()));
56+
$environment = new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock());
57+
$formRenderer = new FormRenderer($this->getMockBuilder(FormRendererEngineInterface::class)->getMock());
58+
$this->registerTwigRuntimeLoader($environment, $formRenderer);
59+
$compiler = new Compiler($environment);
5260

5361
$this->assertEquals(
5462
sprintf(
55-
'$this->env->getRuntime(\'Symfony\Component\Form\FormRenderer\')->setTheme(%s, array(0 => "tpl1", 1 => "tpl2"));',
63+
'$this->env->getRuntime("Symfony\\\\Component\\\\Form\\\\FormRenderer")->setTheme(%s, array(0 => "tpl1", 1 => "tpl2"));',
5664
$this->getVariableGetter('form')
5765
),
5866
trim($compiler->compile($node)->getSource())
@@ -64,7 +72,7 @@ public function testCompile()
6472

6573
$this->assertEquals(
6674
sprintf(
67-
'$this->env->getRuntime(\'Symfony\Component\Form\FormRenderer\')->setTheme(%s, "tpl1");',
75+
'$this->env->getRuntime("Symfony\\\\Component\\\\Form\\\\FormRenderer")->setTheme(%s, "tpl1");',
6876
$this->getVariableGetter('form')
6977
),
7078
trim($compiler->compile($node)->getSource())

0 commit comments

Comments
 (0)