Merge branch '4.0'
* 4.0: (28 commits) [DI] Add tests for EnvVarProcessor typo [Bridge\PhpUnit] Fix #26430 Cannot autoload listeners Make sure we always render errors. Eventhough labels are disabled Make sure form errors is valid HTML [HttpKernel] Allow generators in registerBundle [TwigBundle] document TwigRenderer BC break in UPGRADE-3.4 Extra line to bootstrap 3 horizontal layout [Serializer] Remove const override Update Client.php [PhpUnitBridge] Ability to use different composer.json file [DomCrawler] FormField: remove an useless return statement [Config] ReflectionClassResource check abstract ServiceSubscriberInterface and EventSubscriberInterface Display the Welcome Page when there is no homepage defined [DI] Remove dead dumper check Make KernelInterface docblock more fit for bundle-less environment fix regression when extending the Container class without a constructor fix the updating of timestamp in the MemcachedSessionHandler [SecurityBundle] Make extra character non mandatory in regex [Config] Add characters to the regex ...
This commit is contained in:
commit
5e5216017a
@ -7,6 +7,15 @@ in 4.0 minor versions.
|
||||
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
|
||||
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v4.0.0...v4.0.1
|
||||
|
||||
* 4.0.6 (2018-03-05)
|
||||
|
||||
* bug #26393 [DI] Skip resource tracking if disabled (chalasr)
|
||||
* bug #26403 fix the handling of timestamp in the MongoDBSessionHandler (hjanuschka)
|
||||
* bug #26355 [DI] Fix missing "id" normalization when dumping the container (nicolas-grekas)
|
||||
* bug #26368 [WebProfilerBundle] Fix Debug toolbar breaks app (xkobal)
|
||||
* bug #26369 Use fill instead of style for svg colors (rpkamp)
|
||||
* bug #26358 [FrameworkBundle] Silence "Failed to remove directory" on cache:clear (nicolas-grekas)
|
||||
|
||||
* 4.0.5 (2018-03-01)
|
||||
|
||||
* bug #26327 [Form][WCAG] Errors sign for people that do not see colors (Nyholm)
|
||||
|
@ -18,3 +18,9 @@ if (class_exists('PHPUnit_Runner_Version') && version_compare(\PHPUnit_Runner_Ve
|
||||
} else {
|
||||
class_alias('Symfony\Bridge\PhpUnit\Legacy\CoverageListenerForV7', 'Symfony\Bridge\PhpUnit\CoverageListener');
|
||||
}
|
||||
|
||||
if (false) {
|
||||
class CoverageListener
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -18,3 +18,9 @@ if (class_exists('PHPUnit_Runner_Version') && version_compare(\PHPUnit_Runner_Ve
|
||||
} else {
|
||||
class_alias('Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerForV7', 'Symfony\Bridge\PhpUnit\SymfonyTestsListener');
|
||||
}
|
||||
|
||||
if (false) {
|
||||
class SymfonyTestsListener
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -26,8 +26,13 @@ if (PHP_VERSION_ID >= 70200) {
|
||||
$PHPUNIT_VERSION = '4.8';
|
||||
}
|
||||
|
||||
if ('composer.json' !== $COMPOSER_JSON = getenv('COMPOSER') ?: 'composer.json') {
|
||||
putenv('COMPOSER=composer.json');
|
||||
$_SERVER['COMPOSER'] = $_ENV['COMPOSER'] = 'composer.json';
|
||||
}
|
||||
|
||||
$root = __DIR__;
|
||||
while (!file_exists($root.'/composer.json') || file_exists($root.'/DeprecationErrorHandler.php')) {
|
||||
while (!file_exists($root.'/'.$COMPOSER_JSON) || file_exists($root.'/DeprecationErrorHandler.php')) {
|
||||
if ($root === dirname($root)) {
|
||||
break;
|
||||
}
|
||||
|
@ -62,4 +62,4 @@ col-sm-10
|
||||
{{- form_errors(form) -}}
|
||||
</div>{#--#}
|
||||
</div>
|
||||
{%- endblock checkbox_row %}
|
||||
{%- endblock checkbox_row %}
|
||||
|
@ -203,7 +203,13 @@
|
||||
{% set label = name|humanize %}
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
<{{ element|default('label') }}{% if label_attr %}{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}>{{ translation_domain is same as(false) ? label : label|trans({}, translation_domain) }}{{- form_errors(form) -}}</{{ element|default('label') }}>
|
||||
<{{ element|default('label') }}{% if label_attr %}{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}>{{ translation_domain is same as(false) ? label : label|trans({}, translation_domain) }}{% block form_label_errors %}{{- form_errors(form) -}}{% endblock form_label_errors %}</{{ element|default('label') }}>
|
||||
{%- else -%}
|
||||
{%- if errors|length > 0 -%}
|
||||
<div id="{{ id }}_errors" class="mb-2">
|
||||
{{- form_errors(form) -}}
|
||||
</div>
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
{%- endblock form_label %}
|
||||
|
||||
@ -261,12 +267,12 @@
|
||||
|
||||
{% block form_errors -%}
|
||||
{%- if errors|length > 0 -%}
|
||||
<div class="{% if form is not rootform %}invalid-feedback d-block{% else %}alert alert-danger{% endif %}">
|
||||
<ul class="list-unstyled mb-0">
|
||||
{%- for error in errors -%}
|
||||
<li><span class="initialism form-error-icon badge badge-danger">{{ 'Error'|trans({}, 'validators') }}</span> <span class="form-error-message">{{ error.message }}</span></li>
|
||||
{%- endfor -%}
|
||||
</ul>
|
||||
</div>
|
||||
<span class="{% if form is not rootform %}invalid-feedback d-block{% else %}alert alert-danger{% endif %}">
|
||||
{%- for error in errors -%}
|
||||
<span class="mb-0 d-block">
|
||||
<span class="initialism form-error-icon badge badge-danger">{{ 'Error'|trans({}, 'validators') }}</span> <span class="form-error-message">{{ error.message }}</span>
|
||||
</span>
|
||||
{%- endfor -%}
|
||||
</span>
|
||||
{%- endif %}
|
||||
{%- endblock form_errors %}
|
||||
|
@ -317,7 +317,14 @@
|
||||
</td>
|
||||
<td>
|
||||
{% if decision.attributes|length == 1 %}
|
||||
{{ decision.attributes|first }}
|
||||
{% set attribute = decision.attributes|first %}
|
||||
{% if attribute.expression is defined %}
|
||||
Expression: <pre><code>{{ attribute.expression }}</code></pre>
|
||||
{% elseif attribute.type == 'string' %}
|
||||
{{ attribute }}
|
||||
{% else %}
|
||||
{{ profiler_dump(attribute) }}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{{ profiler_dump(decision.attributes) }}
|
||||
{% endif %}
|
||||
|
@ -86,7 +86,7 @@ class UserPasswordEncoderCommandTest extends WebTestCase
|
||||
$this->assertContains('Password encoding succeeded', $output);
|
||||
|
||||
$encoder = new Argon2iPasswordEncoder();
|
||||
preg_match('# Encoded password\s+(\$argon2id\$[\w\d,=\$+\/]+={0,2})\s+#', $output, $matches);
|
||||
preg_match('# Encoded password\s+(\$argon2id?\$[\w\d,=\$+\/]+={0,2})\s+#', $output, $matches);
|
||||
$hash = $matches[1];
|
||||
$this->assertTrue($encoder->isPasswordValid($hash, 'password', null));
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ abstract class Client
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the maximum number of requests that crawler can follow.
|
||||
* Sets the maximum number of redirects that crawler can follow.
|
||||
*
|
||||
* @param int $maxRedirects
|
||||
*/
|
||||
@ -90,7 +90,7 @@ abstract class Client
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the maximum number of requests that crawler can follow.
|
||||
* Returns the maximum number of redirects that crawler can follow.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
|
@ -148,12 +148,16 @@ class ReflectionClassResource implements SelfCheckingResourceInterface, \Seriali
|
||||
yield print_r($defaults, true);
|
||||
}
|
||||
|
||||
if ($class->isSubclassOf(EventSubscriberInterface::class)) {
|
||||
if ($class->isAbstract() || $class->isInterface() || $class->isTrait()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (interface_exists(EventSubscriberInterface::class, false) && $class->isSubclassOf(EventSubscriberInterface::class)) {
|
||||
yield EventSubscriberInterface::class;
|
||||
yield print_r(\call_user_func(array($class->name, 'getSubscribedEvents')), true);
|
||||
}
|
||||
|
||||
if ($class->isSubclassOf(ServiceSubscriberInterface::class)) {
|
||||
if (interface_exists(ServiceSubscriberInterface::class, false) && $class->isSubclassOf(ServiceSubscriberInterface::class)) {
|
||||
yield ServiceSubscriberInterface::class;
|
||||
yield print_r(\call_user_func(array($class->name, 'getSubscribedServices')), true);
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ class XmlUtilsTest extends TestCase
|
||||
XmlUtils::loadFile($fixtures.'valid.xml', array($mock, 'validate'));
|
||||
$this->fail();
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
$this->assertRegExp('/The XML file "[\w:\/\\\.-]+" is not valid\./', $e->getMessage());
|
||||
$this->assertRegExp('/The XML file "[\w:\/\\\.~+-]+" is not valid\./', $e->getMessage());
|
||||
}
|
||||
|
||||
$this->assertInstanceOf('DOMDocument', XmlUtils::loadFile($fixtures.'valid.xml', array($mock, 'validate')));
|
||||
|
@ -935,9 +935,13 @@ EOF;
|
||||
|
||||
if (Container::class !== $baseClassWithNamespace) {
|
||||
$r = $this->container->getReflectionClass($baseClassWithNamespace, false);
|
||||
|
||||
if (null !== $r && (null !== $constructor = $r->getConstructor()) && 0 === $constructor->getNumberOfRequiredParameters()) {
|
||||
$code .= " parent::__construct();\n\n";
|
||||
if (null !== $r
|
||||
&& (null !== $constructor = $r->getConstructor())
|
||||
&& 0 === $constructor->getNumberOfRequiredParameters()
|
||||
&& Container::class !== $constructor->getDeclaringClass()->name
|
||||
) {
|
||||
$code .= " parent::__construct();\n";
|
||||
$code .= " \$this->parameterBag = null;\n\n";
|
||||
}
|
||||
}
|
||||
|
||||
@ -1619,7 +1623,7 @@ EOF;
|
||||
|
||||
private function dumpParameter(string $name): string
|
||||
{
|
||||
if ($this->container->isCompiled() && $this->container->hasParameter($name)) {
|
||||
if ($this->container->hasParameter($name)) {
|
||||
$value = $this->container->getParameter($name);
|
||||
$dumpedValue = $this->dumpValue($value, false);
|
||||
|
||||
|
@ -0,0 +1,304 @@
|
||||
<?php
|
||||
|
||||
namespace Symfony\Component\DependencyInjection\Tests;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\DependencyInjection\Container;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\EnvVarProcessor;
|
||||
|
||||
class EnvVarProcessorTest extends TestCase
|
||||
{
|
||||
const TEST_CONST = 'test';
|
||||
|
||||
/**
|
||||
* @dataProvider validStrings
|
||||
*/
|
||||
public function testGetEnvString($value, $processed)
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
$container->setParameter('env(foo)', $value);
|
||||
$container->compile();
|
||||
|
||||
$processor = new EnvVarProcessor($container);
|
||||
|
||||
$result = $processor->getEnv('string', 'foo', function () {
|
||||
$this->fail('Should not be called');
|
||||
});
|
||||
|
||||
$this->assertSame($processed, $result);
|
||||
}
|
||||
|
||||
public function validStrings()
|
||||
{
|
||||
return array(
|
||||
array('hello', 'hello'),
|
||||
array('true', 'true'),
|
||||
array('false', 'false'),
|
||||
array('null', 'null'),
|
||||
array('1', '1'),
|
||||
array('0', '0'),
|
||||
array('1.1', '1.1'),
|
||||
array('1e1', '1e1'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider validBools
|
||||
*/
|
||||
public function testGetEnvBool($value, $processed)
|
||||
{
|
||||
$processor = new EnvVarProcessor(new Container());
|
||||
|
||||
$result = $processor->getEnv('bool', 'foo', function ($name) use ($value) {
|
||||
$this->assertSame('foo', $name);
|
||||
|
||||
return $value;
|
||||
});
|
||||
|
||||
$this->assertSame($processed, $result);
|
||||
}
|
||||
|
||||
public function validBools()
|
||||
{
|
||||
return array(
|
||||
array('true', true),
|
||||
array('false', false),
|
||||
array('null', false),
|
||||
array('1', true),
|
||||
array('0', false),
|
||||
array('1.1', true),
|
||||
array('1e1', true),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider validInts
|
||||
*/
|
||||
public function testGetEnvInt($value, $processed)
|
||||
{
|
||||
$processor = new EnvVarProcessor(new Container());
|
||||
|
||||
$result = $processor->getEnv('int', 'foo', function ($name) use ($value) {
|
||||
$this->assertSame('foo', $name);
|
||||
|
||||
return $value;
|
||||
});
|
||||
|
||||
$this->assertSame($processed, $result);
|
||||
}
|
||||
|
||||
public function validInts()
|
||||
{
|
||||
return array(
|
||||
array('1', 1),
|
||||
array('1.1', 1),
|
||||
array('1e1', 10),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
|
||||
* @expectedExceptionMessage Non-numeric env var
|
||||
* @dataProvider invalidInts
|
||||
*/
|
||||
public function testGetEnvIntInvalid($value)
|
||||
{
|
||||
$processor = new EnvVarProcessor(new Container());
|
||||
|
||||
$processor->getEnv('int', 'foo', function ($name) use ($value) {
|
||||
$this->assertSame('foo', $name);
|
||||
|
||||
return $value;
|
||||
});
|
||||
}
|
||||
|
||||
public function invalidInts()
|
||||
{
|
||||
return array(
|
||||
array('foo'),
|
||||
array('true'),
|
||||
array('null'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider validFloats
|
||||
*/
|
||||
public function testGetEnvFloat($value, $processed)
|
||||
{
|
||||
$processor = new EnvVarProcessor(new Container());
|
||||
|
||||
$result = $processor->getEnv('float', 'foo', function ($name) use ($value) {
|
||||
$this->assertSame('foo', $name);
|
||||
|
||||
return $value;
|
||||
});
|
||||
|
||||
$this->assertSame($processed, $result);
|
||||
}
|
||||
|
||||
public function validFloats()
|
||||
{
|
||||
return array(
|
||||
array('1', 1.0),
|
||||
array('1.1', 1.1),
|
||||
array('1e1', 10.0),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
|
||||
* @expectedExceptionMessage Non-numeric env var
|
||||
* @dataProvider invalidFloats
|
||||
*/
|
||||
public function testGetEnvFloatInvalid($value)
|
||||
{
|
||||
$processor = new EnvVarProcessor(new Container());
|
||||
|
||||
$processor->getEnv('float', 'foo', function ($name) use ($value) {
|
||||
$this->assertSame('foo', $name);
|
||||
|
||||
return $value;
|
||||
});
|
||||
}
|
||||
|
||||
public function invalidFloats()
|
||||
{
|
||||
return array(
|
||||
array('foo'),
|
||||
array('true'),
|
||||
array('null'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider validConsts
|
||||
*/
|
||||
public function testGetEnvConst($value, $processed)
|
||||
{
|
||||
$processor = new EnvVarProcessor(new Container());
|
||||
|
||||
$result = $processor->getEnv('const', 'foo', function ($name) use ($value) {
|
||||
$this->assertSame('foo', $name);
|
||||
|
||||
return $value;
|
||||
});
|
||||
|
||||
$this->assertSame($processed, $result);
|
||||
}
|
||||
|
||||
public function validConsts()
|
||||
{
|
||||
return array(
|
||||
array('Symfony\Component\DependencyInjection\Tests\EnvVarProcessorTest::TEST_CONST', self::TEST_CONST),
|
||||
array('E_ERROR', E_ERROR),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
|
||||
* @expectedExceptionMessage undefined constant
|
||||
* @dataProvider invalidConsts
|
||||
*/
|
||||
public function testGetEnvConstInvalid($value)
|
||||
{
|
||||
$processor = new EnvVarProcessor(new Container());
|
||||
|
||||
$processor->getEnv('const', 'foo', function ($name) use ($value) {
|
||||
$this->assertSame('foo', $name);
|
||||
|
||||
return $value;
|
||||
});
|
||||
}
|
||||
|
||||
public function invalidConsts()
|
||||
{
|
||||
return array(
|
||||
array('Symfony\Component\DependencyInjection\Tests\EnvVarProcessorTest::UNDEFINED_CONST'),
|
||||
array('UNDEFINED_CONST'),
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetEnvBase64()
|
||||
{
|
||||
$processor = new EnvVarProcessor(new Container());
|
||||
|
||||
$result = $processor->getEnv('base64', 'foo', function ($name) {
|
||||
$this->assertSame('foo', $name);
|
||||
|
||||
return base64_encode('hello');
|
||||
});
|
||||
|
||||
$this->assertSame('hello', $result);
|
||||
}
|
||||
|
||||
public function testGetEnvJson()
|
||||
{
|
||||
$processor = new EnvVarProcessor(new Container());
|
||||
|
||||
$result = $processor->getEnv('json', 'foo', function ($name) {
|
||||
$this->assertSame('foo', $name);
|
||||
|
||||
return json_encode(array(1));
|
||||
});
|
||||
|
||||
$this->assertSame(array(1), $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
|
||||
* @expectedExceptionMessage Syntax error
|
||||
*/
|
||||
public function testGetEnvInvalidJson()
|
||||
{
|
||||
$processor = new EnvVarProcessor(new Container());
|
||||
|
||||
$processor->getEnv('json', 'foo', function ($name) {
|
||||
$this->assertSame('foo', $name);
|
||||
|
||||
return 'invalid_json';
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
|
||||
* @expectedExceptionMessage Invalid JSON env var
|
||||
* @dataProvider otherJsonValues
|
||||
*/
|
||||
public function testGetEnvJsonOther($value)
|
||||
{
|
||||
$processor = new EnvVarProcessor(new Container());
|
||||
|
||||
$processor->getEnv('json', 'foo', function ($name) use ($value) {
|
||||
$this->assertSame('foo', $name);
|
||||
|
||||
return json_encode($value);
|
||||
});
|
||||
}
|
||||
|
||||
public function otherJsonValues()
|
||||
{
|
||||
return array(
|
||||
array(1),
|
||||
array(1.1),
|
||||
array(true),
|
||||
array(false),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
|
||||
* @expectedExceptionMessage Unsupported env var prefix
|
||||
*/
|
||||
public function testGetEnvUnknown()
|
||||
{
|
||||
$processor = new EnvVarProcessor(new Container());
|
||||
|
||||
$processor->getEnv('unknown', 'foo', function ($name) {
|
||||
$this->assertSame('foo', $name);
|
||||
|
||||
return 'foo';
|
||||
});
|
||||
}
|
||||
}
|
@ -2,6 +2,8 @@
|
||||
|
||||
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\Container;
|
||||
|
||||
class NoConstructorContainer
|
||||
use Symfony\Component\DependencyInjection\Container;
|
||||
|
||||
class NoConstructorContainer extends Container
|
||||
{
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ class ProjectServiceContainer extends \Symfony\Component\DependencyInjection\Tes
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->parameterBag = null;
|
||||
|
||||
$this->services = $this->privates = array();
|
||||
|
||||
|
@ -29,6 +29,7 @@ class ProjectServiceContainer extends \Symfony\Component\DependencyInjection\Tes
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->parameterBag = null;
|
||||
|
||||
$this->services = $this->privates = array();
|
||||
|
||||
|
@ -75,8 +75,6 @@ abstract class FormField
|
||||
if ($labels->length > 0) {
|
||||
return $labels->item(0);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -32,14 +32,12 @@ abstract class AbstractBootstrap4HorizontalLayoutTest extends AbstractBootstrap4
|
||||
[
|
||||
./label[@for="name"]
|
||||
[
|
||||
./div[
|
||||
./ul
|
||||
[./li
|
||||
[./span[.="[trans]Error[/trans]"]]
|
||||
[./span[.="[trans]Error![/trans]"]]
|
||||
]
|
||||
[count(./li)=1]
|
||||
]
|
||||
./span[@class="alert alert-danger"]
|
||||
[./span[@class="mb-0 d-block"]
|
||||
[./span[.="[trans]Error[/trans]"]]
|
||||
[./span[.="[trans]Error![/trans]"]]
|
||||
]
|
||||
[count(./span)=1]
|
||||
]
|
||||
/following-sibling::div[./input[@id="name"]]
|
||||
]
|
||||
|
@ -32,14 +32,12 @@ abstract class AbstractBootstrap4LayoutTest extends AbstractBootstrap3LayoutTest
|
||||
[
|
||||
./label[@for="name"]
|
||||
[
|
||||
./div[
|
||||
./ul
|
||||
[./li
|
||||
[./span[.="[trans]Error[/trans]"]]
|
||||
[./span[.="[trans]Error![/trans]"]]
|
||||
]
|
||||
[count(./li)=1]
|
||||
]
|
||||
./span[@class="alert alert-danger"]
|
||||
[./span[@class="mb-0 d-block"]
|
||||
[./span[.="[trans]Error[/trans]"]]
|
||||
[./span[.="[trans]Error![/trans]"]]
|
||||
]
|
||||
[count(./span)=1]
|
||||
]
|
||||
/following-sibling::input[@id="name"]
|
||||
]
|
||||
@ -162,26 +160,32 @@ abstract class AbstractBootstrap4LayoutTest extends AbstractBootstrap3LayoutTest
|
||||
$html = $this->renderErrors($view);
|
||||
|
||||
$this->assertMatchesXpath($html,
|
||||
'/div
|
||||
'/span
|
||||
[@class="alert alert-danger"]
|
||||
[
|
||||
./ul
|
||||
[@class="list-unstyled mb-0"]
|
||||
[
|
||||
./li
|
||||
[./span[.="[trans]Error[/trans]"]]
|
||||
[./span[.="[trans]Error 1[/trans]"]]
|
||||
|
||||
/following-sibling::li
|
||||
[./span[.="[trans]Error[/trans]"]]
|
||||
[./span[.="[trans]Error 2[/trans]"]]
|
||||
]
|
||||
[count(./li)=2]
|
||||
./span[@class="mb-0 d-block"]
|
||||
[./span[.="[trans]Error[/trans]"]]
|
||||
[./span[.="[trans]Error 1[/trans]"]]
|
||||
|
||||
/following-sibling::span[@class="mb-0 d-block"]
|
||||
[./span[.="[trans]Error[/trans]"]]
|
||||
[./span[.="[trans]Error 2[/trans]"]]
|
||||
]
|
||||
[count(./span)=2]
|
||||
'
|
||||
);
|
||||
}
|
||||
|
||||
public function testErrorWithNoLabel()
|
||||
{
|
||||
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', array('label'=>false));
|
||||
$form->addError(new FormError('[trans]Error 1[/trans]'));
|
||||
$view = $form->createView();
|
||||
$html = $this->renderLabel($view);
|
||||
|
||||
$this->assertMatchesXpath($html, '//span[.="[trans]Error[/trans]"]');
|
||||
}
|
||||
|
||||
public function testCheckedCheckbox()
|
||||
{
|
||||
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType', true);
|
||||
|
@ -80,7 +80,9 @@ class MemcachedSessionHandler extends AbstractSessionHandler
|
||||
*/
|
||||
public function updateTimestamp($sessionId, $data)
|
||||
{
|
||||
return $this->memcached->touch($this->prefix.$sessionId, time() + $this->ttl);
|
||||
$this->memcached->touch($this->prefix.$sessionId, time() + $this->ttl);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -18,7 +18,7 @@ use Symfony\Component\Config\Loader\LoaderInterface;
|
||||
/**
|
||||
* The Kernel is the heart of the Symfony system.
|
||||
*
|
||||
* It manages an environment made of bundles.
|
||||
* It manages an environment made of application kernel and bundles.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
@ -27,7 +27,7 @@ interface KernelInterface extends HttpKernelInterface, \Serializable
|
||||
/**
|
||||
* Returns an array of bundles to register.
|
||||
*
|
||||
* @return BundleInterface[] An array of bundle instances
|
||||
* @return iterable|BundleInterface[] An iterable of bundle instances
|
||||
*/
|
||||
public function registerBundles();
|
||||
|
||||
@ -67,7 +67,7 @@ interface KernelInterface extends HttpKernelInterface, \Serializable
|
||||
public function getBundle($name);
|
||||
|
||||
/**
|
||||
* Returns the file path for a given resource.
|
||||
* Returns the file path for a given bundle resource.
|
||||
*
|
||||
* A Resource can be a file or a directory.
|
||||
*
|
||||
|
@ -76,7 +76,7 @@
|
||||
</div>
|
||||
<div id="comment">
|
||||
<p>
|
||||
You're seeing this message because you have debug mode enabled and you haven't configured any URLs.
|
||||
You're seeing this page because debug mode is enabled and you haven't configured any homepage URL.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -193,11 +193,10 @@ EOF
|
||||
}
|
||||
}
|
||||
|
||||
if ('' === $code) {
|
||||
$code .= " if ('/' === \$pathinfo) {\n";
|
||||
$code .= " throw new Symfony\Component\Routing\Exception\NoConfigurationException();\n";
|
||||
$code .= " }\n";
|
||||
}
|
||||
// used to display the Welcome Page in apps that don't define a homepage
|
||||
$code .= " if ('/' === \$pathinfo) {\n";
|
||||
$code .= " throw new Symfony\Component\Routing\Exception\NoConfigurationException();\n";
|
||||
$code .= " }\n";
|
||||
|
||||
return $code;
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface
|
||||
return $ret;
|
||||
}
|
||||
|
||||
if (0 === count($this->routes) && '/' === $pathinfo) {
|
||||
if ('/' === $pathinfo) {
|
||||
throw new NoConfigurationException();
|
||||
}
|
||||
|
||||
|
@ -238,6 +238,9 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
|
||||
$offset += strlen($m);
|
||||
}
|
||||
}
|
||||
if ('/' === $pathinfo) {
|
||||
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
|
||||
}
|
||||
|
||||
throw $allow ? new MethodNotAllowedException(array_keys($allow)) : new ResourceNotFoundException();
|
||||
}
|
||||
|
@ -2821,6 +2821,9 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
|
||||
$offset += strlen($m);
|
||||
}
|
||||
}
|
||||
if ('/' === $pathinfo) {
|
||||
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
|
||||
}
|
||||
|
||||
throw $allow ? new MethodNotAllowedException(array_keys($allow)) : new ResourceNotFoundException();
|
||||
}
|
||||
|
@ -146,6 +146,9 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
|
||||
$offset += strlen($m);
|
||||
}
|
||||
}
|
||||
if ('/' === $pathinfo) {
|
||||
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -91,6 +91,9 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
|
||||
$offset += strlen($m);
|
||||
}
|
||||
}
|
||||
if ('/' === $pathinfo) {
|
||||
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
|
||||
}
|
||||
|
||||
throw $allow ? new MethodNotAllowedException(array_keys($allow)) : new ResourceNotFoundException();
|
||||
}
|
||||
|
@ -60,6 +60,9 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
|
||||
$offset += strlen($m);
|
||||
}
|
||||
}
|
||||
if ('/' === $pathinfo) {
|
||||
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
|
||||
}
|
||||
|
||||
throw $allow ? new MethodNotAllowedException(array_keys($allow)) : new ResourceNotFoundException();
|
||||
}
|
||||
|
@ -275,6 +275,9 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
|
||||
$offset += strlen($m);
|
||||
}
|
||||
}
|
||||
if ('/' === $pathinfo) {
|
||||
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -103,6 +103,9 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
|
||||
$offset += strlen($m);
|
||||
}
|
||||
}
|
||||
if ('/' === $pathinfo) {
|
||||
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
|
||||
}
|
||||
|
||||
throw $allow ? new MethodNotAllowedException(array_keys($allow)) : new ResourceNotFoundException();
|
||||
}
|
||||
|
@ -75,6 +75,10 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
|
||||
return $ret;
|
||||
}
|
||||
|
||||
if ('/' === $pathinfo) {
|
||||
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
|
||||
}
|
||||
|
||||
throw $allow ? new MethodNotAllowedException(array_keys($allow)) : new ResourceNotFoundException();
|
||||
}
|
||||
}
|
||||
|
@ -145,6 +145,9 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
|
||||
$offset += strlen($m);
|
||||
}
|
||||
}
|
||||
if ('/' === $pathinfo) {
|
||||
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -122,6 +122,9 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
|
||||
$offset += strlen($m);
|
||||
}
|
||||
}
|
||||
if ('/' === $pathinfo) {
|
||||
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
|
||||
}
|
||||
|
||||
throw $allow ? new MethodNotAllowedException(array_keys($allow)) : new ResourceNotFoundException();
|
||||
}
|
||||
|
@ -157,6 +157,9 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
|
||||
$offset += strlen($m);
|
||||
}
|
||||
}
|
||||
if ('/' === $pathinfo) {
|
||||
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -79,6 +79,9 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
|
||||
$offset += strlen($m);
|
||||
}
|
||||
}
|
||||
if ('/' === $pathinfo) {
|
||||
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
|
||||
}
|
||||
|
||||
throw $allow ? new MethodNotAllowedException(array_keys($allow)) : new ResourceNotFoundException();
|
||||
}
|
||||
|
@ -44,6 +44,10 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
|
||||
break;
|
||||
}
|
||||
|
||||
if ('/' === $pathinfo) {
|
||||
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
|
||||
}
|
||||
|
||||
throw $allow ? new MethodNotAllowedException(array_keys($allow)) : new ResourceNotFoundException();
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,6 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer
|
||||
{
|
||||
const ENABLE_MAX_DEPTH = 'enable_max_depth';
|
||||
const DEPTH_KEY_PATTERN = 'depth_%s::%s';
|
||||
const ALLOW_EXTRA_ATTRIBUTES = 'allow_extra_attributes';
|
||||
const DISABLE_TYPE_ENFORCEMENT = 'disable_type_enforcement';
|
||||
|
||||
private $propertyTypeExtractor;
|
||||
|
Reference in New Issue
Block a user