8000 Merge branch '3.4' · symfony/symfony@e69f9db · GitHub
[go: up one dir, main page]

Skip to content

Commit e69f9db

Browse files
Merge branch '3.4'
* 3.4: Fix phpunit bridge [Form] [TwigBridge] Added option to disable usage of default themes when rendering a form
2 parents 96c5668 + ed5f884 commit e69f9db

24 files changed

+109
-44
lines changed

src/Symfony/Bridge/PhpUnit/Tests/ProcessIsolationTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@ class ProcessIsolationTest extends TestCase
1919
public function testIsolation()
2020
{
2121
@trigger_error('Test abc', E_USER_DEPRECATED);
22+
$test->addToAssertionCount(1);
2223
}
2324
}

src/Symfony/Bridge/PhpUnit/bin/simple-phpunit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__
6868
if (5.1 <= $PHPUNIT_VERSION && $PHPUNIT_VERSION < 5.4) {
6969
passthru("$COMPOSER require --no-update phpunit/phpunit-mock-objects \"~3.1.0\"");
7070
}
71-
passthru("$COMPOSER require --no-update symfony/phpunit-bridge \">=3.2@dev\"");
71+
passthru("$COMPOSER require --no-update symfony/phpunit-bridge \">=3.3.11@dev\"");
7272
$prevRoot = getenv('COMPOSER_ROOT_VERSION');
7373
putenv("COMPOSER_ROOT_VERSION=$PHPUNIT_VERSION");
7474
$exit = proc_close(proc_open("$COMPOSER install --no-dev --prefer-dist --no-progress --ansi", array(), $p, getcwd(), null, array('bypass_shell' => true)));

src/Symfony/Bridge/Twig/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ CHANGELOG
44
3.4.0
55
-----
66

7+
* added an `only` keyword to `form_theme` tag to disable usage of default themes when rendering a form
78
* deprecated `Symfony\Bridge\Twig\Form\TwigRenderer`
89
* deprecated `DebugCommand::set/getTwigEnvironment`. Pass an instance of
910
`Twig\Environment` as first argument of the constructor instead

src/Symfony/Bridge/Twig/Form/TwigRendererEngine.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,11 @@ protected function loadResourceForBlockName($cacheKey, FormView $view, $blockNam
106106

107107
// Check the default themes once we reach the root view without success
108108
if (!$view->parent) {
109-
for ($i = count($this->defaultThemes) - 1; $i >= 0; --$i) {
110-
$this->loadResourcesFromTheme($cacheKey, $this->defaultThemes[$i]);
111-
// CONTINUE LOADING (see doc comment)
109+
if (!isset($this->useDefaultThemes[$cacheKey]) || $this->useDefaultThemes[$cacheKey]) {
110+
for ($i = count($this->defaultThemes) - 1; $i >= 0; --$i) {
111+
$this->loadResourcesFromTheme($cacheKey, $this->defaultThemes[$i]);
112+
// CONTINUE LOADING (see doc comment)
113+
}
112114
}
113115
}
114116

src/Symfony/Bridge/Twig/Node/FormThemeNode.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
*/
2121
class FormThemeNode extends Node
2222
{
23-
public function __construct(Node $form, Node $resources, $lineno, $tag = null)
23+
public function __construct(Node $form, Node $resources, $lineno, $tag = null, $only = false)
2424
{
25-
parent::__construct(array('form' => $form, 'resources' => $resources), array(), $lineno, $tag);
25+
parent::__construct(array('form' => $form, 'resources' => $resources), array('only' => (bool) $only), $lineno, $tag);
2626
}
2727

2828
public function compile(Compiler $compiler)
@@ -35,6 +35,8 @@ public function compile(Compiler $compiler)
3535
->subcompile($this->getNode('form'))
3636
->raw(', ')
3737
->subcompile($this->getNode('resources'))
38+
->raw(', ')
39+
->raw(false === $this->getAttribute('only') ? 'true' : 'false')
3840
->raw(");\n");
3941
}
4042
}

src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3HorizontalLayoutTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ protected function renderEnd(FormView $view, array $vars = array())
9999
return (string) $this->renderer->renderBlock($view, 'form_end', $vars);
100100
}
101101

102-
protected function setTheme(FormView $view, array $themes)
102+
protected function setTheme(FormView $view, array $themes, $useDefaultThemes = true)
103103
{
104-
$this->renderer->setTheme($view, $themes);
104+
$this->renderer->setTheme($view, $themes, $useDefaultThemes);
105105
}
106106
}

src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3LayoutTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ protected function renderEnd(FormView $view, array $vars = array())
119119
return (string) $this->renderer->renderBlock($view, 'form_end', $vars);
120120
}
121121

122-
protected function setTheme(FormView $view, array $themes)
122+
protected function setTheme(FormView $view, array $themes, $useDefaultThemes = true)
123123
{
124-
$this->renderer->setTheme($view, $themes);
124+
$this->renderer->setTheme($view, $themes, $useDefaultThemes);
125125
}
126126
}

src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap4HorizontalLayoutTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ protected function renderEnd(FormView $view, array $vars = array())
100100
return (string) $this->renderer->renderBlock($view, 'form_end', $vars);
101101
}
102102

103-
protected function setTheme(FormView $view, array $themes)
103+
protected function setTheme(FormView $view, array $themes, $useDefaultThemes = true)
104104
{
105-
$this->renderer->setTheme($view, $themes);
105+
$this->renderer->setTheme($view, $themes, $useDefaultThemes);
106106
}
107107
}

src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap4LayoutTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ protected function renderEnd(FormView $view, array $vars = array())
122122
return (string) $this->renderer->renderBlock($view, 'form_end', $vars);
123123
}
124124

125-
protected function setTheme(FormView $view, array $themes)
125+
protected function setTheme(FormView $view, array $themes, $useDefaultThemes = true)
126126
{
127-
$this->renderer->setTheme($view, $themes);
127+
$this->renderer->setTheme($view, $themes, $useDefaultThemes);
128128
}
129129
}

src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,9 @@ protected function renderEnd(FormView $view, array $vars = array())
193193
return (string) $this->renderer->renderBlock($view, 'form_end', $vars);
194194
}
195195

196-
protected function setTheme(FormView $view, array $themes)
196+
protected function setTheme(FormView $view, array $themes, $useDefaultThemes = true)
197197
{
198-
$this->renderer->setTheme($view, $themes);
198+
$this->renderer->setTheme($view, $themes, $useDefaultThemes);
199199
}
200200

201201
public static function themeBlockInheritanceProvider()

0 commit comments

Comments
 (0)
0