Merge branch '2.3' into 2.5
* 2.3: [Config] adds missing « use » statement for InvalidTypeException type hint in documentation. [Config] fixes broken unit test on ArrayNode class. fixed CS [Security] Delete old session on auth strategy migrate update required minimum TwigBridge version Very minor grammar fix in error message [Tests] Silenced all deprecations in tests for 2.3 BinaryFileResponse - add missing newline fixed CS add a limit and a test to FlattenExceptionTest. CS: There should be no empty lines following phpdocs [FrameworkBundle] fix cache:clear command [2.3] Docblocks should not be followed by a blank line Fix return phpdoc [PropertyAccess] Added test to verify #5775 is fixed Conflicts: src/Symfony/Bundle/TwigBundle/composer.json src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php src/Symfony/Component/Security/Core/Tests/Validator/Constraints/UserPasswordValidatorTest.php
This commit is contained in:
commit
51aa13ad6d
@ -6,6 +6,10 @@
|
||||
colors="true"
|
||||
bootstrap="Tests/bootstrap.php"
|
||||
>
|
||||
<php>
|
||||
<!-- Silence E_USER_DEPRECATED (-16385 == -1 & ~E_USER_DEPRECATED) -->
|
||||
<ini name="error_reporting" value="-16385"/>
|
||||
</php>
|
||||
<testsuites>
|
||||
<testsuite name="Symfony Doctrine Bridge Test Suite">
|
||||
<directory>./Tests/</directory>
|
||||
|
@ -6,6 +6,10 @@
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
<php>
|
||||
<!-- Silence E_USER_DEPRECATED (-16385 == -1 & ~E_USER_DEPRECATED) -->
|
||||
<ini name="error_reporting" value="-16385"/>
|
||||
</php>
|
||||
<testsuites>
|
||||
<testsuite name="Symfony Monolog Bridge Test Suite">
|
||||
<directory>./Tests/</directory>
|
||||
|
@ -6,6 +6,10 @@
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
<php>
|
||||
<!-- Silence E_USER_DEPRECATED (-16385 == -1 & ~E_USER_DEPRECATED) -->
|
||||
<ini name="error_reporting" value="-16385"/>
|
||||
</php>
|
||||
<testsuites>
|
||||
<testsuite name="Symfony Propel1 Bridge Test Suite">
|
||||
<directory>./Tests/</directory>
|
||||
|
@ -6,6 +6,10 @@
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
<php>
|
||||
<!-- Silence E_USER_DEPRECATED (-16385 == -1 & ~E_USER_DEPRECATED) -->
|
||||
<ini name="error_reporting" value="-16385"/>
|
||||
</php>
|
||||
<testsuites>
|
||||
<testsuite name="Symfony ProxyManager Bridge Test Suite">
|
||||
<directory>./Tests/</directory>
|
||||
|
@ -6,6 +6,10 @@
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
<php>
|
||||
<!-- Silence E_USER_DEPRECATED (-16385 == -1 & ~E_USER_DEPRECATED) -->
|
||||
<ini name="error_reporting" value="-16385"/>
|
||||
</php>
|
||||
<testsuites>
|
||||
<testsuite name="Symfony Twig Bridge Test Suite">
|
||||
<directory>./Tests/</directory>
|
||||
|
@ -75,6 +75,7 @@ EOF
|
||||
} else {
|
||||
// the warmup cache dir name must have the same length than the real one
|
||||
// to avoid the many problems in serialized resources files
|
||||
$realCacheDir = realpath($realCacheDir);
|
||||
$warmupDir = substr($realCacheDir, 0, -1).'_';
|
||||
|
||||
if ($filesystem->exists($warmupDir)) {
|
||||
@ -180,12 +181,14 @@ EOF
|
||||
*/
|
||||
protected function getTempKernel(KernelInterface $parent, $namespace, $parentClass, $warmupDir)
|
||||
{
|
||||
$rootDir = $parent->getRootDir();
|
||||
$cacheDir = var_export($warmupDir, true);
|
||||
$rootDir = var_export(realpath($parent->getRootDir()), true);
|
||||
$logDir = var_export(realpath($parent->getLogDir()), true);
|
||||
// the temp kernel class name must have the same length than the real one
|
||||
// to avoid the many problems in serialized resources files
|
||||
$class = substr($parentClass, 0, -1).'_';
|
||||
// the temp kernel name must be changed too
|
||||
$name = substr($parent->getName(), 0, -1).'_';
|
||||
$name = var_export(substr($parent->getName(), 0, -1).'_', true);
|
||||
$code = <<<EOF
|
||||
<?php
|
||||
|
||||
@ -195,17 +198,22 @@ namespace $namespace
|
||||
{
|
||||
public function getCacheDir()
|
||||
{
|
||||
return '$warmupDir';
|
||||
return $cacheDir;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return '$name';
|
||||
return $name;
|
||||
}
|
||||
|
||||
public function getRootDir()
|
||||
{
|
||||
return '$rootDir';
|
||||
return $rootDir;
|
||||
}
|
||||
|
||||
public function getLogDir()
|
||||
{
|
||||
return $logDir;
|
||||
}
|
||||
|
||||
protected function buildContainer()
|
||||
|
@ -6,6 +6,10 @@
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
<php>
|
||||
<!-- Silence E_USER_DEPRECATED (-16385 == -1 & ~E_USER_DEPRECATED) -->
|
||||
<ini name="error_reporting" value="-16385"/>
|
||||
</php>
|
||||
<testsuites>
|
||||
<testsuite name="Symfony FrameworkBundle Test Suite">
|
||||
<directory>./Tests/</directory>
|
||||
|
@ -163,7 +163,6 @@ class SecurityExtension extends Extension
|
||||
* @param array $config An array of configuration settings
|
||||
* @param ContainerBuilder $container A ContainerBuilder instance
|
||||
*/
|
||||
|
||||
private function createRoleHierarchy($config, ContainerBuilder $container)
|
||||
{
|
||||
if (!isset($config['role_hierarchy'])) {
|
||||
|
@ -6,7 +6,10 @@
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
|
||||
<php>
|
||||
<!-- Silence E_USER_DEPRECATED (-16385 == -1 & ~E_USER_DEPRECATED) -->
|
||||
<ini name="error_reporting" value="-16385"/>
|
||||
</php>
|
||||
<testsuites>
|
||||
<testsuite name="Symfony SecurityBundle Test Suite">
|
||||
<directory>./Tests/</directory>
|
||||
|
@ -6,7 +6,10 @@
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
|
||||
<php>
|
||||
<!-- Silence E_USER_DEPRECATED (-16385 == -1 & ~E_USER_DEPRECATED) -->
|
||||
<ini name="error_reporting" value="-16385"/>
|
||||
</php>
|
||||
<testsuites>
|
||||
<testsuite name="Symfony TwigBundle Test Suite">
|
||||
<directory>./Tests/</directory>
|
||||
|
@ -6,7 +6,10 @@
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
|
||||
<php>
|
||||
<!-- Silence E_USER_DEPRECATED (-16385 == -1 & ~E_USER_DEPRECATED) -->
|
||||
<ini name="error_reporting" value="-16385"/>
|
||||
</php>
|
||||
<testsuites>
|
||||
<testsuite name="Symfony WebProfilerBundle Test Suite">
|
||||
<directory>./Tests/</directory>
|
||||
|
@ -6,6 +6,10 @@
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
<php>
|
||||
<!-- Silence E_USER_DEPRECATED (-16385 == -1 & ~E_USER_DEPRECATED) -->
|
||||
<ini name="error_reporting" value="-16385"/>
|
||||
</php>
|
||||
<testsuites>
|
||||
<testsuite name="Symfony BrowserKit Component Test Suite">
|
||||
<directory>./Tests/</directory>
|
||||
|
@ -6,6 +6,10 @@
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
<php>
|
||||
<!-- Silence E_USER_DEPRECATED (-16385 == -1 & ~E_USER_DEPRECATED) -->
|
||||
<ini name="error_reporting" value="-16385"/>
|
||||
</php>
|
||||
<testsuites>
|
||||
<testsuite name="Symfony ClassLoader Component Test Suite">
|
||||
<directory>./Tests/</directory>
|
||||
|
@ -302,7 +302,7 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
|
||||
|
||||
// if extra fields are present, throw exception
|
||||
if (count($value) && !$this->ignoreExtraKeys) {
|
||||
$msg = sprintf('Unrecognized options "%s" under "%s"', implode(', ', array_keys($value)), $this->getPath());
|
||||
$msg = sprintf('Unrecognized option%s "%s" under "%s"', 1 === count($value) ? '' : 's', implode(', ', array_keys($value)), $this->getPath());
|
||||
$ex = new InvalidConfigurationException($msg);
|
||||
$ex->setPath($this->getPath());
|
||||
|
||||
|
@ -14,6 +14,7 @@ namespace Symfony\Component\Config\Definition;
|
||||
use Symfony\Component\Config\Definition\Exception\Exception;
|
||||
use Symfony\Component\Config\Definition\Exception\ForbiddenOverwriteException;
|
||||
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
|
||||
use Symfony\Component\Config\Definition\Exception\InvalidTypeException;
|
||||
|
||||
/**
|
||||
* The base node class
|
||||
|
@ -27,7 +27,7 @@ class ArrayNodeTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
|
||||
* @expectedExceptionMessage Unrecognized options "foo" under "root"
|
||||
* @expectedExceptionMessage Unrecognized option "foo" under "root"
|
||||
*/
|
||||
public function testExceptionThrownOnUnrecognizedChild()
|
||||
{
|
||||
|
@ -6,6 +6,10 @@
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
<php>
|
||||
<!-- Silence E_USER_DEPRECATED (-16385 == -1 & ~E_USER_DEPRECATED) -->
|
||||
<ini name="error_reporting" value="-16385"/>
|
||||
</php>
|
||||
<testsuites>
|
||||
<testsuite name="Symfony Config Component Test Suite">
|
||||
<directory>./Tests/</directory>
|
||||
|
@ -6,6 +6,10 @@
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
<php>
|
||||
<!-- Silence E_USER_DEPRECATED (-16385 == -1 & ~E_USER_DEPRECATED) -->
|
||||
<ini name="error_reporting" value="-16385"/>
|
||||
</php>
|
||||
<testsuites>
|
||||
<testsuite name="Symfony Console Component Test Suite">
|
||||
<directory>./Tests/</directory>
|
||||
|
@ -6,6 +6,10 @@
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
<php>
|
||||
<!-- Silence E_USER_DEPRECATED (-16385 == -1 & ~E_USER_DEPRECATED) -->
|
||||
<ini name="error_reporting" value="-16385"/>
|
||||
</php>
|
||||
<testsuites>
|
||||
<testsuite name="Symfony CssSelector Component Test Suite">
|
||||
<directory>./Tests/</directory>
|
||||
|
@ -210,17 +210,20 @@ class FlattenException
|
||||
}
|
||||
}
|
||||
|
||||
private function flattenArgs($args, $level = 0)
|
||||
private function flattenArgs($args, $level = 0, &$count = 0)
|
||||
{
|
||||
$result = array();
|
||||
foreach ($args as $key => $value) {
|
||||
if (++$count > 1e4) {
|
||||
return array('array', '*SKIPPED over 10000 entries*');
|
||||
}
|
||||
if (is_object($value)) {
|
||||
$result[$key] = array('object', get_class($value));
|
||||
} elseif (is_array($value)) {
|
||||
if ($level > 10) {
|
||||
$result[$key] = array('array', '*DEEP NESTED ARRAY*');
|
||||
} else {
|
||||
$result[$key] = array('array', $this->flattenArgs($value, $level + 1));
|
||||
$result[$key] = array('array', $this->flattenArgs($value, $level + 1, $count));
|
||||
}
|
||||
} elseif (null === $value) {
|
||||
$result[$key] = array('null', null);
|
||||
|
@ -186,6 +186,28 @@ class FlattenExceptionTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertContains('*DEEP NESTED ARRAY*', serialize($trace));
|
||||
}
|
||||
|
||||
public function testTooBigArray()
|
||||
{
|
||||
$a = array();
|
||||
for ($i = 0; $i < 20; $i++) {
|
||||
for ($j = 0; $j < 50; $j++) {
|
||||
for ($k = 0; $k < 10; $k++) {
|
||||
$a[$i][$j][$k] = 'value';
|
||||
}
|
||||
}
|
||||
}
|
||||
$a[20] = 'value';
|
||||
$a[21] = 'value1';
|
||||
$exception = $this->createException($a);
|
||||
|
||||
$flattened = FlattenException::create($exception);
|
||||
$trace = $flattened->getTrace();
|
||||
$serializeTrace = serialize($trace);
|
||||
|
||||
$this->assertContains('*SKIPPED over 10000 entries*', $serializeTrace);
|
||||
$this->assertNotContains('*value1*', $serializeTrace);
|
||||
}
|
||||
|
||||
private function createException($foo)
|
||||
{
|
||||
return new \Exception();
|
||||
|
@ -6,6 +6,10 @@
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
<php>
|
||||
<!-- Silence E_USER_DEPRECATED (-16385 == -1 & ~E_USER_DEPRECATED) -->
|
||||
<ini name="error_reporting" value="-16385"/>
|
||||
</php>
|
||||
<testsuites>
|
||||
<testsuite name="Symfony Debug Component Test Suite">
|
||||
<directory>./Tests/</directory>
|
||||
|
@ -6,6 +6,10 @@
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
<php>
|
||||
<!-- Silence E_USER_DEPRECATED (-16385 == -1 & ~E_USER_DEPRECATED) -->
|
||||
<ini name="error_reporting" value="-16385"/>
|
||||
</php>
|
||||
<testsuites>
|
||||
<testsuite name="Symfony DependencyInjection Component Test Suite">
|
||||
<directory>./Tests/</directory>
|
||||
|
@ -6,6 +6,11 @@
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
<php>
|
||||
<!-- Silence E_USER_DEPRECATED (-16385 == -1 & ~E_USER_DEPRECATED) -->
|
||||
<ini name="error_reporting" value="-16385"/>
|
||||
</php>
|
||||
|
||||
<testsuites>
|
||||
<testsuite name="Symfony DomCrawler Component Test Suite">
|
||||
<directory>./Tests/</directory>
|
||||
|
@ -6,6 +6,10 @@
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
<php>
|
||||
<!-- Silence E_USER_DEPRECATED (-16385 == -1 & ~E_USER_DEPRECATED) -->
|
||||
<ini name="error_reporting" value="-16385"/>
|
||||
</php>
|
||||
<testsuites>
|
||||
<testsuite name="Symfony EventDispatcher Component Test Suite">
|
||||
<directory>./Tests/</directory>
|
||||
|
@ -6,6 +6,10 @@
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
<php>
|
||||
<!-- Silence E_USER_DEPRECATED (-16385 == -1 & ~E_USER_DEPRECATED) -->
|
||||
<ini name="error_reporting" value="-16385"/>
|
||||
</php>
|
||||
<testsuites>
|
||||
<testsuite name="Symfony Filesystem Component Test Suite">
|
||||
<directory>./Tests/</directory>
|
||||
|
@ -6,6 +6,10 @@
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
<php>
|
||||
<!-- Silence E_USER_DEPRECATED (-16385 == -1 & ~E_USER_DEPRECATED) -->
|
||||
<ini name="error_reporting" value="-16385"/>
|
||||
</php>
|
||||
<testsuites>
|
||||
<testsuite name="Symfony Finder Component Test Suite">
|
||||
<directory>./Tests/</directory>
|
||||
|
@ -6,6 +6,10 @@
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
<php>
|
||||
<!-- Silence E_USER_DEPRECATED (-16385 == -1 & ~E_USER_DEPRECATED) -->
|
||||
<ini name="error_reporting" value="-16385"/>
|
||||
</php>
|
||||
<testsuites>
|
||||
<testsuite name="Symfony Form Component Test Suite">
|
||||
<directory>./Tests/</directory>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
@ -62,7 +62,7 @@ class BinaryFileResponse extends Response
|
||||
* @param bool $autoEtag Whether the ETag header should be automatically set
|
||||
* @param bool $autoLastModified Whether the Last-Modified header should be automatically set
|
||||
*
|
||||
* @return BinaryResponse The created response
|
||||
* @return BinaryFileResponse The created response
|
||||
*/
|
||||
public static function create($file = null, $status = 200, $headers = array(), $public = true, $contentDisposition = null, $autoEtag = false, $autoLastModified = true)
|
||||
{
|
||||
|
@ -16,7 +16,6 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
|
||||
*
|
||||
* @see http://php.net/sessionhandler
|
||||
*/
|
||||
|
||||
if (PHP_VERSION_ID >= 50400) {
|
||||
class NativeSessionHandler extends \SessionHandler
|
||||
{
|
||||
|
@ -6,6 +6,10 @@
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
<php>
|
||||
<!-- Silence E_USER_DEPRECATED (-16385 == -1 & ~E_USER_DEPRECATED) -->
|
||||
<ini name="error_reporting" value="-16385"/>
|
||||
</php>
|
||||
<testsuites>
|
||||
<testsuite name="Symfony HttpFoundation Component Test Suite">
|
||||
<directory>./Tests/</directory>
|
||||
|
@ -584,12 +584,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface
|
||||
|
||||
return array_merge(
|
||||
array(
|
||||
'kernel.root_dir' => $this->rootDir,
|
||||
'kernel.root_dir' => realpath($this->rootDir) ?: $this->rootDir,
|
||||
'kernel.environment' => $this->environment,
|
||||
'kernel.debug' => $this->debug,
|
||||
'kernel.name' => $this->name,
|
||||
'kernel.cache_dir' => $this->getCacheDir(),
|
||||
'kernel.logs_dir' => $this->getLogDir(),
|
||||
'kernel.cache_dir' => realpath($this->getCacheDir()) ?: $this->getCacheDir(),
|
||||
'kernel.logs_dir' => realpath($this->getLogDir()) ?: $this->getLogDir(),
|
||||
'kernel.bundles' => $bundles,
|
||||
'kernel.charset' => $this->getCharset(),
|
||||
'kernel.container_class' => $this->getContainerClass(),
|
||||
|
@ -6,6 +6,10 @@
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
<php>
|
||||
<!-- Silence E_USER_DEPRECATED (-16385 == -1 & ~E_USER_DEPRECATED) -->
|
||||
<ini name="error_reporting" value="-16385"/>
|
||||
</php>
|
||||
<testsuites>
|
||||
<testsuite name="Symfony HttpKernel Component Test Suite">
|
||||
<directory>./Tests/</directory>
|
||||
|
@ -6,6 +6,10 @@
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
<php>
|
||||
<!-- Silence E_USER_DEPRECATED (-16385 == -1 & ~E_USER_DEPRECATED) -->
|
||||
<ini name="error_reporting" value="-16385"/>
|
||||
</php>
|
||||
<testsuites>
|
||||
<testsuite name="Symfony Intl Component Test Suite">
|
||||
<directory>./Tests/</directory>
|
||||
|
@ -6,6 +6,10 @@
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
<php>
|
||||
<!-- Silence E_USER_DEPRECATED (-16385 == -1 & ~E_USER_DEPRECATED) -->
|
||||
<ini name="error_reporting" value="-16385"/>
|
||||
</php>
|
||||
<testsuites>
|
||||
<testsuite name="Symfony Locale Component Test Suite">
|
||||
<directory>./Tests/</directory>
|
||||
|
@ -6,6 +6,10 @@
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
<php>
|
||||
<!-- Silence E_USER_DEPRECATED (-16385 == -1 & ~E_USER_DEPRECATED) -->
|
||||
<ini name="error_reporting" value="-16385"/>
|
||||
</php>
|
||||
<testsuites>
|
||||
<testsuite name="Symfony OptionsResolver Component Test Suite">
|
||||
<directory>./Tests/</directory>
|
||||
|
@ -7,7 +7,6 @@
|
||||
*
|
||||
* @example `php NonStopableProcess.php 42` will run the script for 42 seconds
|
||||
*/
|
||||
|
||||
function handleSignal($signal)
|
||||
{
|
||||
switch ($signal) {
|
||||
|
@ -6,6 +6,10 @@
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
<php>
|
||||
<!-- Silence E_USER_DEPRECATED (-16385 == -1 & ~E_USER_DEPRECATED) -->
|
||||
<ini name="error_reporting" value="-16385"/>
|
||||
</php>
|
||||
<testsuites>
|
||||
<testsuite name="Symfony Process Component Test Suite">
|
||||
<directory>./Tests/</directory>
|
||||
|
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\PropertyAccess\Tests\Fixtures;
|
||||
|
||||
class Ticket5775Object
|
||||
{
|
||||
private $property;
|
||||
|
||||
public function getProperty()
|
||||
{
|
||||
return $this->property;
|
||||
}
|
||||
|
||||
private function setProperty()
|
||||
{
|
||||
}
|
||||
|
||||
public function __set($property, $value)
|
||||
{
|
||||
$this->$property = $value;
|
||||
}
|
||||
}
|
@ -15,6 +15,7 @@ use Symfony\Component\PropertyAccess\PropertyAccessor;
|
||||
use Symfony\Component\PropertyAccess\Tests\Fixtures\TestClass;
|
||||
use Symfony\Component\PropertyAccess\Tests\Fixtures\TestClassMagicCall;
|
||||
use Symfony\Component\PropertyAccess\Tests\Fixtures\TestClassMagicGet;
|
||||
use Symfony\Component\PropertyAccess\Tests\Fixtures\Ticket5775Object;
|
||||
|
||||
class PropertyAccessorTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
@ -448,4 +449,13 @@ class PropertyAccessorTest extends \PHPUnit_Framework_TestCase
|
||||
array((object) array('property' => (object) array('%!@$§' => 'Bernhard')), 'property.%!@$§', 'Bernhard'),
|
||||
);
|
||||
}
|
||||
|
||||
public function testTicket5755()
|
||||
{
|
||||
$object = new Ticket5775Object();
|
||||
|
||||
$this->propertyAccessor->setValue($object, 'property', 'foobar');
|
||||
|
||||
$this->assertEquals('foobar', $object->getProperty());
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,10 @@
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
<php>
|
||||
<!-- Silence E_USER_DEPRECATED (-16385 == -1 & ~E_USER_DEPRECATED) -->
|
||||
<ini name="error_reporting" value="-16385"/>
|
||||
</php>
|
||||
<testsuites>
|
||||
<testsuite name="Symfony PropertyAccess Component Test Suite">
|
||||
<directory>./Tests/</directory>
|
||||
|
@ -6,6 +6,10 @@
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
<php>
|
||||
<!-- Silence E_USER_DEPRECATED (-16385 == -1 & ~E_USER_DEPRECATED) -->
|
||||
<ini name="error_reporting" value="-16385"/>
|
||||
</php>
|
||||
<testsuites>
|
||||
<testsuite name="Symfony Routing Component Test Suite">
|
||||
<directory>./Tests/</directory>
|
||||
|
@ -1,175 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Security\Core\Tests\Validator\Constraints;
|
||||
|
||||
use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;
|
||||
use Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface;
|
||||
use Symfony\Component\Security\Core\SecurityContextInterface;
|
||||
use Symfony\Component\Security\Core\Validator\Constraints\UserPassword;
|
||||
use Symfony\Component\Security\Core\Validator\Constraints\UserPasswordValidator;
|
||||
use Symfony\Component\Validator\Tests\Constraints\AbstractConstraintValidatorTest;
|
||||
use Symfony\Component\Validator\Validation;
|
||||
|
||||
/**
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
class UserPasswordValidatorTest extends AbstractConstraintValidatorTest
|
||||
{
|
||||
const PASSWORD = 's3Cr3t';
|
||||
|
||||
const SALT = '^S4lt$';
|
||||
|
||||
/**
|
||||
* @var SecurityContextInterface
|
||||
*/
|
||||
protected $securityContext;
|
||||
|
||||
/**
|
||||
* @var PasswordEncoderInterface
|
||||
*/
|
||||
protected $encoder;
|
||||
|
||||
/**
|
||||
* @var EncoderFactoryInterface
|
||||
*/
|
||||
protected $encoderFactory;
|
||||
|
||||
protected function getApiVersion()
|
||||
{
|
||||
return Validation::API_VERSION_2_5;
|
||||
}
|
||||
|
||||
protected function createValidator()
|
||||
{
|
||||
return new UserPasswordValidator($this->securityContext, $this->encoderFactory);
|
||||
}
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$user = $this->createUser();
|
||||
$this->securityContext = $this->createSecurityContext($user);
|
||||
$this->encoder = $this->createPasswordEncoder();
|
||||
$this->encoderFactory = $this->createEncoderFactory($this->encoder);
|
||||
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
public function testPasswordIsValid()
|
||||
{
|
||||
$constraint = new UserPassword(array(
|
||||
'message' => 'myMessage',
|
||||
));
|
||||
|
||||
$this->encoder->expects($this->once())
|
||||
->method('isPasswordValid')
|
||||
->with(static::PASSWORD, 'secret', static::SALT)
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$this->validator->validate('secret', $constraint);
|
||||
|
||||
$this->assertNoViolation();
|
||||
}
|
||||
|
||||
public function testPasswordIsNotValid()
|
||||
{
|
||||
$constraint = new UserPassword(array(
|
||||
'message' => 'myMessage',
|
||||
));
|
||||
|
||||
$this->encoder->expects($this->once())
|
||||
->method('isPasswordValid')
|
||||
->with(static::PASSWORD, 'secret', static::SALT)
|
||||
->will($this->returnValue(false));
|
||||
|
||||
$this->validator->validate('secret', $constraint);
|
||||
|
||||
$this->buildViolation('myMessage')
|
||||
->assertRaised();
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
|
||||
*/
|
||||
public function testUserIsNotValid()
|
||||
{
|
||||
$user = $this->getMock('Foo\Bar\User');
|
||||
|
||||
$this->securityContext = $this->createSecurityContext($user);
|
||||
$this->validator = $this->createValidator();
|
||||
$this->validator->initialize($this->context);
|
||||
|
||||
$this->validator->validate('secret', new UserPassword());
|
||||
}
|
||||
|
||||
protected function createUser()
|
||||
{
|
||||
$mock = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
|
||||
|
||||
$mock
|
||||
->expects($this->any())
|
||||
->method('getPassword')
|
||||
->will($this->returnValue(static::PASSWORD))
|
||||
;
|
||||
|
||||
$mock
|
||||
->expects($this->any())
|
||||
->method('getSalt')
|
||||
->will($this->returnValue(static::SALT))
|
||||
;
|
||||
|
||||
return $mock;
|
||||
}
|
||||
|
||||
protected function createPasswordEncoder($isPasswordValid = true)
|
||||
{
|
||||
return $this->getMock('Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface');
|
||||
}
|
||||
|
||||
protected function createEncoderFactory($encoder = null)
|
||||
{
|
||||
$mock = $this->getMock('Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface');
|
||||
|
||||
$mock
|
||||
->expects($this->any())
|
||||
->method('getEncoder')
|
||||
->will($this->returnValue($encoder))
|
||||
;
|
||||
|
||||
return $mock;
|
||||
}
|
||||
|
||||
protected function createSecurityContext($user = null)
|
||||
{
|
||||
$token = $this->createAuthenticationToken($user);
|
||||
|
||||
$mock = $this->getMock('Symfony\Component\Security\Core\SecurityContextInterface');
|
||||
$mock
|
||||
->expects($this->any())
|
||||
->method('getToken')
|
||||
->will($this->returnValue($token))
|
||||
;
|
||||
|
||||
return $mock;
|
||||
}
|
||||
|
||||
protected function createAuthenticationToken($user = null)
|
||||
{
|
||||
$mock = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
|
||||
$mock
|
||||
->expects($this->any())
|
||||
->method('getUser')
|
||||
->will($this->returnValue($user))
|
||||
;
|
||||
|
||||
return $mock;
|
||||
}
|
||||
}
|
@ -47,7 +47,7 @@ class SessionAuthenticationStrategy implements SessionAuthenticationStrategyInte
|
||||
return;
|
||||
|
||||
case self::MIGRATE:
|
||||
$request->getSession()->migrate();
|
||||
$request->getSession()->migrate(true);
|
||||
|
||||
return;
|
||||
|
||||
|
@ -40,7 +40,7 @@ class SessionAuthenticationStrategyTest extends \PHPUnit_Framework_TestCase
|
||||
public function testSessionIsMigrated()
|
||||
{
|
||||
$session = $this->getMock('Symfony\Component\HttpFoundation\Session\SessionInterface');
|
||||
$session->expects($this->once())->method('migrate');
|
||||
$session->expects($this->once())->method('migrate')->with($this->equalTo(true));
|
||||
|
||||
$strategy = new SessionAuthenticationStrategy(SessionAuthenticationStrategy::MIGRATE);
|
||||
$strategy->onAuthentication($this->getRequest($session), $this->getToken());
|
||||
|
@ -6,6 +6,10 @@
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
<php>
|
||||
<!-- Silence E_USER_DEPRECATED (-16385 == -1 & ~E_USER_DEPRECATED) -->
|
||||
<ini name="error_reporting" value="-16385"/>
|
||||
</php>
|
||||
<testsuites>
|
||||
<testsuite name="Symfony Security Component Test Suite">
|
||||
<directory>./Acl/Tests/</directory>
|
||||
|
@ -6,6 +6,10 @@
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
<php>
|
||||
<!-- Silence E_USER_DEPRECATED (-16385 == -1 & ~E_USER_DEPRECATED) -->
|
||||
<ini name="error_reporting" value="-16385"/>
|
||||
</php>
|
||||
<testsuites>
|
||||
<testsuite name="Symfony Serializer Component Test Suite">
|
||||
<directory>./Tests/</directory>
|
||||
|
@ -6,6 +6,10 @@
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
<php>
|
||||
<!-- Silence E_USER_DEPRECATED (-16385 == -1 & ~E_USER_DEPRECATED) -->
|
||||
<ini name="error_reporting" value="-16385"/>
|
||||
</php>
|
||||
<testsuites>
|
||||
<testsuite name="Symfony Stopwatch Component Test Suite">
|
||||
<directory>./Tests/</directory>
|
||||
|
@ -6,6 +6,10 @@
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
<php>
|
||||
<!-- Silence E_USER_DEPRECATED (-16385 == -1 & ~E_USER_DEPRECATED) -->
|
||||
<ini name="error_reporting" value="-16385"/>
|
||||
</php>
|
||||
<testsuites>
|
||||
<testsuite name="Symfony Templating Component Test Suite">
|
||||
<directory>./Tests/</directory>
|
||||
|
@ -6,6 +6,10 @@
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
<php>
|
||||
<!-- Silence E_USER_DEPRECATED (-16385 == -1 & ~E_USER_DEPRECATED) -->
|
||||
<ini name="error_reporting" value="-16385"/>
|
||||
</php>
|
||||
<testsuites>
|
||||
<testsuite name="Symfony Translation Component Test Suite">
|
||||
<directory>./Tests/</directory>
|
||||
|
@ -6,6 +6,10 @@
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
<php>
|
||||
<!-- Silence E_USER_DEPRECATED (-16385 == -1 & ~E_USER_DEPRECATED) -->
|
||||
<ini name="error_reporting" value="-16385"/>
|
||||
</php>
|
||||
<testsuites>
|
||||
<testsuite name="Symfony Validator Component Test Suite">
|
||||
<directory>./Tests/</directory>
|
||||
|
@ -6,6 +6,10 @@
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
<php>
|
||||
<!-- php -r 'echo -1 & ~E_USER_DEPRECATED;' -->
|
||||
<ini name="error_reporting" value="-16385"/>
|
||||
</php>
|
||||
<testsuites>
|
||||
<testsuite name="Symfony Yaml Component Test Suite">
|
||||
<directory>./Tests/</directory>
|
||||
|
Reference in New Issue
Block a user