Merge branch '2.6' into 2.7
* 2.6: Php Inspections (EA Extended): squash all PR-13813 commits replaced the last remaining is_integer() call [2.3] [Config] [Console] [DependencyInjection] [DomCrawler] [Form] [HttpKernel] [PropertyAccess] [Security] [Translation] [Yaml] static code analysis, code cleanup [FrameworkBundle] simplify dep declaration [VarDumper] Fix "next element is already occupied" [Validator] Added missing galician (gl) translations [PropertyAccess] stop overwriting once a reference is reached (3rd) [OptionsResolver] Remove Unused Variable from Foreach Cycles [travis] Tests Security sub-components [Twig] bootstrap_3_layout.html.twig is usable as a trait [travis] Tests Security sub-components CS fixes [TwigBridge] Bootstrap Layout - Fix the label of checkbox cannot be empty [travis] test with php nightly Conflicts: .travis.yml src/Symfony/Bundle/FrameworkBundle/composer.json src/Symfony/Component/Security/Http/Tests/Firewall/ExceptionListenerTest.php src/Symfony/Component/Security/Http/Tests/Firewall/RememberMeListenerTest.php
This commit is contained in:
commit
0f00f7c7e8
21
.travis.yml
21
.travis.yml
@ -10,8 +10,10 @@ matrix:
|
|||||||
env: deps=low
|
env: deps=low
|
||||||
- php: 5.6
|
- php: 5.6
|
||||||
env: deps=high
|
env: deps=high
|
||||||
|
- php: nightly
|
||||||
- php: hhvm-nightly
|
- php: hhvm-nightly
|
||||||
allow_failures:
|
allow_failures:
|
||||||
|
- php: nightly
|
||||||
- php: hhvm-nightly
|
- php: hhvm-nightly
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
|
|
||||||
@ -25,12 +27,12 @@ env:
|
|||||||
before_install:
|
before_install:
|
||||||
- travis_retry sudo apt-get install parallel
|
- travis_retry sudo apt-get install parallel
|
||||||
- composer self-update
|
- composer self-update
|
||||||
- if [ "$TRAVIS_PHP_VERSION" != "hhvm-nightly" ]; then phpenv config-rm xdebug.ini; fi;
|
- if [[ "$TRAVIS_PHP_VERSION" != *"nightly" ]]; then phpenv config-rm xdebug.ini; fi;
|
||||||
- if [ "$TRAVIS_PHP_VERSION" != "hhvm-nightly" ]; then echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;
|
- if [[ "$TRAVIS_PHP_VERSION" != *"nightly" ]]; then echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;
|
||||||
- if [ "$TRAVIS_PHP_VERSION" != "hhvm-nightly" ] && [ $(php -r "echo PHP_MINOR_VERSION;") -le 4 ]; then echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;
|
- if [[ "$TRAVIS_PHP_VERSION" != *"nightly" ]] && [ $(php -r "echo PHP_MINOR_VERSION;") -le 4 ]; then echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;
|
||||||
- if [ "$TRAVIS_PHP_VERSION" != "hhvm-nightly" ]; then pecl install -f memcached-2.1.0; fi;
|
- if [[ "$TRAVIS_PHP_VERSION" != *"nightly" ]]; then pecl install -f memcached-2.1.0; fi;
|
||||||
- if [ "$TRAVIS_PHP_VERSION" != "hhvm-nightly" ]; then echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;
|
- if [[ "$TRAVIS_PHP_VERSION" != *"nightly" ]]; then echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;
|
||||||
- if [ "$TRAVIS_PHP_VERSION" != "hhvm-nightly" ]; then php -i; fi;
|
- if [[ "$TRAVIS_PHP_VERSION" != *"nightly" ]]; then php -i; fi;
|
||||||
- sudo locale-gen fr_FR.UTF-8 && sudo update-locale
|
- sudo locale-gen fr_FR.UTF-8 && sudo update-locale
|
||||||
# Set the COMPOSER_ROOT_VERSION to the right version according to the branch being built
|
# Set the COMPOSER_ROOT_VERSION to the right version according to the branch being built
|
||||||
- if [ "$TRAVIS_BRANCH" = "master" ]; then export COMPOSER_ROOT_VERSION=dev-master; else export COMPOSER_ROOT_VERSION="$TRAVIS_BRANCH".x-dev; fi;
|
- if [ "$TRAVIS_BRANCH" = "master" ]; then export COMPOSER_ROOT_VERSION=dev-master; else export COMPOSER_ROOT_VERSION="$TRAVIS_BRANCH".x-dev; fi;
|
||||||
@ -39,8 +41,9 @@ install:
|
|||||||
- if [ "$deps" = "no" ]; then composer --prefer-source install; fi;
|
- if [ "$deps" = "no" ]; then composer --prefer-source install; fi;
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
- components=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n')
|
||||||
- if [ "$deps" = "no" ]; then export SYMFONY_DEPRECATIONS_HELPER=strict; fi;
|
- if [ "$deps" = "no" ]; then export SYMFONY_DEPRECATIONS_HELPER=strict; fi;
|
||||||
- if [ "$deps" = "no" ]; then ls -d src/Symfony/*/* | parallel --gnu --keep-order 'echo -e "\\nRunning {} tests"; phpunit --exclude-group tty,benchmark,intl-data {} || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi;
|
- if [ "$deps" = "no" ]; then echo "$components" | parallel --gnu --keep-order 'echo -e "\\nRunning {} tests"; phpunit --exclude-group tty,benchmark,intl-data {} || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi;
|
||||||
- if [ "$deps" = "no" ]; then echo -e "\\nRunning tests requiring tty"; phpunit --group tty || (echo -e "\\e[41mKO\\e[0m tty group" && $(exit 1)); fi;
|
- if [ "$deps" = "no" ]; then echo -e "\\nRunning tests requiring tty"; phpunit --group tty || (echo -e "\\e[41mKO\\e[0m tty group" && $(exit 1)); fi;
|
||||||
- if [ "$deps" = "high" ]; then find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist | sed 's#\(.*\)/.*#\1#' | parallel --gnu --keep-order -j25% 'echo -e "\\nRunning {} tests"; cd {}; composer --prefer-source update; phpunit --exclude-group tty,benchmark,intl-data,legacy || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi;
|
- if [ "$deps" = "high" ]; then echo "$components" | parallel --gnu --keep-order -j25% 'echo -e "\\nRunning {} tests"; cd {}; composer --prefer-source update; phpunit --exclude-group tty,benchmark,intl-data,legacy || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi;
|
||||||
- if [ "$deps" = "low" ]; then find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist | sed 's#\(.*\)/.*#\1#' | parallel --gnu --keep-order -j25% 'echo -e "\\nRunning {} tests"; cd {}; composer --prefer-source --prefer-lowest --prefer-stable update; phpunit --exclude-group tty,benchmark,intl-data || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi;
|
- if [ "$deps" = "low" ]; then echo "$components" | parallel --gnu --keep-order -j25% 'echo -e "\\nRunning {} tests"; cd {}; composer --prefer-source --prefer-lowest --prefer-stable update; phpunit --exclude-group tty,benchmark,intl-data || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{% extends "form_div_layout.html.twig" %}
|
{% use "form_div_layout.html.twig" %}
|
||||||
|
|
||||||
{# Widgets #}
|
{# Widgets #}
|
||||||
|
|
||||||
@ -164,12 +164,12 @@
|
|||||||
{% if parent_label_class is defined %}
|
{% if parent_label_class is defined %}
|
||||||
{% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ parent_label_class)|trim}) %}
|
{% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ parent_label_class)|trim}) %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if label is empty %}
|
{% if label is not sameas(false) and label is empty %}
|
||||||
{% set label = name|humanize %}
|
{% set label = name|humanize %}
|
||||||
{% 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) }}
|
{{ label is not sameas(false) ? label|trans({}, translation_domain) }}
|
||||||
</label>
|
</label>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock checkbox_radio_label %}
|
{% endblock checkbox_radio_label %}
|
||||||
|
@ -388,7 +388,7 @@ class Configuration implements ConfigurationInterface
|
|||||||
);
|
);
|
||||||
|
|
||||||
foreach ($urls as $i => $url) {
|
foreach ($urls as $i => $url) {
|
||||||
if (is_integer($i)) {
|
if (is_int($i)) {
|
||||||
if (0 === strpos($url, 'https://') || 0 === strpos($url, '//')) {
|
if (0 === strpos($url, 'https://') || 0 === strpos($url, '//')) {
|
||||||
$urls['http'][] = $urls['ssl'][] = $url;
|
$urls['http'][] = $urls['ssl'][] = $url;
|
||||||
} else {
|
} else {
|
||||||
|
@ -303,7 +303,7 @@ class FrameworkExtension extends Extension
|
|||||||
'memcached' => 'Symfony\Component\HttpKernel\Profiler\MemcachedProfilerStorage',
|
'memcached' => 'Symfony\Component\HttpKernel\Profiler\MemcachedProfilerStorage',
|
||||||
'redis' => 'Symfony\Component\HttpKernel\Profiler\RedisProfilerStorage',
|
'redis' => 'Symfony\Component\HttpKernel\Profiler\RedisProfilerStorage',
|
||||||
);
|
);
|
||||||
list($class, ) = explode(':', $config['dsn'], 2);
|
list($class) = explode(':', $config['dsn'], 2);
|
||||||
if (!isset($supported[$class])) {
|
if (!isset($supported[$class])) {
|
||||||
throw new \LogicException(sprintf('Driver "%s" is not supported for the profiler.', $class));
|
throw new \LogicException(sprintf('Driver "%s" is not supported for the profiler.', $class));
|
||||||
}
|
}
|
||||||
|
@ -472,7 +472,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null !== $this->key && (null === $this->addDefaultChildren || is_integer($this->addDefaultChildren) && $this->addDefaultChildren > 0)) {
|
if (null !== $this->key && (null === $this->addDefaultChildren || is_int($this->addDefaultChildren) && $this->addDefaultChildren > 0)) {
|
||||||
throw new InvalidDefinitionException(
|
throw new InvalidDefinitionException(
|
||||||
sprintf('->addDefaultChildrenIfNoneSet() should set default children names as ->useAttributeAsKey() is used at path "%s"', $path)
|
sprintf('->addDefaultChildrenIfNoneSet() should set default children names as ->useAttributeAsKey() is used at path "%s"', $path)
|
||||||
);
|
);
|
||||||
|
@ -117,7 +117,7 @@ class PrototypedArrayNode extends ArrayNode
|
|||||||
if (null === $children) {
|
if (null === $children) {
|
||||||
$this->defaultChildren = array('defaults');
|
$this->defaultChildren = array('defaults');
|
||||||
} else {
|
} else {
|
||||||
$this->defaultChildren = is_integer($children) && $children > 0 ? range(1, $children) : (array) $children;
|
$this->defaultChildren = is_int($children) && $children > 0 ? range(1, $children) : (array) $children;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,7 +222,7 @@ class XmlUtils
|
|||||||
LIBXML_ERR_WARNING == $error->level ? 'WARNING' : 'ERROR',
|
LIBXML_ERR_WARNING == $error->level ? 'WARNING' : 'ERROR',
|
||||||
$error->code,
|
$error->code,
|
||||||
trim($error->message),
|
trim($error->message),
|
||||||
$error->file ? $error->file : 'n/a',
|
$error->file ?: 'n/a',
|
||||||
$error->line,
|
$error->line,
|
||||||
$error->column
|
$error->column
|
||||||
);
|
);
|
||||||
|
@ -149,7 +149,7 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (false === array_search(static::$availableOptions[$option], $this->options)) {
|
if (!in_array(static::$availableOptions[$option], $this->options)) {
|
||||||
$this->options[] = static::$availableOptions[$option];
|
$this->options[] = static::$availableOptions[$option];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -177,7 +177,7 @@ class LegacyDialogHelperTest extends \PHPUnit_Framework_TestCase
|
|||||||
protected function getInputStream($input)
|
protected function getInputStream($input)
|
||||||
{
|
{
|
||||||
$stream = fopen('php://memory', 'r+', false);
|
$stream = fopen('php://memory', 'r+', false);
|
||||||
fputs($stream, $input);
|
fwrite($stream, $input);
|
||||||
rewind($stream);
|
rewind($stream);
|
||||||
|
|
||||||
return $stream;
|
return $stream;
|
||||||
|
@ -274,7 +274,7 @@ class QuestionHelperTest extends \PHPUnit_Framework_TestCase
|
|||||||
protected function getInputStream($input)
|
protected function getInputStream($input)
|
||||||
{
|
{
|
||||||
$stream = fopen('php://memory', 'r+', false);
|
$stream = fopen('php://memory', 'r+', false);
|
||||||
fputs($stream, $input);
|
fwrite($stream, $input);
|
||||||
rewind($stream);
|
rewind($stream);
|
||||||
|
|
||||||
return $stream;
|
return $stream;
|
||||||
|
@ -1175,7 +1175,7 @@ EOF;
|
|||||||
$behavior[$id] = $argument->getInvalidBehavior();
|
$behavior[$id] = $argument->getInvalidBehavior();
|
||||||
}
|
}
|
||||||
|
|
||||||
$calls[$id] += 1;
|
++$calls[$id];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1487,12 +1487,12 @@ EOF;
|
|||||||
}
|
}
|
||||||
|
|
||||||
while ($i > 0) {
|
while ($i > 0) {
|
||||||
$i -= 1;
|
--$i;
|
||||||
$name .= $nonFirstChars[$i%$nonFirstCharsLength];
|
$name .= $nonFirstChars[$i%$nonFirstCharsLength];
|
||||||
$i = intval($i/$nonFirstCharsLength);
|
$i = intval($i/$nonFirstCharsLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->variableCount += 1;
|
++$this->variableCount;
|
||||||
|
|
||||||
// check that the name is not reserved
|
// check that the name is not reserved
|
||||||
if (in_array($name, $this->reservedVariables, true)) {
|
if (in_array($name, $this->reservedVariables, true)) {
|
||||||
|
@ -260,7 +260,8 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase
|
|||||||
$builder->setResourceTracking(false);
|
$builder->setResourceTracking(false);
|
||||||
$builderCompilerPasses = $builder->getCompiler()->getPassConfig()->getPasses();
|
$builderCompilerPasses = $builder->getCompiler()->getPassConfig()->getPasses();
|
||||||
$builder->addCompilerPass($this->getMock('Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface'));
|
$builder->addCompilerPass($this->getMock('Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface'));
|
||||||
$this->assertEquals(sizeof($builderCompilerPasses) + 1, sizeof($builder->getCompiler()->getPassConfig()->getPasses()));
|
|
||||||
|
$this->assertCount(count($builder->getCompiler()->getPassConfig()->getPasses()) - 1, $builderCompilerPasses);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -74,8 +74,8 @@ class PhpDumperTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$container = new ContainerBuilder();
|
$container = new ContainerBuilder();
|
||||||
$container->setDefinition('test', $definition);
|
$container->setDefinition('test', $definition);
|
||||||
$container->setParameter('foo', 'wiz'.dirname(dirname(__FILE__)));
|
$container->setParameter('foo', 'wiz'.dirname(__DIR__));
|
||||||
$container->setParameter('bar', dirname(__FILE__));
|
$container->setParameter('bar', __DIR__);
|
||||||
$container->setParameter('baz', '%bar%/PhpDumperTest.php');
|
$container->setParameter('baz', '%bar%/PhpDumperTest.php');
|
||||||
$container->setParameter('buz', dirname(dirname(__DIR__)));
|
$container->setParameter('buz', dirname(dirname(__DIR__)));
|
||||||
$container->compile();
|
$container->compile();
|
||||||
|
@ -48,6 +48,7 @@ class Crawler extends \SplObjectStorage
|
|||||||
* @param mixed $node A Node to use as the base for the crawling
|
* @param mixed $node A Node to use as the base for the crawling
|
||||||
* @param string $currentUri The current URI
|
* @param string $currentUri The current URI
|
||||||
* @param string $baseHref The base href value
|
* @param string $baseHref The base href value
|
||||||
|
*
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
public function __construct($node = null, $currentUri = null, $baseHref = null)
|
public function __construct($node = null, $currentUri = null, $baseHref = null)
|
||||||
|
@ -327,7 +327,7 @@ EOF
|
|||||||
{
|
{
|
||||||
$crawler = $this->createTestCrawler()->filterXPath('//ul[1]/li');
|
$crawler = $this->createTestCrawler()->filterXPath('//ul[1]/li');
|
||||||
$nodes = $crawler->reduce(function ($node, $i) {
|
$nodes = $crawler->reduce(function ($node, $i) {
|
||||||
return $i == 1 ? false : true;
|
return $i !== 1;
|
||||||
});
|
});
|
||||||
$this->assertNotSame($nodes, $crawler, '->reduce() returns a new instance of a crawler');
|
$this->assertNotSame($nodes, $crawler, '->reduce() returns a new instance of a crawler');
|
||||||
$this->assertInstanceOf('Symfony\\Component\\DomCrawler\\Crawler', $nodes, '->reduce() returns a new instance of a crawler');
|
$this->assertInstanceOf('Symfony\\Component\\DomCrawler\\Crawler', $nodes, '->reduce() returns a new instance of a crawler');
|
||||||
|
@ -67,8 +67,7 @@ abstract class AbstractRendererEngine implements FormRendererEngineInterface
|
|||||||
// Unset instead of resetting to an empty array, in order to allow
|
// Unset instead of resetting to an empty array, in order to allow
|
||||||
// implementations (like TwigRendererEngine) to check whether $cacheKey
|
// implementations (like TwigRendererEngine) to check whether $cacheKey
|
||||||
// is set at all.
|
// is set at all.
|
||||||
unset($this->resources[$cacheKey]);
|
unset($this->resources[$cacheKey], $this->resourceHierarchyLevels[$cacheKey]);
|
||||||
unset($this->resourceHierarchyLevels[$cacheKey]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -138,8 +138,7 @@ class FormBuilder extends FormConfigBuilder implements \IteratorAggregate, FormB
|
|||||||
throw new BadMethodCallException('FormBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
|
throw new BadMethodCallException('FormBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($this->unresolvedChildren[$name]);
|
unset($this->unresolvedChildren[$name], $this->children[$name]);
|
||||||
unset($this->children[$name]);
|
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -14,10 +14,10 @@ use Symfony\Component\Form\Deprecated\FormEvents as Deprecated;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* To learn more about how form events work check the documentation
|
* To learn more about how form events work check the documentation
|
||||||
* entry at {@link http://symfony.com/doc/any/components/form/form_events.html}
|
* entry at {@link http://symfony.com/doc/any/components/form/form_events.html}.
|
||||||
*
|
*
|
||||||
* To learn how to dynamically modify forms using events check the cookbook
|
* To learn how to dynamically modify forms using events check the cookbook
|
||||||
* entry at {@link http://symfony.com/doc/any/cookbook/form/dynamic_form_modification.html}
|
* entry at {@link http://symfony.com/doc/any/cookbook/form/dynamic_form_modification.html}.
|
||||||
*
|
*
|
||||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
@ -296,8 +296,7 @@ class FormRenderer implements FormRendererInterface
|
|||||||
// Clear the caches if they were filled for the first time within
|
// Clear the caches if they were filled for the first time within
|
||||||
// this function call
|
// this function call
|
||||||
if ($hierarchyInit) {
|
if ($hierarchyInit) {
|
||||||
unset($this->blockNameHierarchyMap[$viewAndSuffixCacheKey]);
|
unset($this->blockNameHierarchyMap[$viewAndSuffixCacheKey], $this->hierarchyLevelMap[$viewAndSuffixCacheKey]);
|
||||||
unset($this->hierarchyLevelMap[$viewAndSuffixCacheKey]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($varInit) {
|
if ($varInit) {
|
||||||
|
@ -54,7 +54,7 @@ abstract class FormPerformanceTestCase extends FormIntegrationTestCase
|
|||||||
*/
|
*/
|
||||||
public function setMaxRunningTime($maxRunningTime)
|
public function setMaxRunningTime($maxRunningTime)
|
||||||
{
|
{
|
||||||
if (is_integer($maxRunningTime) && $maxRunningTime >= 0) {
|
if (is_int($maxRunningTime) && $maxRunningTime >= 0) {
|
||||||
$this->maxRunningTime = $maxRunningTime;
|
$this->maxRunningTime = $maxRunningTime;
|
||||||
} else {
|
} else {
|
||||||
throw new \InvalidArgumentException();
|
throw new \InvalidArgumentException();
|
||||||
|
@ -147,8 +147,7 @@ class RouterListener implements EventSubscriberInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
$request->attributes->add($parameters);
|
$request->attributes->add($parameters);
|
||||||
unset($parameters['_route']);
|
unset($parameters['_route'], $parameters['_controller']);
|
||||||
unset($parameters['_controller']);
|
|
||||||
$request->attributes->set('_route_params', $parameters);
|
$request->attributes->set('_route_params', $parameters);
|
||||||
} catch (ResourceNotFoundException $e) {
|
} catch (ResourceNotFoundException $e) {
|
||||||
$message = sprintf('No route found for "%s %s"', $request->getMethod(), $request->getPathInfo());
|
$message = sprintf('No route found for "%s %s"', $request->getMethod(), $request->getPathInfo());
|
||||||
|
@ -29,7 +29,7 @@ class LoggerDataCollectorTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$this->assertSame('logger', $c->getName());
|
$this->assertSame('logger', $c->getName());
|
||||||
$this->assertSame($nb, $c->countErrors());
|
$this->assertSame($nb, $c->countErrors());
|
||||||
$this->assertSame($expectedLogs ? $expectedLogs : $logs, $c->getLogs());
|
$this->assertSame($expectedLogs ?: $logs, $c->getLogs());
|
||||||
$this->assertSame($expectedDeprecationCount, $c->countDeprecations());
|
$this->assertSame($expectedDeprecationCount, $c->countDeprecations());
|
||||||
$this->assertSame($expectedScreamCount, $c->countScreams());
|
$this->assertSame($expectedScreamCount, $c->countScreams());
|
||||||
|
|
||||||
|
@ -258,7 +258,7 @@ class OptionsResolver implements Options, OptionsResolverInterface
|
|||||||
throw new AccessException('Options cannot be made required from a lazy option or normalizer.');
|
throw new AccessException('Options cannot be made required from a lazy option or normalizer.');
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ((array) $optionNames as $key => $option) {
|
foreach ((array) $optionNames as $option) {
|
||||||
$this->defined[$option] = true;
|
$this->defined[$option] = true;
|
||||||
$this->required[$option] = true;
|
$this->required[$option] = true;
|
||||||
}
|
}
|
||||||
@ -339,7 +339,7 @@ class OptionsResolver implements Options, OptionsResolverInterface
|
|||||||
throw new AccessException('Options cannot be defined from a lazy option or normalizer.');
|
throw new AccessException('Options cannot be defined from a lazy option or normalizer.');
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ((array) $optionNames as $key => $option) {
|
foreach ((array) $optionNames as $option) {
|
||||||
$this->defined[$option] = true;
|
$this->defined[$option] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -686,14 +686,8 @@ class OptionsResolver implements Options, OptionsResolverInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ((array) $optionNames as $option) {
|
foreach ((array) $optionNames as $option) {
|
||||||
unset($this->defined[$option]);
|
unset($this->defined[$option], $this->defaults[$option], $this->required[$option], $this->resolved[$option]);
|
||||||
unset($this->defaults[$option]);
|
unset($this->lazy[$option], $this->normalizers[$option], $this->allowedTypes[$option], $this->allowedValues[$option]);
|
||||||
unset($this->required[$option]);
|
|
||||||
unset($this->resolved[$option]);
|
|
||||||
unset($this->lazy[$option]);
|
|
||||||
unset($this->normalizers[$option]);
|
|
||||||
unset($this->allowedTypes[$option]);
|
|
||||||
unset($this->allowedValues[$option]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -70,7 +70,6 @@ class PropertyAccessor implements PropertyAccessorInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
$propertyValues = & $this->readPropertiesUntil($objectOrArray, $propertyPath, $propertyPath->getLength() - 1);
|
$propertyValues = & $this->readPropertiesUntil($objectOrArray, $propertyPath, $propertyPath->getLength() - 1);
|
||||||
$overwrite = true;
|
|
||||||
|
|
||||||
// Add the root object to the list
|
// Add the root object to the list
|
||||||
array_unshift($propertyValues, array(
|
array_unshift($propertyValues, array(
|
||||||
@ -81,7 +80,6 @@ class PropertyAccessor implements PropertyAccessorInterface
|
|||||||
for ($i = count($propertyValues) - 1; $i >= 0; --$i) {
|
for ($i = count($propertyValues) - 1; $i >= 0; --$i) {
|
||||||
$objectOrArray = & $propertyValues[$i][self::VALUE];
|
$objectOrArray = & $propertyValues[$i][self::VALUE];
|
||||||
|
|
||||||
if ($overwrite) {
|
|
||||||
$property = $propertyPath->getElement($i);
|
$property = $propertyPath->getElement($i);
|
||||||
|
|
||||||
if ($propertyPath->isIndex($i)) {
|
if ($propertyPath->isIndex($i)) {
|
||||||
@ -89,10 +87,12 @@ class PropertyAccessor implements PropertyAccessorInterface
|
|||||||
} else {
|
} else {
|
||||||
$this->writeProperty($objectOrArray, $property, $value);
|
$this->writeProperty($objectOrArray, $property, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($propertyValues[$i][self::IS_REF]) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$value = & $objectOrArray;
|
$value = & $objectOrArray;
|
||||||
$overwrite = !$propertyValues[$i][self::IS_REF];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,7 +127,6 @@ class PropertyAccessor implements PropertyAccessorInterface
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$propertyValues = $this->readPropertiesUntil($objectOrArray, $propertyPath, $propertyPath->getLength() - 1);
|
$propertyValues = $this->readPropertiesUntil($objectOrArray, $propertyPath, $propertyPath->getLength() - 1);
|
||||||
$overwrite = true;
|
|
||||||
|
|
||||||
// Add the root object to the list
|
// Add the root object to the list
|
||||||
array_unshift($propertyValues, array(
|
array_unshift($propertyValues, array(
|
||||||
@ -138,7 +137,6 @@ class PropertyAccessor implements PropertyAccessorInterface
|
|||||||
for ($i = count($propertyValues) - 1; $i >= 0; --$i) {
|
for ($i = count($propertyValues) - 1; $i >= 0; --$i) {
|
||||||
$objectOrArray = $propertyValues[$i][self::VALUE];
|
$objectOrArray = $propertyValues[$i][self::VALUE];
|
||||||
|
|
||||||
if ($overwrite) {
|
|
||||||
$property = $propertyPath->getElement($i);
|
$property = $propertyPath->getElement($i);
|
||||||
|
|
||||||
if ($propertyPath->isIndex($i)) {
|
if ($propertyPath->isIndex($i)) {
|
||||||
@ -150,9 +148,10 @@ class PropertyAccessor implements PropertyAccessorInterface
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$overwrite = !$propertyValues[$i][self::IS_REF];
|
if ($propertyValues[$i][self::IS_REF]) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -264,8 +264,7 @@ class PropertyPathBuilder
|
|||||||
|
|
||||||
// All remaining elements should be removed
|
// All remaining elements should be removed
|
||||||
for (; $i < $length; ++$i) {
|
for (; $i < $length; ++$i) {
|
||||||
unset($this->elements[$i]);
|
unset($this->elements[$i], $this->isIndex[$i]);
|
||||||
unset($this->isIndex[$i]);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$diff = $insertionLength - $cutLength;
|
$diff = $insertionLength - $cutLength;
|
||||||
|
@ -25,6 +25,7 @@ class TestClass
|
|||||||
private $publicAccessorWithMoreRequiredParameters;
|
private $publicAccessorWithMoreRequiredParameters;
|
||||||
private $publicIsAccessor;
|
private $publicIsAccessor;
|
||||||
private $publicHasAccessor;
|
private $publicHasAccessor;
|
||||||
|
private $publicGetter;
|
||||||
|
|
||||||
public function __construct($value)
|
public function __construct($value)
|
||||||
{
|
{
|
||||||
@ -37,6 +38,7 @@ class TestClass
|
|||||||
$this->publicAccessorWithMoreRequiredParameters = $value;
|
$this->publicAccessorWithMoreRequiredParameters = $value;
|
||||||
$this->publicIsAccessor = $value;
|
$this->publicIsAccessor = $value;
|
||||||
$this->publicHasAccessor = $value;
|
$this->publicHasAccessor = $value;
|
||||||
|
$this->publicGetter = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setPublicAccessor($value)
|
public function setPublicAccessor($value)
|
||||||
@ -166,4 +168,9 @@ class TestClass
|
|||||||
{
|
{
|
||||||
return 'foobar';
|
return 'foobar';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getPublicGetter()
|
||||||
|
{
|
||||||
|
return $this->publicGetter;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -419,6 +419,14 @@ class PropertyAccessorTest extends \PHPUnit_Framework_TestCase
|
|||||||
array(array('index' => array('%!@$§.' => 'Bernhard')), '[index][%!@$§.]', 'Bernhard'),
|
array(array('index' => array('%!@$§.' => 'Bernhard')), '[index][%!@$§.]', 'Bernhard'),
|
||||||
array((object) array('%!@$§' => 'Bernhard'), '%!@$§', 'Bernhard'),
|
array((object) array('%!@$§' => 'Bernhard'), '%!@$§', 'Bernhard'),
|
||||||
array((object) array('property' => (object) array('%!@$§' => 'Bernhard')), 'property.%!@$§', 'Bernhard'),
|
array((object) array('property' => (object) array('%!@$§' => 'Bernhard')), 'property.%!@$§', 'Bernhard'),
|
||||||
|
|
||||||
|
// nested objects and arrays
|
||||||
|
array(array('foo' => new TestClass('bar')), '[foo].publicGetSetter', 'bar'),
|
||||||
|
array(new TestClass(array('foo' => 'bar')), 'publicGetSetter[foo]', 'bar'),
|
||||||
|
array(new TestClass(new TestClass('bar')), 'publicGetter.publicGetSetter', 'bar'),
|
||||||
|
array(new TestClass(array('foo' => new TestClass('bar'))), 'publicGetter[foo].publicGetSetter', 'bar'),
|
||||||
|
array(new TestClass(new TestClass(new TestClass('bar'))), 'publicGetter.publicGetter.publicGetSetter', 'bar'),
|
||||||
|
array(new TestClass(array('foo' => array('baz' => new TestClass('bar')))), 'publicGetter[foo][baz].publicGetSetter', 'bar'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,7 +173,8 @@ class AclProvider implements AclProviderInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Is it time to load the current batch?
|
// Is it time to load the current batch?
|
||||||
if ((self::MAX_BATCH_SIZE === count($currentBatch) || ($i + 1) === $c) && count($currentBatch) > 0) {
|
$currentBatchesCount = count($currentBatch);
|
||||||
|
if ($currentBatchesCount > 0 && (self::MAX_BATCH_SIZE === $currentBatchesCount || ($i + 1) === $c)) {
|
||||||
try {
|
try {
|
||||||
$loadedBatch = $this->lookupObjectIdentities($currentBatch, $sids, $oidLookup);
|
$loadedBatch = $this->lookupObjectIdentities($currentBatch, $sids, $oidLookup);
|
||||||
} catch (AclNotFoundException $aclNotFoundException) {
|
} catch (AclNotFoundException $aclNotFoundException) {
|
||||||
@ -559,10 +560,11 @@ QUERY;
|
|||||||
// attach ACL to the result set; even though we do not enforce that every
|
// attach ACL to the result set; even though we do not enforce that every
|
||||||
// object identity has only one instance, we must make sure to maintain
|
// object identity has only one instance, we must make sure to maintain
|
||||||
// referential equality with the oids passed to findAcls()
|
// referential equality with the oids passed to findAcls()
|
||||||
if (!isset($oidCache[$objectIdentifier.$classType])) {
|
$oidCacheKey = $objectIdentifier.$classType;
|
||||||
$oidCache[$objectIdentifier.$classType] = $acl->getObjectIdentity();
|
if (!isset($oidCache[$oidCacheKey])) {
|
||||||
|
$oidCache[$oidCacheKey] = $acl->getObjectIdentity();
|
||||||
}
|
}
|
||||||
$result->attach($oidCache[$objectIdentifier.$classType], $acl);
|
$result->attach($oidCache[$oidCacheKey], $acl);
|
||||||
// so, this hasn't been hydrated yet
|
// so, this hasn't been hydrated yet
|
||||||
} else {
|
} else {
|
||||||
// create object identity if we haven't done so yet
|
// create object identity if we haven't done so yet
|
||||||
@ -670,7 +672,7 @@ QUERY;
|
|||||||
// let's see if we have already hydrated this
|
// let's see if we have already hydrated this
|
||||||
if (isset($acls[$parentId])) {
|
if (isset($acls[$parentId])) {
|
||||||
$aclParentAclProperty->setValue($acl, $acls[$parentId]);
|
$aclParentAclProperty->setValue($acl, $acls[$parentId]);
|
||||||
$processed += 1;
|
++$processed;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
if ($id === 1000 || ($id < 1500 && rand(0, 1))) {
|
if ($id === 1000 || ($id < 1500 && rand(0, 1))) {
|
||||||
$this->insertClassStmt->execute(array($id, $this->getRandomString(rand(20, 100), 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\\_')));
|
$this->insertClassStmt->execute(array($id, $this->getRandomString(rand(20, 100), 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\\_')));
|
||||||
$id += 1;
|
++$id;
|
||||||
|
|
||||||
return $id-1;
|
return $id-1;
|
||||||
} else {
|
} else {
|
||||||
@ -148,7 +148,7 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->generateAces($classId, $id);
|
$this->generateAces($classId, $id);
|
||||||
$id += 1;
|
++$id;
|
||||||
|
|
||||||
return $id-1;
|
return $id-1;
|
||||||
}
|
}
|
||||||
@ -163,7 +163,7 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->getRandomString(rand(5, 30)),
|
$this->getRandomString(rand(5, 30)),
|
||||||
rand(0, 1),
|
rand(0, 1),
|
||||||
));
|
));
|
||||||
$id += 1;
|
++$id;
|
||||||
|
|
||||||
return $id-1;
|
return $id-1;
|
||||||
} else {
|
} else {
|
||||||
@ -215,7 +215,7 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase
|
|||||||
rand(0, 1),
|
rand(0, 1),
|
||||||
));
|
));
|
||||||
|
|
||||||
$id += 1;
|
++$id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ class AclVoterTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testSupportsAttribute($attribute, $supported)
|
public function testSupportsAttribute($attribute, $supported)
|
||||||
{
|
{
|
||||||
list($voter, , $permissionMap, ,) = $this->getVoter(true, false);
|
list($voter, , $permissionMap) = $this->getVoter(true, false);
|
||||||
|
|
||||||
$permissionMap
|
$permissionMap
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
@ -44,7 +44,7 @@ class AclVoterTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testSupportsAttributeNonString($attribute)
|
public function testSupportsAttributeNonString($attribute)
|
||||||
{
|
{
|
||||||
list($voter, , , , ,) = $this->getVoter(true, false);
|
list($voter) = $this->getVoter(true, false);
|
||||||
|
|
||||||
$this->assertFalse($voter->supportsAttribute($attribute));
|
$this->assertFalse($voter->supportsAttribute($attribute));
|
||||||
}
|
}
|
||||||
@ -72,7 +72,7 @@ class AclVoterTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testSupportsClass($class)
|
public function testSupportsClass($class)
|
||||||
{
|
{
|
||||||
list($voter, , , ,) = $this->getVoter();
|
list($voter) = $this->getVoter();
|
||||||
|
|
||||||
$this->assertTrue($voter->supportsClass($class));
|
$this->assertTrue($voter->supportsClass($class));
|
||||||
}
|
}
|
||||||
@ -88,7 +88,7 @@ class AclVoterTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testVote()
|
public function testVote()
|
||||||
{
|
{
|
||||||
list($voter, , $permissionMap, ,) = $this->getVoter();
|
list($voter, , $permissionMap) = $this->getVoter();
|
||||||
$permissionMap
|
$permissionMap
|
||||||
->expects($this->atLeastOnce())
|
->expects($this->atLeastOnce())
|
||||||
->method('getMasks')
|
->method('getMasks')
|
||||||
@ -103,7 +103,7 @@ class AclVoterTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testVoteWhenNoObjectIsPassed($allowIfObjectIdentityUnavailable)
|
public function testVoteWhenNoObjectIsPassed($allowIfObjectIdentityUnavailable)
|
||||||
{
|
{
|
||||||
list($voter, , $permissionMap, ,) = $this->getVoter($allowIfObjectIdentityUnavailable);
|
list($voter, , $permissionMap) = $this->getVoter($allowIfObjectIdentityUnavailable);
|
||||||
$permissionMap
|
$permissionMap
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('getMasks')
|
->method('getMasks')
|
||||||
@ -124,7 +124,7 @@ class AclVoterTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testVoteWhenOidStrategyReturnsNull($allowIfUnavailable)
|
public function testVoteWhenOidStrategyReturnsNull($allowIfUnavailable)
|
||||||
{
|
{
|
||||||
list($voter, , $permissionMap, $oidStrategy,) = $this->getVoter($allowIfUnavailable);
|
list($voter, , $permissionMap, $oidStrategy) = $this->getVoter($allowIfUnavailable);
|
||||||
$permissionMap
|
$permissionMap
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('getMasks')
|
->method('getMasks')
|
||||||
|
@ -41,7 +41,7 @@ class SecureRandomTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
for ($j = 1; $j <= 5000; $j++) {
|
for ($j = 1; $j <= 5000; $j++) {
|
||||||
$k = 4 * $j - 1;
|
$k = 4 * $j - 1;
|
||||||
$c[8 * $b[$k - 3] + 4 * $b[$k - 2] + 2 * $b[$k - 1] + $b[$k]] += 1;
|
++$c[8 * $b[$k - 3] + 4 * $b[$k - 2] + 2 * $b[$k - 1] + $b[$k]];
|
||||||
}
|
}
|
||||||
|
|
||||||
$f = 0;
|
$f = 0;
|
||||||
@ -73,14 +73,14 @@ class SecureRandomTest extends \PHPUnit_Framework_TestCase
|
|||||||
$run = 6;
|
$run = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
$runs[$run] += 1;
|
++$runs[$run];
|
||||||
};
|
};
|
||||||
|
|
||||||
$currentRun = 0;
|
$currentRun = 0;
|
||||||
$lastBit = null;
|
$lastBit = null;
|
||||||
for ($i = 0; $i < 20000; $i++) {
|
for ($i = 0; $i < 20000; $i++) {
|
||||||
if ($lastBit === $b[$i]) {
|
if ($lastBit === $b[$i]) {
|
||||||
$currentRun += 1;
|
++$currentRun;
|
||||||
} else {
|
} else {
|
||||||
if ($currentRun > 0) {
|
if ($currentRun > 0) {
|
||||||
$addRun($currentRun);
|
$addRun($currentRun);
|
||||||
@ -115,7 +115,7 @@ class SecureRandomTest extends \PHPUnit_Framework_TestCase
|
|||||||
$lastBit = null;
|
$lastBit = null;
|
||||||
for ($i = 0; $i < 20000; $i++) {
|
for ($i = 0; $i < 20000; $i++) {
|
||||||
if ($lastBit === $b[$i]) {
|
if ($lastBit === $b[$i]) {
|
||||||
$currentRun += 1;
|
++$currentRun;
|
||||||
} else {
|
} else {
|
||||||
if ($currentRun > $longestRun) {
|
if ($currentRun > $longestRun) {
|
||||||
$longestRun = $currentRun;
|
$longestRun = $currentRun;
|
||||||
|
@ -172,9 +172,9 @@ class ExceptionListenerTest extends \PHPUnit_Framework_TestCase
|
|||||||
private function createExceptionListener(TokenStorageInterface $tokenStorage = null, AuthenticationTrustResolverInterface $trustResolver = null, HttpUtils $httpUtils = null, AuthenticationEntryPointInterface $authenticationEntryPoint = null, $errorPage = null, AccessDeniedHandlerInterface $accessDeniedHandler = null)
|
private function createExceptionListener(TokenStorageInterface $tokenStorage = null, AuthenticationTrustResolverInterface $trustResolver = null, HttpUtils $httpUtils = null, AuthenticationEntryPointInterface $authenticationEntryPoint = null, $errorPage = null, AccessDeniedHandlerInterface $accessDeniedHandler = null)
|
||||||
{
|
{
|
||||||
return new ExceptionListener(
|
return new ExceptionListener(
|
||||||
$tokenStorage ? $tokenStorage : $this->getMock('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface'),
|
$tokenStorage ?: $this->getMock('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface'),
|
||||||
$trustResolver ? $trustResolver : $this->getMock('Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface'),
|
$trustResolver ?: $this->getMock('Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface'),
|
||||||
$httpUtils ? $httpUtils : $this->getMock('Symfony\Component\Security\Http\HttpUtils'),
|
$httpUtils ?: $this->getMock('Symfony\Component\Security\Http\HttpUtils'),
|
||||||
'key',
|
'key',
|
||||||
$authenticationEntryPoint,
|
$authenticationEntryPoint,
|
||||||
$errorPage,
|
$errorPage,
|
||||||
|
@ -20,7 +20,7 @@ class RememberMeListenerTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
public function testOnCoreSecurityDoesNotTryToPopulateNonEmptyTokenStorage()
|
public function testOnCoreSecurityDoesNotTryToPopulateNonEmptyTokenStorage()
|
||||||
{
|
{
|
||||||
list($listener, $tokenStorage, , , ,) = $this->getListener();
|
list($listener, $tokenStorage) = $this->getListener();
|
||||||
|
|
||||||
$tokenStorage
|
$tokenStorage
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
@ -38,7 +38,7 @@ class RememberMeListenerTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testOnCoreSecurityDoesNothingWhenNoCookieIsSet()
|
public function testOnCoreSecurityDoesNothingWhenNoCookieIsSet()
|
||||||
{
|
{
|
||||||
list($listener, $tokenStorage, $service, ,) = $this->getListener();
|
list($listener, $tokenStorage, $service) = $this->getListener();
|
||||||
|
|
||||||
$tokenStorage
|
$tokenStorage
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
@ -64,7 +64,7 @@ class RememberMeListenerTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testOnCoreSecurityIgnoresAuthenticationExceptionThrownByAuthenticationManagerImplementation()
|
public function testOnCoreSecurityIgnoresAuthenticationExceptionThrownByAuthenticationManagerImplementation()
|
||||||
{
|
{
|
||||||
list($listener, $tokenStorage, $service, $manager,) = $this->getListener();
|
list($listener, $tokenStorage, $service, $manager) = $this->getListener();
|
||||||
|
|
||||||
$tokenStorage
|
$tokenStorage
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
@ -144,7 +144,7 @@ class RememberMeListenerTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testOnCoreSecurity()
|
public function testOnCoreSecurity()
|
||||||
{
|
{
|
||||||
list($listener, $tokenStorage, $service, $manager,) = $this->getListener();
|
list($listener, $tokenStorage, $service, $manager) = $this->getListener();
|
||||||
|
|
||||||
$tokenStorage
|
$tokenStorage
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
|
@ -171,7 +171,7 @@ class XliffFileLoader implements LoaderInterface
|
|||||||
LIBXML_ERR_WARNING == $error->level ? 'WARNING' : 'ERROR',
|
LIBXML_ERR_WARNING == $error->level ? 'WARNING' : 'ERROR',
|
||||||
$error->code,
|
$error->code,
|
||||||
trim($error->message),
|
trim($error->message),
|
||||||
$error->file ? $error->file : 'n/a',
|
$error->file ?: 'n/a',
|
||||||
$error->line,
|
$error->line,
|
||||||
$error->column
|
$error->column
|
||||||
);
|
);
|
||||||
|
@ -278,6 +278,38 @@
|
|||||||
<source>This value should not be identical to {{ compared_value_type }} {{ compared_value }}.</source>
|
<source>This value should not be identical to {{ compared_value_type }} {{ compared_value }}.</source>
|
||||||
<target>Este valor non debería ser identico a {{ compared_value_type }} {{ compared_value }}.</target>
|
<target>Este valor non debería ser identico a {{ compared_value_type }} {{ compared_value }}.</target>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
<trans-unit id="73">
|
||||||
|
<source>The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.</source>
|
||||||
|
<target>A proporción da imaxe é demasiado grande ({{ ratio }}). A proporción máxima permitida é {{ max_ratio }}.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="74">
|
||||||
|
<source>The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.</source>
|
||||||
|
<target>A proporción da é demasiado pequena ({{ ratio }}). A proporción mínima permitida é {{ min_ratio }}.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="75">
|
||||||
|
<source>The image is square ({{ width }}x{{ height }}px). Square images are not allowed.</source>
|
||||||
|
<target>A imaxe é cadrada ({{ width }}x{{ height }}px). As imáxenes cadradas non están permitidas.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="76">
|
||||||
|
<source>The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.</source>
|
||||||
|
<target>A imaxe está orientada horizontalmente ({{ width }}x{{ height }}px). As imáxenes orientadas horizontalmente non están permitidas.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="77">
|
||||||
|
<source>The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.</source>
|
||||||
|
<target>A imaxe está orientada verticalmente ({{ width }}x{{ height }}px). As imáxenes orientadas verticalmente non están permitidas.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="78">
|
||||||
|
<source>An empty file is not allowed.</source>
|
||||||
|
<target>Non está permitido un arquivo baleiro.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="79">
|
||||||
|
<source>The host could not be resolved.</source>
|
||||||
|
<target>Non se puido resolver o host.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="80">
|
||||||
|
<source>This value does not match the expected {{ charset }} charset.</source>
|
||||||
|
<target>A codificación de caracteres para este valor debería ser {{ charset }}.</target>
|
||||||
|
</trans-unit>
|
||||||
</body>
|
</body>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
||||||
|
@ -38,8 +38,9 @@ class VarCloner extends AbstractCloner
|
|||||||
$maxItems = $this->maxItems;
|
$maxItems = $this->maxItems;
|
||||||
$maxString = $this->maxString;
|
$maxString = $this->maxString;
|
||||||
$cookie = (object) array(); // Unique object used to detect hard references
|
$cookie = (object) array(); // Unique object used to detect hard references
|
||||||
|
$gid = uniqid(mt_rand(), true); // Unique string used to detect the special $GLOBALS variable
|
||||||
$a = null; // Array cast for nested structures
|
$a = null; // Array cast for nested structures
|
||||||
$stub = null; // Stub capturing the main properties of an original item value,
|
$stub = null; // Stub capturing the main properties of an original item value
|
||||||
// or null if the original value is used directly
|
// or null if the original value is used directly
|
||||||
$zval = array( // Main properties of the current value
|
$zval = array( // Main properties of the current value
|
||||||
'type' => null,
|
'type' => null,
|
||||||
@ -121,16 +122,20 @@ class VarCloner extends AbstractCloner
|
|||||||
$stub->value = $zval['array_count'] ?: count($v);
|
$stub->value = $zval['array_count'] ?: count($v);
|
||||||
|
|
||||||
$a = $v;
|
$a = $v;
|
||||||
$a[] = null;
|
|
||||||
$h = count($v);
|
// Copies of $GLOBALS have very strange behavior,
|
||||||
array_pop($a);
|
// let's detect them with some black magic
|
||||||
|
$a[$gid] = true;
|
||||||
|
|
||||||
// Happens with copies of $GLOBALS
|
// Happens with copies of $GLOBALS
|
||||||
if ($h !== $stub->value) {
|
if (isset($v[$gid])) {
|
||||||
|
unset($v[$gid]);
|
||||||
$a = array();
|
$a = array();
|
||||||
foreach ($v as $gk => &$gv) {
|
foreach ($v as $gk => &$gv) {
|
||||||
$a[$gk] =& $gv;
|
$a[$gk] =& $gv;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$a = $v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -18,6 +18,49 @@ use Symfony\Component\VarDumper\Cloner\VarCloner;
|
|||||||
*/
|
*/
|
||||||
class VarClonerTest extends \PHPUnit_Framework_TestCase
|
class VarClonerTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
public function testMaxIntBoundary()
|
||||||
|
{
|
||||||
|
$data = array(PHP_INT_MAX => 123);
|
||||||
|
|
||||||
|
$cloner = new VarCloner();
|
||||||
|
$clone = $cloner->cloneVar($data);
|
||||||
|
|
||||||
|
$expected = <<<EOTXT
|
||||||
|
Symfony\Component\VarDumper\Cloner\Data Object
|
||||||
|
(
|
||||||
|
[data:Symfony\Component\VarDumper\Cloner\Data:private] => Array
|
||||||
|
(
|
||||||
|
[0] => Array
|
||||||
|
(
|
||||||
|
[0] => Symfony\Component\VarDumper\Cloner\Stub Object
|
||||||
|
(
|
||||||
|
[type] => array
|
||||||
|
[class] => assoc
|
||||||
|
[value] => 1
|
||||||
|
[cut] => 0
|
||||||
|
[handle] => 0
|
||||||
|
[refCount] => 0
|
||||||
|
[position] => 1
|
||||||
|
)
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
[1] => Array
|
||||||
|
(
|
||||||
|
[%s] => 123
|
||||||
|
)
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
[maxDepth:Symfony\Component\VarDumper\Cloner\Data:private] => 20
|
||||||
|
[maxItemsPerDepth:Symfony\Component\VarDumper\Cloner\Data:private] => -1
|
||||||
|
[useRefHandles:Symfony\Component\VarDumper\Cloner\Data:private] => -1
|
||||||
|
)
|
||||||
|
|
||||||
|
EOTXT;
|
||||||
|
$this->assertSame(sprintf($expected, PHP_INT_MAX), print_r($clone, true));
|
||||||
|
}
|
||||||
|
|
||||||
public function testClone()
|
public function testClone()
|
||||||
{
|
{
|
||||||
$json = json_decode('{"1":{"var":"val"},"2":{"var":"val"}}');
|
$json = json_decode('{"1":{"var":"val"},"2":{"var":"val"}}');
|
||||||
|
@ -285,7 +285,7 @@ class Inline
|
|||||||
{
|
{
|
||||||
$output = array();
|
$output = array();
|
||||||
$len = strlen($sequence);
|
$len = strlen($sequence);
|
||||||
$i += 1;
|
++$i;
|
||||||
|
|
||||||
// [foo, bar, ...]
|
// [foo, bar, ...]
|
||||||
while ($i < $len) {
|
while ($i < $len) {
|
||||||
@ -344,7 +344,7 @@ class Inline
|
|||||||
{
|
{
|
||||||
$output = array();
|
$output = array();
|
||||||
$len = strlen($mapping);
|
$len = strlen($mapping);
|
||||||
$i += 1;
|
++$i;
|
||||||
|
|
||||||
// {foo: bar, bar:foo, ...}
|
// {foo: bar, bar:foo, ...}
|
||||||
while ($i < $len) {
|
while ($i < $len) {
|
||||||
|
Reference in New Issue
Block a user