Merge branch '2.8'
* 2.8: Always enable clock-mock for HttpFoundation [ClassLoader] Fix parsing namespace when token_get_all() is missing Bug #16343 [Router] Too many Routes ? Fixes the stack traces of the deprecation logs fix unused variable warning [Translation][Form] Do not translate form labels and placeholders when 'translation_domain' is false add composer exclude-from-classmap for new 2.8 components [Yaml] sync changelog and upgrade files [Debug] Ensure class declarations are loaded only once Minor design tweaks for the Logs and Doctrine profiler panels Conflicts: UPGRADE-2.8.md
This commit is contained in:
commit
5183c881d0
@ -1333,6 +1333,11 @@ UPGRADE FROM 2.x to 3.0
|
|||||||
|
|
||||||
### Yaml
|
### Yaml
|
||||||
|
|
||||||
|
* Using a colon in an unquoted mapping value leads to a `ParseException`.
|
||||||
|
* Starting an unquoted string with `@`, `` ` ``, `|`, or `>` leads to a `ParseException`.
|
||||||
|
* Deprecated non-escaped \ in double-quoted strings when parsing Yaml
|
||||||
|
("Foo\Var" is not valid whereas "Foo\\Var" is)
|
||||||
|
|
||||||
* The ability to pass file names to `Yaml::parse()` has been removed.
|
* The ability to pass file names to `Yaml::parse()` has been removed.
|
||||||
|
|
||||||
Before:
|
Before:
|
||||||
|
@ -47,4 +47,14 @@
|
|||||||
</exclude>
|
</exclude>
|
||||||
</whitelist>
|
</whitelist>
|
||||||
</filter>
|
</filter>
|
||||||
|
|
||||||
|
<listeners>
|
||||||
|
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener">
|
||||||
|
<arguments>
|
||||||
|
<array>
|
||||||
|
<element><string>Symfony\Component\HttpFoundation</string></element>
|
||||||
|
</array>
|
||||||
|
</arguments>
|
||||||
|
</listener>
|
||||||
|
</listeners>
|
||||||
</phpunit>
|
</phpunit>
|
||||||
|
@ -66,7 +66,7 @@ class ClockMock
|
|||||||
return self::$now;
|
return self::$now;
|
||||||
}
|
}
|
||||||
|
|
||||||
return sprintf("%0.6f %d\n", $now - (int) $now, (int) self::$now);
|
return sprintf("%0.6f %d\n", self::$now - (int) self::$now, (int) self::$now);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function register($class)
|
public static function register($class)
|
||||||
|
@ -57,7 +57,7 @@
|
|||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
<select {{ block('widget_attributes') }}{% if multiple %} multiple="multiple"{% endif %}>
|
<select {{ block('widget_attributes') }}{% if multiple %} multiple="multiple"{% endif %}>
|
||||||
{%- if placeholder is not none -%}
|
{%- if placeholder is not none -%}
|
||||||
<option value=""{% if required and value is empty %} selected="selected"{% endif %}>{{ placeholder != '' ? placeholder|trans({}, translation_domain) }}</option>
|
<option value=""{% if required and value is empty %} selected="selected"{% endif %}>{{ placeholder != '' ? (translation_domain is same as(false) ? placeholder : placeholder|trans({}, translation_domain)) }}</option>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- if preferred_choices|length > 0 -%}
|
{%- if preferred_choices|length > 0 -%}
|
||||||
{% set options = preferred_choices %}
|
{% set options = preferred_choices %}
|
||||||
@ -192,7 +192,7 @@
|
|||||||
{% set label = name|humanize %}
|
{% set label = name|humanize %}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
<button type="{{ type|default('button') }}" {{ block('button_attributes') }}>{{ label|trans({}, translation_domain) }}</button>
|
<button type="{{ type|default('button') }}" {{ block('button_attributes') }}>{{ translation_domain is same as(false) ? label : label|trans({}, translation_domain) }}</button>
|
||||||
{%- endblock button_widget -%}
|
{%- endblock button_widget -%}
|
||||||
|
|
||||||
{%- block submit_widget -%}
|
{%- block submit_widget -%}
|
||||||
@ -320,7 +320,7 @@
|
|||||||
{%- for attrname, attrvalue in attr -%}
|
{%- for attrname, attrvalue in attr -%}
|
||||||
{{- " " -}}
|
{{- " " -}}
|
||||||
{%- if attrname in ['placeholder', 'title'] -%}
|
{%- if attrname in ['placeholder', 'title'] -%}
|
||||||
{{- attrname }}="{{ attrvalue|trans({}, translation_domain) }}"
|
{{- attrname }}="{{ translation_domain is same as(false) ? attrvalue : attrvalue|trans({}, translation_domain) }}"
|
||||||
{%- elseif attrvalue is same as(true) -%}
|
{%- elseif attrvalue is same as(true) -%}
|
||||||
{{- attrname }}="{{ attrname }}"
|
{{- attrname }}="{{ attrname }}"
|
||||||
{%- elseif attrvalue is not same as(false) -%}
|
{%- elseif attrvalue is not same as(false) -%}
|
||||||
@ -334,7 +334,7 @@
|
|||||||
{%- for attrname, attrvalue in attr -%}
|
{%- for attrname, attrvalue in attr -%}
|
||||||
{{- " " -}}
|
{{- " " -}}
|
||||||
{%- if attrname in ['placeholder', 'title'] -%}
|
{%- if attrname in ['placeholder', 'title'] -%}
|
||||||
{{- attrname }}="{{ attrvalue|trans({}, translation_domain) }}"
|
{{- attrname }}="{{ translation_domain is same as(false) ? attrvalue : attrvalue|trans({}, translation_domain) }}"
|
||||||
{%- elseif attrvalue is same as(true) -%}
|
{%- elseif attrvalue is same as(true) -%}
|
||||||
{{- attrname }}="{{ attrname }}"
|
{{- attrname }}="{{ attrname }}"
|
||||||
{%- elseif attrvalue is not same as(false) -%}
|
{%- elseif attrvalue is not same as(false) -%}
|
||||||
@ -348,7 +348,7 @@
|
|||||||
{%- for attrname, attrvalue in attr -%}
|
{%- for attrname, attrvalue in attr -%}
|
||||||
{{- " " -}}
|
{{- " " -}}
|
||||||
{%- if attrname in ['placeholder', 'title'] -%}
|
{%- if attrname in ['placeholder', 'title'] -%}
|
||||||
{{- attrname }}="{{ attrvalue|trans({}, translation_domain) }}"
|
{{- attrname }}="{{ translation_domain is same as(false) ? attrvalue : attrvalue|trans({}, translation_domain) }}"
|
||||||
{%- elseif attrvalue is same as(true) -%}
|
{%- elseif attrvalue is same as(true) -%}
|
||||||
{{- attrname }}="{{ attrname }}"
|
{{- attrname }}="{{ attrname }}"
|
||||||
{%- elseif attrvalue is not same as(false) -%}
|
{%- elseif attrvalue is not same as(false) -%}
|
||||||
@ -361,7 +361,7 @@
|
|||||||
{%- for attrname, attrvalue in attr -%}
|
{%- for attrname, attrvalue in attr -%}
|
||||||
{{- " " -}}
|
{{- " " -}}
|
||||||
{%- if attrname in ['placeholder', 'title'] -%}
|
{%- if attrname in ['placeholder', 'title'] -%}
|
||||||
{{- attrname }}="{{ attrvalue|trans({}, translation_domain) }}"
|
{{- attrname }}="{{ translation_domain is same as(false) ? attrvalue : attrvalue|trans({}, translation_domain) }}"
|
||||||
{%- elseif attrvalue is same as(true) -%}
|
{%- elseif attrvalue is same as(true) -%}
|
||||||
{{- attrname }}="{{ attrname }}"
|
{{- attrname }}="{{ attrname }}"
|
||||||
{%- elseif attrvalue is not same as(false) -%}
|
{%- elseif attrvalue is not same as(false) -%}
|
||||||
|
@ -150,7 +150,7 @@
|
|||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
<select {{ block('widget_attributes') }}{% if multiple %} multiple="multiple" data-customforms="disabled"{% endif %}>
|
<select {{ block('widget_attributes') }}{% if multiple %} multiple="multiple" data-customforms="disabled"{% endif %}>
|
||||||
{% if placeholder is not none -%}
|
{% if placeholder is not none -%}
|
||||||
<option value=""{% if required and value is empty %} selected="selected"{% endif %}>{{ placeholder|trans({}, translation_domain) }}</option>
|
<option value=""{% if required and value is empty %} selected="selected"{% endif %}>{{ translation_domain is same as(false) ? placeholder : placeholder|trans({}, translation_domain) }}</option>
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- if preferred_choices|length > 0 -%}
|
{%- if preferred_choices|length > 0 -%}
|
||||||
{% set options = preferred_choices %}
|
{% set options = preferred_choices %}
|
||||||
@ -253,7 +253,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
<label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>
|
<label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>
|
||||||
{{ widget|raw }}
|
{{ widget|raw }}
|
||||||
{{ label|trans({}, translation_domain) }}
|
{{ translation_domain is same as(false) ? label : label|trans({}, translation_domain) }}
|
||||||
</label>
|
</label>
|
||||||
{%- endblock checkbox_radio_label %}
|
{%- endblock checkbox_radio_label %}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
id="<?php echo $view->escape($id) ?>" name="<?php echo $view->escape($full_name) ?>" <?php if ($disabled): ?>disabled="disabled" <?php endif ?>
|
id="<?php echo $view->escape($id) ?>" name="<?php echo $view->escape($full_name) ?>" <?php if ($disabled): ?>disabled="disabled" <?php endif ?>
|
||||||
<?php foreach ($attr as $k => $v): ?>
|
<?php foreach ($attr as $k => $v): ?>
|
||||||
<?php if (in_array($v, array('placeholder', 'title'), true)): ?>
|
<?php if (in_array($v, array('placeholder', 'title'), true)): ?>
|
||||||
<?php printf('%s="%s" ', $view->escape($k), $view->escape($view['translator']->trans($v, array(), $translation_domain))) ?>
|
<?php printf('%s="%s" ', $view->escape($k), $view->escape(false !== $translation_domain ? $view['translator']->trans($v, array(), $translation_domain) : $v)) ?>
|
||||||
<?php elseif ($v === true): ?>
|
<?php elseif ($v === true): ?>
|
||||||
<?php printf('%s="%s" ', $view->escape($k), $view->escape($k)) ?>
|
<?php printf('%s="%s" ', $view->escape($k), $view->escape($k)) ?>
|
||||||
<?php elseif ($v !== false): ?>
|
<?php elseif ($v !== false): ?>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?php if (!$label) { $label = isset($label_format)
|
<?php if (!$label) { $label = isset($label_format)
|
||||||
? strtr($label_format, array('%name%' => $name, '%id%' => $id))
|
? strtr($label_format, array('%name%' => $name, '%id%' => $id))
|
||||||
: $view['form']->humanize($name); } ?>
|
: $view['form']->humanize($name); } ?>
|
||||||
<button type="<?php echo isset($type) ? $view->escape($type) : 'button' ?>" <?php echo $view['form']->block($form, 'button_attributes') ?>><?php echo $view->escape($view['translator']->trans($label, array(), $translation_domain)) ?></button>
|
<button type="<?php echo isset($type) ? $view->escape($type) : 'button' ?>" <?php echo $view['form']->block($form, 'button_attributes') ?>><?php echo $view->escape(false !== $translation_domain ? $view['translator']->trans($label, array(), $translation_domain) : $label) ?></button>
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
)) ?>
|
)) ?>
|
||||||
<?php if ($multiple): ?> multiple="multiple"<?php endif ?>
|
<?php if ($multiple): ?> multiple="multiple"<?php endif ?>
|
||||||
>
|
>
|
||||||
<?php if (null !== $placeholder): ?><option value=""<?php if ($required and empty($value) && '0' !== $value): ?> selected="selected"<?php endif?>><?php echo '' != $placeholder ? $view->escape($view['translator']->trans($placeholder, array(), $translation_domain)) : '' ?></option><?php endif; ?>
|
<?php if (null !== $placeholder): ?><option value=""<?php if ($required and empty($value) && '0' !== $value): ?> selected="selected"<?php endif?>><?php echo '' != $placeholder ? $view->escape(false !== $translation_domain ? $view['translator']->trans($placeholder, array(), $translation_domain) : $placeholder) : '' ?></option><?php endif; ?>
|
||||||
<?php if (count($preferred_choices) > 0): ?>
|
<?php if (count($preferred_choices) > 0): ?>
|
||||||
<?php echo $view['form']->block($form, 'choice_widget_options', array('choices' => $preferred_choices)) ?>
|
<?php echo $view['form']->block($form, 'choice_widget_options', array('choices' => $preferred_choices)) ?>
|
||||||
<?php if (count($choices) > 0 && null !== $separator): ?>
|
<?php if (count($choices) > 0 && null !== $separator): ?>
|
||||||
|
@ -2,7 +2,7 @@ id="<?php echo $view->escape($id) ?>" name="<?php echo $view->escape($full_name)
|
|||||||
<?php if ($required): ?> required="required"<?php endif ?>
|
<?php if ($required): ?> required="required"<?php endif ?>
|
||||||
<?php foreach ($attr as $k => $v): ?>
|
<?php foreach ($attr as $k => $v): ?>
|
||||||
<?php if (in_array($k, array('placeholder', 'title'), true)): ?>
|
<?php if (in_array($k, array('placeholder', 'title'), true)): ?>
|
||||||
<?php printf(' %s="%s"', $view->escape($k), $view->escape($view['translator']->trans($v, array(), $translation_domain))) ?>
|
<?php printf(' %s="%s"', $view->escape($k), $view->escape(false !== $translation_domain ? $view['translator']->trans($v, array(), $translation_domain) : $v)) ?>
|
||||||
<?php elseif ($v === true): ?>
|
<?php elseif ($v === true): ?>
|
||||||
<?php printf(' %s="%s"', $view->escape($k), $view->escape($k)) ?>
|
<?php printf(' %s="%s"', $view->escape($k), $view->escape($k)) ?>
|
||||||
<?php elseif ($v !== false): ?>
|
<?php elseif ($v !== false): ?>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php if (!empty($id)): ?>id="<?php echo $view->escape($id) ?>" <?php endif ?>
|
<?php if (!empty($id)): ?>id="<?php echo $view->escape($id) ?>" <?php endif ?>
|
||||||
<?php foreach ($attr as $k => $v): ?>
|
<?php foreach ($attr as $k => $v): ?>
|
||||||
<?php if (in_array($v, array('placeholder', 'title'), true)): ?>
|
<?php if (in_array($v, array('placeholder', 'title'), true)): ?>
|
||||||
<?php printf('%s="%s" ', $view->escape($k), $view->escape($view['translator']->trans($v, array(), $translation_domain))) ?>
|
<?php printf('%s="%s" ', $view->escape($k), $view->escape(false !== $translation_domain ? $view['translator']->trans($v, array(), $translation_domain) : $v)) ?>
|
||||||
<?php elseif ($v === true): ?>
|
<?php elseif ($v === true): ?>
|
||||||
<?php printf('%s="%s" ', $view->escape($k), $view->escape($k)) ?>
|
<?php printf('%s="%s" ', $view->escape($k), $view->escape($k)) ?>
|
||||||
<?php elseif ($v !== false): ?>
|
<?php elseif ($v !== false): ?>
|
||||||
|
@ -169,6 +169,7 @@
|
|||||||
{% if index == 2 %}
|
{% if index == 2 %}
|
||||||
<ul class="sf-call-stack" id="{{ id }}" class="hidden">
|
<ul class="sf-call-stack" id="{{ id }}" class="hidden">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if call.class is defined %}
|
{% if call.class is defined %}
|
||||||
{% set from = call.class|abbr_class ~ '::' ~ call.function|abbr_method() %}
|
{% set from = call.class|abbr_class ~ '::' ~ call.function|abbr_method() %}
|
||||||
{% elseif call.function is defined %}
|
{% elseif call.function is defined %}
|
||||||
@ -179,7 +180,14 @@
|
|||||||
{% set from = '-' %}
|
{% set from = '-' %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<li><span class="text-small">Called from</span> {{ call.file is defined and call.line is defined ? call.file|format_file(call.line, from) : from|raw }}</li>
|
{% set file_name = (call.file is defined and call.line is defined) ? call.file|replace({'\\': '/'})|split('/')|last %}
|
||||||
|
|
||||||
|
<li>
|
||||||
|
{{ from|raw }}
|
||||||
|
{% if file_name %}
|
||||||
|
<span class="text-small">(called from {{ call.file|format_file(call.line, file_name)|raw }})</span>
|
||||||
|
{% endif %}
|
||||||
|
</li>
|
||||||
|
|
||||||
{% if index == stack|length - 1 %}
|
{% if index == stack|length - 1 %}
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -808,6 +808,16 @@ table.logs .metadata strong {
|
|||||||
color: #222;
|
color: #222;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table.logs .sf-call-stack {
|
||||||
|
margin: 1em 0 1em 1.5em;
|
||||||
|
}
|
||||||
|
table.logs .sf-call-stack li {
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
table.logs .sf-call-stack abbr {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
{# Doctrine panel
|
{# Doctrine panel
|
||||||
========================================================================= #}
|
========================================================================= #}
|
||||||
.sql-runnable {
|
.sql-runnable {
|
||||||
@ -815,6 +825,11 @@ table.logs .metadata strong {
|
|||||||
margin: .5em 0;
|
margin: .5em 0;
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
}
|
}
|
||||||
|
.queries-table pre {
|
||||||
|
{{ mixins.break_long_words|raw }}
|
||||||
|
margin: 0;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
}
|
||||||
|
|
||||||
{# Dump panel
|
{# Dump panel
|
||||||
========================================================================= #}
|
========================================================================= #}
|
||||||
|
@ -134,8 +134,8 @@ class ClassCollectionLoader
|
|||||||
public static function fixNamespaceDeclarations($source)
|
public static function fixNamespaceDeclarations($source)
|
||||||
{
|
{
|
||||||
if (!function_exists('token_get_all') || !self::$useTokenizer) {
|
if (!function_exists('token_get_all') || !self::$useTokenizer) {
|
||||||
if (preg_match('/namespace(.*?)\s*;/', $source)) {
|
if (preg_match('/(^|\s)namespace(.*?)\s*;/', $source)) {
|
||||||
$source = preg_replace('/namespace(.*?)\s*;/', "namespace$1\n{", $source)."}\n";
|
$source = preg_replace('/(^|\s)namespace(.*?)\s*;/', "$1namespace$2\n{", $source)."}\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
return $source;
|
return $source;
|
||||||
|
@ -198,7 +198,7 @@ class ClassCollectionLoaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
array("namespace Bar ;\nclass Foo {}\n", "namespace Bar\n{\nclass Foo {}\n}\n"),
|
array("namespace Bar ;\nclass Foo {}\n", "namespace Bar\n{\nclass Foo {}\n}\n"),
|
||||||
array("namespace Foo\Bar;\nclass Foo {}\n", "namespace Foo\Bar\n{\nclass Foo {}\n}\n"),
|
array("namespace Foo\Bar;\nclass Foo {}\n", "namespace Foo\Bar\n{\nclass Foo {}\n}\n"),
|
||||||
array("namespace Foo\Bar\Bar\n{\nclass Foo {}\n}\n", "namespace Foo\Bar\Bar\n{\nclass Foo {}\n}\n"),
|
array("namespace Foo\Bar\Bar\n{\nclass Foo {}\n}\n", "namespace Foo\Bar\Bar\n{\nclass Foo {}\n}\n"),
|
||||||
array("namespace\n{\nclass Foo {}\n}\n", "namespace\n{\nclass Foo {}\n}\n"),
|
array("\nnamespace\n{\nclass Foo {}\n\$namespace=123;}\n", "\nnamespace\n{\nclass Foo {}\n\$namespace=123;}\n"),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ class DebugClassLoader
|
|||||||
try {
|
try {
|
||||||
if ($this->isFinder) {
|
if ($this->isFinder) {
|
||||||
if ($file = $this->classLoader[0]->findFile($class)) {
|
if ($file = $this->classLoader[0]->findFile($class)) {
|
||||||
require $file;
|
require_once $file;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
call_user_func($this->classLoader, $class);
|
call_user_func($this->classLoader, $class);
|
||||||
|
@ -254,6 +254,32 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testSingleChoiceWithPlaceholderWithoutTranslation()
|
||||||
|
{
|
||||||
|
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
|
||||||
|
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
|
||||||
|
'multiple' => false,
|
||||||
|
'expanded' => false,
|
||||||
|
'required' => false,
|
||||||
|
'translation_domain' => false,
|
||||||
|
'placeholder' => 'Placeholder&Not&Translated',
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->assertWidgetMatchesXpath($form->createView(), array('attr' => array('class' => 'my&class')),
|
||||||
|
'/select
|
||||||
|
[@name="name"]
|
||||||
|
[@class="my&class form-control"]
|
||||||
|
[not(@required)]
|
||||||
|
[
|
||||||
|
./option[@value=""][not(@selected)][not(@disabled)][.="Placeholder&Not&Translated"]
|
||||||
|
/following-sibling::option[@value="&a"][@selected="selected"][.="Choice&A"]
|
||||||
|
/following-sibling::option[@value="&b"][not(@selected)][.="Choice&B"]
|
||||||
|
]
|
||||||
|
[count(./option)=3]
|
||||||
|
'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function testSingleChoiceAttributes()
|
public function testSingleChoiceAttributes()
|
||||||
{
|
{
|
||||||
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
|
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
|
||||||
@ -765,6 +791,52 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testSingleChoiceExpandedWithPlaceholderWithoutTranslation()
|
||||||
|
{
|
||||||
|
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
|
||||||
|
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
|
||||||
|
'multiple' => false,
|
||||||
|
'expanded' => true,
|
||||||
|
'translation_domain' => false,
|
||||||
|
'placeholder' => 'Placeholder&Not&Translated',
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->assertWidgetMatchesXpath($form->createView(), array(),
|
||||||
|
'/div
|
||||||
|
[
|
||||||
|
./div
|
||||||
|
[@class="radio"]
|
||||||
|
[
|
||||||
|
./label
|
||||||
|
[.=" Placeholder&Not&Translated"]
|
||||||
|
[
|
||||||
|
./input[@type="radio"][@name="name"][@id="name_placeholder"][not(@checked)]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
/following-sibling::div
|
||||||
|
[@class="radio"]
|
||||||
|
[
|
||||||
|
./label
|
||||||
|
[.=" Choice&A"]
|
||||||
|
[
|
||||||
|
./input[@type="radio"][@name="name"][@id="name_0"][@checked]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
/following-sibling::div
|
||||||
|
[@class="radio"]
|
||||||
|
[
|
||||||
|
./label
|
||||||
|
[.=" Choice&B"]
|
||||||
|
[
|
||||||
|
./input[@type="radio"][@name="name"][@id="name_1"][not(@checked)]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
/following-sibling::input[@type="hidden"][@id="name__token"][@class="form-control"]
|
||||||
|
]
|
||||||
|
'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function testSingleChoiceExpandedWithBooleanValue()
|
public function testSingleChoiceExpandedWithBooleanValue()
|
||||||
{
|
{
|
||||||
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', true, array(
|
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', true, array(
|
||||||
@ -1996,6 +2068,17 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testButtonlabelWithoutTranslation()
|
||||||
|
{
|
||||||
|
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ButtonType', null, array(
|
||||||
|
'translation_domain' => false,
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->assertWidgetMatchesXpath($form->createView(), array('attr' => array('class' => 'my&class')),
|
||||||
|
'/button[@type="button"][@name="name"][.="Name"][@class="my&class btn"]'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function testSubmit()
|
public function testSubmit()
|
||||||
{
|
{
|
||||||
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\SubmitType');
|
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\SubmitType');
|
||||||
|
@ -352,6 +352,25 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testLabelWithoutTranslationOnButton()
|
||||||
|
{
|
||||||
|
$form = $this->factory->createNamedBuilder('myform', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
|
||||||
|
'translation_domain' => false,
|
||||||
|
))
|
||||||
|
->add('mybutton', 'Symfony\Component\Form\Extension\Core\Type\ButtonType')
|
||||||
|
->getForm();
|
||||||
|
$view = $form->get('mybutton')->createView();
|
||||||
|
$html = $this->renderWidget($view);
|
||||||
|
|
||||||
|
$this->assertMatchesXpath($html,
|
||||||
|
'/button
|
||||||
|
[@type="button"]
|
||||||
|
[@name="myform[mybutton]"]
|
||||||
|
[.="Mybutton"]
|
||||||
|
'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function testLabelFormatOnButton()
|
public function testLabelFormatOnButton()
|
||||||
{
|
{
|
||||||
$form = $this->factory->createNamedBuilder('myform')
|
$form = $this->factory->createNamedBuilder('myform')
|
||||||
@ -520,6 +539,31 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testSingleChoiceWithPlaceholderWithoutTranslation()
|
||||||
|
{
|
||||||
|
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
|
||||||
|
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
|
||||||
|
'multiple' => false,
|
||||||
|
'expanded' => false,
|
||||||
|
'required' => false,
|
||||||
|
'translation_domain' => false,
|
||||||
|
'placeholder' => 'Placeholder&Not&Translated',
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->assertWidgetMatchesXpath($form->createView(), array(),
|
||||||
|
'/select
|
||||||
|
[@name="name"]
|
||||||
|
[not(@required)]
|
||||||
|
[
|
||||||
|
./option[@value=""][not(@selected)][not(@disabled)][.="Placeholder&Not&Translated"]
|
||||||
|
/following-sibling::option[@value="&a"][@selected="selected"][.="Choice&A"]
|
||||||
|
/following-sibling::option[@value="&b"][not(@selected)][.="Choice&B"]
|
||||||
|
]
|
||||||
|
[count(./option)=3]
|
||||||
|
'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function testSingleChoiceAttributes()
|
public function testSingleChoiceAttributes()
|
||||||
{
|
{
|
||||||
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
|
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
|
||||||
@ -963,6 +1007,32 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testSingleChoiceExpandedWithPlaceholderWithoutTranslation()
|
||||||
|
{
|
||||||
|
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
|
||||||
|
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
|
||||||
|
'multiple' => false,
|
||||||
|
'expanded' => true,
|
||||||
|
'translation_domain' => false,
|
||||||
|
'placeholder' => 'Placeholder&Not&Translated',
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->assertWidgetMatchesXpath($form->createView(), array(),
|
||||||
|
'/div
|
||||||
|
[
|
||||||
|
./input[@type="radio"][@name="name"][@id="name_placeholder"][not(@checked)]
|
||||||
|
/following-sibling::label[@for="name_placeholder"][.="Placeholder&Not&Translated"]
|
||||||
|
/following-sibling::input[@type="radio"][@name="name"][@id="name_0"][@checked]
|
||||||
|
/following-sibling::label[@for="name_0"][.="Choice&A"]
|
||||||
|
/following-sibling::input[@type="radio"][@name="name"][@id="name_1"][not(@checked)]
|
||||||
|
/following-sibling::label[@for="name_1"][.="Choice&B"]
|
||||||
|
/following-sibling::input[@type="hidden"][@id="name__token"]
|
||||||
|
]
|
||||||
|
[count(./input)=4]
|
||||||
|
'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function testSingleChoiceExpandedWithBooleanValue()
|
public function testSingleChoiceExpandedWithBooleanValue()
|
||||||
{
|
{
|
||||||
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', true, array(
|
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', true, array(
|
||||||
@ -2086,6 +2156,17 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
|
|||||||
$this->assertSame('', $this->renderLabel($form->createView()));
|
$this->assertSame('', $this->renderLabel($form->createView()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testButtonlabelWithoutTranslation()
|
||||||
|
{
|
||||||
|
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ButtonType', null, array(
|
||||||
|
'translation_domain' => false,
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->assertWidgetMatchesXpath($form->createView(), array(),
|
||||||
|
'/button[@type="button"][@name="name"][.="Name"]'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function testSubmit()
|
public function testSubmit()
|
||||||
{
|
{
|
||||||
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\SubmitType');
|
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\SubmitType');
|
||||||
@ -2294,4 +2375,20 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
|
|||||||
$this->assertMatchesXpath($html, '/form//input[@title="[trans]Foo[/trans]"]');
|
$this->assertMatchesXpath($html, '/form//input[@title="[trans]Foo[/trans]"]');
|
||||||
$this->assertMatchesXpath($html, '/form//input[@placeholder="[trans]Bar[/trans]"]');
|
$this->assertMatchesXpath($html, '/form//input[@placeholder="[trans]Bar[/trans]"]');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testAttributesNotTranslatedWhenTranslationDomainIsFalse()
|
||||||
|
{
|
||||||
|
$view = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
|
||||||
|
'translation_domain' => false,
|
||||||
|
))
|
||||||
|
->add('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType', array('attr' => array('title' => 'Foo')))
|
||||||
|
->add('lastName', 'Symfony\Component\Form\Extension\Core\Type\TextType', array('attr' => array('placeholder' => 'Bar')))
|
||||||
|
->getForm()
|
||||||
|
->createView();
|
||||||
|
|
||||||
|
$html = $this->renderForm($view);
|
||||||
|
|
||||||
|
$this->assertMatchesXpath($html, '/form//input[@title="Foo"]');
|
||||||
|
$this->assertMatchesXpath($html, '/form//input[@placeholder="Bar"]');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,10 @@
|
|||||||
"ext-ldap": "*"
|
"ext-ldap": "*"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": { "Symfony\\Component\\Ldap\\": "" }
|
"psr-4": { "Symfony\\Component\\Ldap\\": "" },
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"minimum-stability": "dev",
|
"minimum-stability": "dev",
|
||||||
"extra": {
|
"extra": {
|
||||||
|
@ -39,7 +39,10 @@
|
|||||||
"symfony/serializer": "To use Serializer metadata"
|
"symfony/serializer": "To use Serializer metadata"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": { "Symfony\\Component\\PropertyInfo\\": "" }
|
"psr-4": { "Symfony\\Component\\PropertyInfo\\": "" },
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"minimum-stability": "dev",
|
"minimum-stability": "dev",
|
||||||
"extra": {
|
"extra": {
|
||||||
|
@ -53,7 +53,7 @@ use Psr\Log\LoggerInterface;
|
|||||||
*/
|
*/
|
||||||
class {$options['class']} extends {$options['base_class']}
|
class {$options['class']} extends {$options['base_class']}
|
||||||
{
|
{
|
||||||
private static \$declaredRoutes = {$this->generateDeclaredRoutes()};
|
private static \$declaredRoutes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
@ -62,6 +62,9 @@ class {$options['class']} extends {$options['base_class']}
|
|||||||
{
|
{
|
||||||
\$this->context = \$context;
|
\$this->context = \$context;
|
||||||
\$this->logger = \$logger;
|
\$this->logger = \$logger;
|
||||||
|
if (null === self::\$declaredRoutes) {
|
||||||
|
self::\$declaredRoutes = {$this->generateDeclaredRoutes()};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{$this->generateGenerateMethod()}
|
{$this->generateGenerateMethod()}
|
||||||
|
@ -34,6 +34,11 @@ class PhpGeneratorDumperTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
private $testTmpFilepath;
|
private $testTmpFilepath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $largeTestTmpFilepath;
|
||||||
|
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
@ -41,7 +46,9 @@ class PhpGeneratorDumperTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->routeCollection = new RouteCollection();
|
$this->routeCollection = new RouteCollection();
|
||||||
$this->generatorDumper = new PhpGeneratorDumper($this->routeCollection);
|
$this->generatorDumper = new PhpGeneratorDumper($this->routeCollection);
|
||||||
$this->testTmpFilepath = sys_get_temp_dir().DIRECTORY_SEPARATOR.'php_generator.'.$this->getName().'.php';
|
$this->testTmpFilepath = sys_get_temp_dir().DIRECTORY_SEPARATOR.'php_generator.'.$this->getName().'.php';
|
||||||
|
$this->largeTestTmpFilepath = sys_get_temp_dir().DIRECTORY_SEPARATOR.'php_generator.'.$this->getName().'.large.php';
|
||||||
@unlink($this->testTmpFilepath);
|
@unlink($this->testTmpFilepath);
|
||||||
|
@unlink($this->largeTestTmpFilepath);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function tearDown()
|
protected function tearDown()
|
||||||
@ -76,6 +83,33 @@ class PhpGeneratorDumperTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals($relativeUrlWithoutParameter, '/app.php/testing2');
|
$this->assertEquals($relativeUrlWithoutParameter, '/app.php/testing2');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testDumpWithTooManyRoutes()
|
||||||
|
{
|
||||||
|
$this->routeCollection->add('Test', new Route('/testing/{foo}'));
|
||||||
|
for ( $i = 0; $i < 32769; ++$i ) {
|
||||||
|
$this->routeCollection->add('route_'.$i, new Route('/route_'.$i));
|
||||||
|
}
|
||||||
|
$this->routeCollection->add('Test2', new Route('/testing2'));
|
||||||
|
|
||||||
|
$data = $this->generatorDumper->dump(array(
|
||||||
|
'class' => 'ProjectLargeUrlGenerator',
|
||||||
|
));
|
||||||
|
file_put_contents($this->largeTestTmpFilepath, $data);
|
||||||
|
include $this->largeTestTmpFilepath;
|
||||||
|
|
||||||
|
$projectUrlGenerator = new \ProjectLargeUrlGenerator(new RequestContext('/app.php'));
|
||||||
|
|
||||||
|
$absoluteUrlWithParameter = $projectUrlGenerator->generate('Test', array('foo' => 'bar'), UrlGeneratorInterface::ABSOLUTE_URL);
|
||||||
|
$absoluteUrlWithoutParameter = $projectUrlGenerator->generate('Test2', array(), UrlGeneratorInterface::ABSOLUTE_URL);
|
||||||
|
$relativeUrlWithParameter = $projectUrlGenerator->generate('Test', array('foo' => 'bar'), UrlGeneratorInterface::ABSOLUTE_PATH);
|
||||||
|
$relativeUrlWithoutParameter = $projectUrlGenerator->generate('Test2', array(), UrlGeneratorInterface::ABSOLUTE_PATH);
|
||||||
|
|
||||||
|
$this->assertEquals($absoluteUrlWithParameter, 'http://localhost/app.php/testing/bar');
|
||||||
|
$this->assertEquals($absoluteUrlWithoutParameter, 'http://localhost/app.php/testing2');
|
||||||
|
$this->assertEquals($relativeUrlWithParameter, '/app.php/testing/bar');
|
||||||
|
$this->assertEquals($relativeUrlWithoutParameter, '/app.php/testing2');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException \InvalidArgumentException
|
* @expectedException \InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
|
@ -10,7 +10,8 @@ CHANGELOG
|
|||||||
2.8.0
|
2.8.0
|
||||||
-----
|
-----
|
||||||
|
|
||||||
* Deprecated usage of @ and \` at the beginning of an unquoted string
|
* Deprecated usage of a colon in an unquoted mapping value
|
||||||
|
* Deprecated usage of @, \`, | and > at the beginning of an unquoted string
|
||||||
* Deprecated non-escaped \ in double-quoted strings when parsing Yaml
|
* Deprecated non-escaped \ in double-quoted strings when parsing Yaml
|
||||||
("Foo\Var" is not valid whereas "Foo\\Var" is)
|
("Foo\Var" is not valid whereas "Foo\\Var" is)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user