Merge branch '2.1'
* 2.1: fixed CS fixed CS [Security] fixed path info encoding (closes #6040, closes #5695) [HttpFoundation] added some tests for the previous merge and removed dead code (closes #6037) Improved Cache-Control header when no-cache is sent removed unneeded comment Fix to allow null values in labels array fix date in changelog removed the Travis icon (as this is not stable enough -- many false positive, closes #6186) Revert "merged branch gajdaw/finder_splfileinfo_fpassthu (PR #4751)" (closes #6224) Fixed a typo Fixed: HeaderBag::parseCacheControl() not parsing quoted zero correctly [Form] Fix const inside an anonymous function [Config] Loader::import must return imported data [DoctrineBridge] Fixed caching in DoctrineType when "choices" or "preferred_choices" is passed [Form] Fixed the default value of "format" in DateType to DateType::DEFAULT_FORMAT if "widget" is not "single_text" [HttpFoundation] fixed a small regression Conflicts: src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php
This commit is contained in:
commit
3c010db2cb
@ -7,7 +7,7 @@ in 2.1 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 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/v2.1.0...v2.1.1
|
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v2.1.0...v2.1.1
|
||||||
|
|
||||||
* 2.1.4 (2012-12-29)
|
* 2.1.4 (2012-11-29)
|
||||||
|
|
||||||
* e5536f0: replaced magic strings by proper constants
|
* e5536f0: replaced magic strings by proper constants
|
||||||
* 6a3ba52: fixed the logic in Request::isSecure() (if the information comes from a source that we trust, don't check other ones)
|
* 6a3ba52: fixed the logic in Request::isSecure() (if the information comes from a source that we trust, don't check other ones)
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
README
|
README
|
||||||
======
|
======
|
||||||
|
|
||||||
[![Build Status](https://secure.travis-ci.org/symfony/symfony.png?branch=master)](http://travis-ci.org/symfony/symfony)
|
|
||||||
|
|
||||||
What is Symfony2?
|
What is Symfony2?
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
@ -77,16 +77,16 @@ abstract class DoctrineType extends AbstractType
|
|||||||
// A second parameter ($key) is passed, so we cannot use
|
// A second parameter ($key) is passed, so we cannot use
|
||||||
// spl_object_hash() directly (which strictly requires
|
// spl_object_hash() directly (which strictly requires
|
||||||
// one parameter)
|
// one parameter)
|
||||||
array_walk_recursive($choiceHashes, function ($value) {
|
array_walk_recursive($choiceHashes, function (&$value) {
|
||||||
return spl_object_hash($value);
|
$value = spl_object_hash($value);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$preferredChoiceHashes = $options['preferred_choices'];
|
$preferredChoiceHashes = $options['preferred_choices'];
|
||||||
|
|
||||||
if (is_array($preferredChoiceHashes)) {
|
if (is_array($preferredChoiceHashes)) {
|
||||||
array_walk_recursive($preferredChoiceHashes, function ($value) {
|
array_walk_recursive($preferredChoiceHashes, function (&$value) {
|
||||||
return spl_object_hash($value);
|
$value = spl_object_hash($value);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,4 +86,4 @@ class DoctrineOrmTypeGuesserTest extends \PHPUnit_Framework_TestCase
|
|||||||
return new DoctrineOrmTypeGuesser($registry);
|
return new DoctrineOrmTypeGuesser($registry);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ class EntityTypePerformanceTest extends FormPerformanceTestCase
|
|||||||
{
|
{
|
||||||
$this->setMaxRunningTime(1);
|
$this->setMaxRunningTime(1);
|
||||||
|
|
||||||
for ($i = 0; $i < 20; ++$i) {
|
for ($i = 0; $i < 40; ++$i) {
|
||||||
$form = $this->factory->create('entity', null, array(
|
$form = $this->factory->create('entity', null, array(
|
||||||
'class' => self::ENTITY_CLASS,
|
'class' => self::ENTITY_CLASS,
|
||||||
));
|
));
|
||||||
@ -114,11 +114,14 @@ class EntityTypePerformanceTest extends FormPerformanceTestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group benchmark
|
||||||
|
*/
|
||||||
public function testCollapsedEntityFieldWithQueryBuilder()
|
public function testCollapsedEntityFieldWithQueryBuilder()
|
||||||
{
|
{
|
||||||
$this->setMaxRunningTime(1);
|
$this->setMaxRunningTime(1);
|
||||||
|
|
||||||
for ($i = 0; $i < 20; ++$i) {
|
for ($i = 0; $i < 40; ++$i) {
|
||||||
$form = $this->factory->create('entity', null, array(
|
$form = $this->factory->create('entity', null, array(
|
||||||
'class' => self::ENTITY_CLASS,
|
'class' => self::ENTITY_CLASS,
|
||||||
'query_builder' => function (EntityRepository $repo) {
|
'query_builder' => function (EntityRepository $repo) {
|
||||||
@ -130,4 +133,42 @@ class EntityTypePerformanceTest extends FormPerformanceTestCase
|
|||||||
$form->createView();
|
$form->createView();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group benchmark
|
||||||
|
*/
|
||||||
|
public function testCollapsedEntityFieldWithChoices()
|
||||||
|
{
|
||||||
|
$choices = $this->em->createQuery('SELECT c FROM ' . self::ENTITY_CLASS . ' c')->getResult();
|
||||||
|
$this->setMaxRunningTime(1);
|
||||||
|
|
||||||
|
for ($i = 0; $i < 40; ++$i) {
|
||||||
|
$form = $this->factory->create('entity', null, array(
|
||||||
|
'class' => self::ENTITY_CLASS,
|
||||||
|
'choices' => $choices,
|
||||||
|
));
|
||||||
|
|
||||||
|
// force loading of the choice list
|
||||||
|
$form->createView();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group benchmark
|
||||||
|
*/
|
||||||
|
public function testCollapsedEntityFieldWithPreferredChoices()
|
||||||
|
{
|
||||||
|
$choices = $this->em->createQuery('SELECT c FROM ' . self::ENTITY_CLASS . ' c')->getResult();
|
||||||
|
$this->setMaxRunningTime(1);
|
||||||
|
|
||||||
|
for ($i = 0; $i < 40; ++$i) {
|
||||||
|
$form = $this->factory->create('entity', null, array(
|
||||||
|
'class' => self::ENTITY_CLASS,
|
||||||
|
'preferred_choices' => $choices,
|
||||||
|
));
|
||||||
|
|
||||||
|
// force loading of the choice list
|
||||||
|
$form->createView();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
namespace Symfony\Bridge\Doctrine\Tests\Logger;
|
namespace Symfony\Bridge\Doctrine\Tests\Logger;
|
||||||
|
|
||||||
|
|
||||||
class DbalLoggerTest extends \PHPUnit_Framework_TestCase
|
class DbalLoggerTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -78,7 +78,7 @@ class Controller extends ContainerAware
|
|||||||
* @param string $view The view name
|
* @param string $view The view name
|
||||||
* @param array $parameters An array of parameters to pass to the view
|
* @param array $parameters An array of parameters to pass to the view
|
||||||
*
|
*
|
||||||
* @return string The renderer view
|
* @return string The rendered view
|
||||||
*/
|
*/
|
||||||
public function renderView($view, array $parameters = array())
|
public function renderView($view, array $parameters = array())
|
||||||
{
|
{
|
||||||
|
@ -23,7 +23,7 @@ class EnumNodeDefinition extends ScalarNodeDefinition
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->values = $values;
|
$this->values = $values;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,4 +40,4 @@ class EnumNodeDefinition extends ScalarNodeDefinition
|
|||||||
|
|
||||||
return new EnumNode($this->name, $this->parent, $this->values);
|
return new EnumNode($this->name, $this->parent, $this->values);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,10 +47,12 @@ abstract class Loader implements LoaderInterface
|
|||||||
*
|
*
|
||||||
* @param mixed $resource A Resource
|
* @param mixed $resource A Resource
|
||||||
* @param string $type The resource type
|
* @param string $type The resource type
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function import($resource, $type = null)
|
public function import($resource, $type = null)
|
||||||
{
|
{
|
||||||
$this->resolve($resource)->load($resource, $type);
|
return $this->resolve($resource)->load($resource, $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -55,6 +55,15 @@ class LoaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertInstanceOf('Symfony\Component\Config\Exception\FileLoaderLoadException', $e, '->resolve() throws a FileLoaderLoadException if the resource cannot be loaded');
|
$this->assertInstanceOf('Symfony\Component\Config\Exception\FileLoaderLoadException', $e, '->resolve() throws a FileLoaderLoadException if the resource cannot be loaded');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testImport()
|
||||||
|
{
|
||||||
|
$loader = $this->getMock('Symfony\Component\Config\Loader\Loader', array('supports', 'load'));
|
||||||
|
$loader->expects($this->once())->method('supports')->will($this->returnValue(true));
|
||||||
|
$loader->expects($this->once())->method('load')->will($this->returnValue('yes'));
|
||||||
|
|
||||||
|
$this->assertEquals('yes', $loader->import('foo'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ProjectLoader1 extends Loader
|
class ProjectLoader1 extends Loader
|
||||||
|
@ -242,7 +242,6 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertRegExp('/Did you mean this/', $e->getMessage(), '->find() throws an \InvalidArgumentException if command does not exist, with one alternative');
|
$this->assertRegExp('/Did you mean this/', $e->getMessage(), '->find() throws an \InvalidArgumentException if command does not exist, with one alternative');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$application->add(new \Foo1Command());
|
$application->add(new \Foo1Command());
|
||||||
$application->add(new \Foo2Command());
|
$application->add(new \Foo2Command());
|
||||||
|
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
namespace Symfony\Component\Console\Tests\Formatter;
|
namespace Symfony\Component\Console\Tests\Formatter;
|
||||||
|
|
||||||
use Symfony\Component\Console\Formatter\OutputFormatter;
|
use Symfony\Component\Console\Formatter\OutputFormatter;
|
||||||
|
@ -209,7 +209,6 @@ class FunctionNode implements NodeInterface
|
|||||||
$xpath->addCondition(sprintf('contains(string(.), %s)', XPathExpr::xpathLiteral($expr)));
|
$xpath->addCondition(sprintf('contains(string(.), %s)', XPathExpr::xpathLiteral($expr)));
|
||||||
|
|
||||||
// FIXME: Currently case insensitive matching doesn't seem to be happening
|
// FIXME: Currently case insensitive matching doesn't seem to be happening
|
||||||
|
|
||||||
return $xpath;
|
return $xpath;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,7 +263,6 @@ class FunctionNode implements NodeInterface
|
|||||||
|
|
||||||
if (false === strpos($s, 'n')) {
|
if (false === strpos($s, 'n')) {
|
||||||
// Just a b
|
// Just a b
|
||||||
|
|
||||||
return array(0, intval((string) $s));
|
return array(0, intval((string) $s));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,7 +360,7 @@ class Filesystem
|
|||||||
if ($copyOnWindows) {
|
if ($copyOnWindows) {
|
||||||
if (is_link($file) || is_file($file)) {
|
if (is_link($file) || is_file($file)) {
|
||||||
$this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
|
$this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
|
||||||
} else if (is_dir($file)) {
|
} elseif (is_dir($file)) {
|
||||||
$this->mkdir($target);
|
$this->mkdir($target);
|
||||||
} else {
|
} else {
|
||||||
throw new IOException(sprintf('Unable to guess "%s" file type.', $file));
|
throw new IOException(sprintf('Unable to guess "%s" file type.', $file));
|
||||||
@ -368,9 +368,9 @@ class Filesystem
|
|||||||
} else {
|
} else {
|
||||||
if (is_link($file)) {
|
if (is_link($file)) {
|
||||||
$this->symlink($file, $target);
|
$this->symlink($file, $target);
|
||||||
} else if (is_dir($file)) {
|
} elseif (is_dir($file)) {
|
||||||
$this->mkdir($target);
|
$this->mkdir($target);
|
||||||
} else if (is_file($file)) {
|
} elseif (is_file($file)) {
|
||||||
$this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
|
$this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
|
||||||
} else {
|
} else {
|
||||||
throw new IOException(sprintf('Unable to guess "%s" file type.', $file));
|
throw new IOException(sprintf('Unable to guess "%s" file type.', $file));
|
||||||
|
@ -62,10 +62,14 @@ class SplFileInfo extends \SplFileInfo
|
|||||||
*/
|
*/
|
||||||
public function getContents()
|
public function getContents()
|
||||||
{
|
{
|
||||||
$file = new \SplFileObject($this->getRealpath(), 'rb');
|
$level = error_reporting(0);
|
||||||
ob_start();
|
$content = file_get_contents($this->getRealpath());
|
||||||
$file->fpassthru();
|
error_reporting($level);
|
||||||
|
if (false === $content) {
|
||||||
|
$error = error_get_last();
|
||||||
|
throw new \RuntimeException($error['message']);
|
||||||
|
}
|
||||||
|
|
||||||
return ob_get_clean();
|
return $content;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -261,7 +261,7 @@ class ChoiceList implements ChoiceListInterface
|
|||||||
{
|
{
|
||||||
// Add choices to the nested buckets
|
// Add choices to the nested buckets
|
||||||
foreach ($choices as $group => $choice) {
|
foreach ($choices as $group => $choice) {
|
||||||
if (!isset($labels[$group])) {
|
if (!array_key_exists($group, $labels)) {
|
||||||
throw new \InvalidArgumentException('The structures of the choices and labels array do not match.');
|
throw new \InvalidArgumentException('The structures of the choices and labels array do not match.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,6 @@ class DateTimeToRfc3339Transformer extends BaseDateTimeTransformer
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$dateTime = new \DateTime($rfc3339);
|
$dateTime = new \DateTime($rfc3339);
|
||||||
|
|
||||||
if ($this->outputTimezone !== $this->inputTimezone) {
|
if ($this->outputTimezone !== $this->inputTimezone) {
|
||||||
|
@ -180,6 +180,10 @@ class DateType extends AbstractType
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$format = function (Options $options) {
|
||||||
|
return $options['widget'] === 'single_text' ? DateType::HTML5_FORMAT : DateType::DEFAULT_FORMAT;
|
||||||
|
};
|
||||||
|
|
||||||
// BC until Symfony 2.3
|
// BC until Symfony 2.3
|
||||||
$modelTimezone = function (Options $options) {
|
$modelTimezone = function (Options $options) {
|
||||||
return $options['data_timezone'];
|
return $options['data_timezone'];
|
||||||
@ -196,7 +200,7 @@ class DateType extends AbstractType
|
|||||||
'days' => range(1, 31),
|
'days' => range(1, 31),
|
||||||
'widget' => 'choice',
|
'widget' => 'choice',
|
||||||
'input' => 'datetime',
|
'input' => 'datetime',
|
||||||
'format' => self::HTML5_FORMAT,
|
'format' => $format,
|
||||||
'model_timezone' => $modelTimezone,
|
'model_timezone' => $modelTimezone,
|
||||||
'view_timezone' => $viewTimezone,
|
'view_timezone' => $viewTimezone,
|
||||||
// Deprecated timezone options
|
// Deprecated timezone options
|
||||||
|
@ -46,7 +46,7 @@ class FileType extends AbstractType
|
|||||||
{
|
{
|
||||||
$resolver->setDefaults(array(
|
$resolver->setDefaults(array(
|
||||||
'compound' => false,
|
'compound' => false,
|
||||||
'data_class' => 'Symfony\Component\HttpFoundation\File\File'
|
'data_class' => 'Symfony\Component\HttpFoundation\File\File'
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ abstract class Guess
|
|||||||
*/
|
*/
|
||||||
public function __construct($confidence)
|
public function __construct($confidence)
|
||||||
{
|
{
|
||||||
if (self::VERY_HIGH_CONFIDENCE !== $confidence && self::HIGH_CONFIDENCE !== $confidence &&
|
if (self::VERY_HIGH_CONFIDENCE !== $confidence && self::HIGH_CONFIDENCE !== $confidence &&
|
||||||
self::MEDIUM_CONFIDENCE !== $confidence && self::LOW_CONFIDENCE !== $confidence) {
|
self::MEDIUM_CONFIDENCE !== $confidence && self::LOW_CONFIDENCE !== $confidence) {
|
||||||
throw new \InvalidArgumentException('The confidence should be one of the constants defined in Guess.');
|
throw new \InvalidArgumentException('The confidence should be one of the constants defined in Guess.');
|
||||||
}
|
}
|
||||||
|
@ -809,14 +809,14 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
|
|||||||
[@id="name_date"]
|
[@id="name_date"]
|
||||||
[
|
[
|
||||||
./select
|
./select
|
||||||
[@id="name_date_year"]
|
|
||||||
[./option[@value="2011"][@selected="selected"]]
|
|
||||||
/following-sibling::select
|
|
||||||
[@id="name_date_month"]
|
[@id="name_date_month"]
|
||||||
[./option[@value="2"][@selected="selected"]]
|
[./option[@value="2"][@selected="selected"]]
|
||||||
/following-sibling::select
|
/following-sibling::select
|
||||||
[@id="name_date_day"]
|
[@id="name_date_day"]
|
||||||
[./option[@value="3"][@selected="selected"]]
|
[./option[@value="3"][@selected="selected"]]
|
||||||
|
/following-sibling::select
|
||||||
|
[@id="name_date_year"]
|
||||||
|
[./option[@value="2011"][@selected="selected"]]
|
||||||
]
|
]
|
||||||
/following-sibling::div
|
/following-sibling::div
|
||||||
[@id="name_time"]
|
[@id="name_time"]
|
||||||
@ -849,14 +849,14 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
|
|||||||
[@id="name_date"]
|
[@id="name_date"]
|
||||||
[
|
[
|
||||||
./select
|
./select
|
||||||
[@id="name_date_year"]
|
|
||||||
[./option[@value=""][.="[trans]Change&Me[/trans]"]]
|
|
||||||
/following-sibling::select
|
|
||||||
[@id="name_date_month"]
|
[@id="name_date_month"]
|
||||||
[./option[@value=""][.="[trans]Change&Me[/trans]"]]
|
[./option[@value=""][.="[trans]Change&Me[/trans]"]]
|
||||||
/following-sibling::select
|
/following-sibling::select
|
||||||
[@id="name_date_day"]
|
[@id="name_date_day"]
|
||||||
[./option[@value=""][.="[trans]Change&Me[/trans]"]]
|
[./option[@value=""][.="[trans]Change&Me[/trans]"]]
|
||||||
|
/following-sibling::select
|
||||||
|
[@id="name_date_year"]
|
||||||
|
[./option[@value=""][.="[trans]Change&Me[/trans]"]]
|
||||||
]
|
]
|
||||||
/following-sibling::div
|
/following-sibling::div
|
||||||
[@id="name_time"]
|
[@id="name_time"]
|
||||||
@ -889,14 +889,14 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
|
|||||||
[@id="name_date"]
|
[@id="name_date"]
|
||||||
[
|
[
|
||||||
./select
|
./select
|
||||||
[@id="name_date_year"]
|
|
||||||
[./option[@value="2011"][@selected="selected"]]
|
|
||||||
/following-sibling::select
|
|
||||||
[@id="name_date_month"]
|
[@id="name_date_month"]
|
||||||
[./option[@value="2"][@selected="selected"]]
|
[./option[@value="2"][@selected="selected"]]
|
||||||
/following-sibling::select
|
/following-sibling::select
|
||||||
[@id="name_date_day"]
|
[@id="name_date_day"]
|
||||||
[./option[@value="3"][@selected="selected"]]
|
[./option[@value="3"][@selected="selected"]]
|
||||||
|
/following-sibling::select
|
||||||
|
[@id="name_date_year"]
|
||||||
|
[./option[@value="2011"][@selected="selected"]]
|
||||||
]
|
]
|
||||||
/following-sibling::div
|
/following-sibling::div
|
||||||
[@id="name_time"]
|
[@id="name_time"]
|
||||||
@ -928,14 +928,14 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
|
|||||||
[@id="name_date"]
|
[@id="name_date"]
|
||||||
[
|
[
|
||||||
./select
|
./select
|
||||||
[@id="name_date_year"]
|
|
||||||
[./option[@value="2011"][@selected="selected"]]
|
|
||||||
/following-sibling::select
|
|
||||||
[@id="name_date_month"]
|
[@id="name_date_month"]
|
||||||
[./option[@value="2"][@selected="selected"]]
|
[./option[@value="2"][@selected="selected"]]
|
||||||
/following-sibling::select
|
/following-sibling::select
|
||||||
[@id="name_date_day"]
|
[@id="name_date_day"]
|
||||||
[./option[@value="3"][@selected="selected"]]
|
[./option[@value="3"][@selected="selected"]]
|
||||||
|
/following-sibling::select
|
||||||
|
[@id="name_date_year"]
|
||||||
|
[./option[@value="2011"][@selected="selected"]]
|
||||||
]
|
]
|
||||||
/following-sibling::div
|
/following-sibling::div
|
||||||
[@id="name_time"]
|
[@id="name_time"]
|
||||||
@ -1031,14 +1031,14 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
|
|||||||
'/div
|
'/div
|
||||||
[
|
[
|
||||||
./select
|
./select
|
||||||
[@id="name_year"]
|
|
||||||
[./option[@value="2011"][@selected="selected"]]
|
|
||||||
/following-sibling::select
|
|
||||||
[@id="name_month"]
|
[@id="name_month"]
|
||||||
[./option[@value="2"][@selected="selected"]]
|
[./option[@value="2"][@selected="selected"]]
|
||||||
/following-sibling::select
|
/following-sibling::select
|
||||||
[@id="name_day"]
|
[@id="name_day"]
|
||||||
[./option[@value="3"][@selected="selected"]]
|
[./option[@value="3"][@selected="selected"]]
|
||||||
|
/following-sibling::select
|
||||||
|
[@id="name_year"]
|
||||||
|
[./option[@value="2011"][@selected="selected"]]
|
||||||
]
|
]
|
||||||
[count(./select)=3]
|
[count(./select)=3]
|
||||||
'
|
'
|
||||||
@ -1058,14 +1058,14 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
|
|||||||
'/div
|
'/div
|
||||||
[
|
[
|
||||||
./select
|
./select
|
||||||
[@id="name_year"]
|
|
||||||
[./option[@value=""][.="[trans]Change&Me[/trans]"]]
|
|
||||||
/following-sibling::select
|
|
||||||
[@id="name_month"]
|
[@id="name_month"]
|
||||||
[./option[@value=""][.="[trans]Change&Me[/trans]"]]
|
[./option[@value=""][.="[trans]Change&Me[/trans]"]]
|
||||||
/following-sibling::select
|
/following-sibling::select
|
||||||
[@id="name_day"]
|
[@id="name_day"]
|
||||||
[./option[@value=""][.="[trans]Change&Me[/trans]"]]
|
[./option[@value=""][.="[trans]Change&Me[/trans]"]]
|
||||||
|
/following-sibling::select
|
||||||
|
[@id="name_year"]
|
||||||
|
[./option[@value=""][.="[trans]Change&Me[/trans]"]]
|
||||||
]
|
]
|
||||||
[count(./select)=3]
|
[count(./select)=3]
|
||||||
'
|
'
|
||||||
@ -1085,14 +1085,14 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
|
|||||||
'/div
|
'/div
|
||||||
[
|
[
|
||||||
./select
|
./select
|
||||||
[@id="name_year"]
|
|
||||||
[./option[@value=""][.="[trans]Change&Me[/trans]"]]
|
|
||||||
/following-sibling::select
|
|
||||||
[@id="name_month"]
|
[@id="name_month"]
|
||||||
[./option[@value="1"]]
|
[./option[@value="1"]]
|
||||||
/following-sibling::select
|
/following-sibling::select
|
||||||
[@id="name_day"]
|
[@id="name_day"]
|
||||||
[./option[@value="1"]]
|
[./option[@value="1"]]
|
||||||
|
/following-sibling::select
|
||||||
|
[@id="name_year"]
|
||||||
|
[./option[@value=""][.="[trans]Change&Me[/trans]"]]
|
||||||
]
|
]
|
||||||
[count(./select)=3]
|
[count(./select)=3]
|
||||||
'
|
'
|
||||||
@ -1110,10 +1110,6 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
|
|||||||
'/div
|
'/div
|
||||||
[
|
[
|
||||||
./input
|
./input
|
||||||
[@id="name_year"]
|
|
||||||
[@type="text"]
|
|
||||||
[@value="2011"]
|
|
||||||
/following-sibling::input
|
|
||||||
[@id="name_month"]
|
[@id="name_month"]
|
||||||
[@type="text"]
|
[@type="text"]
|
||||||
[@value="2"]
|
[@value="2"]
|
||||||
@ -1121,6 +1117,10 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
|
|||||||
[@id="name_day"]
|
[@id="name_day"]
|
||||||
[@type="text"]
|
[@type="text"]
|
||||||
[@value="3"]
|
[@value="3"]
|
||||||
|
/following-sibling::input
|
||||||
|
[@id="name_year"]
|
||||||
|
[@type="text"]
|
||||||
|
[@value="2011"]
|
||||||
]
|
]
|
||||||
[count(./input)=3]
|
[count(./input)=3]
|
||||||
'
|
'
|
||||||
@ -1164,14 +1164,14 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
|
|||||||
'/div
|
'/div
|
||||||
[
|
[
|
||||||
./select
|
./select
|
||||||
[@id="name_year"]
|
|
||||||
[./option[@value="2000"][@selected="selected"]]
|
|
||||||
/following-sibling::select
|
|
||||||
[@id="name_month"]
|
[@id="name_month"]
|
||||||
[./option[@value="2"][@selected="selected"]]
|
[./option[@value="2"][@selected="selected"]]
|
||||||
/following-sibling::select
|
/following-sibling::select
|
||||||
[@id="name_day"]
|
[@id="name_day"]
|
||||||
[./option[@value="3"][@selected="selected"]]
|
[./option[@value="3"][@selected="selected"]]
|
||||||
|
/following-sibling::select
|
||||||
|
[@id="name_year"]
|
||||||
|
[./option[@value="2000"][@selected="selected"]]
|
||||||
]
|
]
|
||||||
[count(./select)=3]
|
[count(./select)=3]
|
||||||
'
|
'
|
||||||
@ -1190,10 +1190,6 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
|
|||||||
'/div
|
'/div
|
||||||
[
|
[
|
||||||
./select
|
./select
|
||||||
[@id="name_year"]
|
|
||||||
[./option[@value=""][.="[trans][/trans]"]]
|
|
||||||
[./option[@value="1950"][@selected="selected"]]
|
|
||||||
/following-sibling::select
|
|
||||||
[@id="name_month"]
|
[@id="name_month"]
|
||||||
[./option[@value=""][.="[trans][/trans]"]]
|
[./option[@value=""][.="[trans][/trans]"]]
|
||||||
[./option[@value="1"][@selected="selected"]]
|
[./option[@value="1"][@selected="selected"]]
|
||||||
@ -1201,6 +1197,10 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
|
|||||||
[@id="name_day"]
|
[@id="name_day"]
|
||||||
[./option[@value=""][.="[trans][/trans]"]]
|
[./option[@value=""][.="[trans][/trans]"]]
|
||||||
[./option[@value="1"][@selected="selected"]]
|
[./option[@value="1"][@selected="selected"]]
|
||||||
|
/following-sibling::select
|
||||||
|
[@id="name_year"]
|
||||||
|
[./option[@value=""][.="[trans][/trans]"]]
|
||||||
|
[./option[@value="1950"][@selected="selected"]]
|
||||||
]
|
]
|
||||||
[count(./select)=3]
|
[count(./select)=3]
|
||||||
'
|
'
|
||||||
|
@ -184,4 +184,17 @@ class ChoiceListTest extends \PHPUnit_Framework_TestCase
|
|||||||
array('A')
|
array('A')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testLabelsContainingNull()
|
||||||
|
{
|
||||||
|
$this->list = new ChoiceList(
|
||||||
|
array($this->obj1, $this->obj2),
|
||||||
|
array('A', null)
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertEquals(
|
||||||
|
array(0 => new ChoiceView($this->obj1, '0', 'A'), 1 => new ChoiceView($this->obj2, '1', null)),
|
||||||
|
$this->list->getRemainingViews()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,4 +18,3 @@ abstract class DateTimeTestCase extends LocalizedTestCase
|
|||||||
self::assertEquals($expected->format('c'), $actual->format('c'));
|
self::assertEquals($expected->format('c'), $actual->format('c'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -510,18 +510,18 @@ class DateTypeTest extends LocalizedTestCase
|
|||||||
$form = $this->factory->create('date');
|
$form = $this->factory->create('date');
|
||||||
$view = $form->createView();
|
$view = $form->createView();
|
||||||
|
|
||||||
$this->assertSame('{{ year }}-{{ month }}-{{ day }}', $view->vars['date_pattern']);
|
$this->assertSame('{{ day }}.{{ month }}.{{ year }}', $view->vars['date_pattern']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testPassDatePatternToViewDifferentFormat()
|
public function testPassDatePatternToViewDifferentFormat()
|
||||||
{
|
{
|
||||||
$form = $this->factory->create('date', null, array(
|
$form = $this->factory->create('date', null, array(
|
||||||
'format' => \IntlDateFormatter::MEDIUM,
|
'format' => \IntlDateFormatter::LONG,
|
||||||
));
|
));
|
||||||
|
|
||||||
$view = $form->createView();
|
$view = $form->createView();
|
||||||
|
|
||||||
$this->assertSame('{{ day }}.{{ month }}.{{ year }}', $view->vars['date_pattern']);
|
$this->assertSame('{{ day }}. {{ month }} {{ year }}', $view->vars['date_pattern']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testPassDatePatternToViewDifferentPattern()
|
public function testPassDatePatternToViewDifferentPattern()
|
||||||
|
@ -227,7 +227,6 @@ class ViolationMapperTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
// The mapping must be deterministic! If a child has the property path "[street]",
|
// The mapping must be deterministic! If a child has the property path "[street]",
|
||||||
// "data[street]" should be mapped, but "data.street" should not!
|
// "data[street]" should be mapped, but "data.street" should not!
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
// mapping target, child name, its property path, grand child name, its property path, violation path
|
// mapping target, child name, its property path, grand child name, its property path, violation path
|
||||||
array(self::LEVEL_0, 'address', 'address', 'street', 'street', ''),
|
array(self::LEVEL_0, 'address', 'address', 'street', 'street', ''),
|
||||||
@ -1260,7 +1259,6 @@ class ViolationMapperTest extends \PHPUnit_Framework_TestCase
|
|||||||
// 1) the error actually maps to an existing child and
|
// 1) the error actually maps to an existing child and
|
||||||
// 2) the property path of that child (relative to the form providing
|
// 2) the property path of that child (relative to the form providing
|
||||||
// the mapping) matches the left side of the mapping
|
// the mapping) matches the left side of the mapping
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
// mapping target, map from, map to, child name, its property path, grand child name, its property path, violation path
|
// mapping target, map from, map to, child name, its property path, grand child name, its property path, violation path
|
||||||
array(self::LEVEL_1, 'foo', 'address', 'foo', 'foo', 'address', 'address', 'street', 'street', 'children[foo].children[street].data'),
|
array(self::LEVEL_1, 'foo', 'address', 'foo', 'foo', 'address', 'address', 'street', 'street', 'children[foo].children[street].data'),
|
||||||
|
@ -317,7 +317,7 @@ class HeaderBag implements \IteratorAggregate, \Countable
|
|||||||
$cacheControl = array();
|
$cacheControl = array();
|
||||||
preg_match_all('#([a-zA-Z][a-zA-Z_-]*)\s*(?:=(?:"([^"]*)"|([^ \t",;]*)))?#', $header, $matches, PREG_SET_ORDER);
|
preg_match_all('#([a-zA-Z][a-zA-Z_-]*)\s*(?:=(?:"([^"]*)"|([^ \t",;]*)))?#', $header, $matches, PREG_SET_ORDER);
|
||||||
foreach ($matches as $match) {
|
foreach ($matches as $match) {
|
||||||
$cacheControl[strtolower($match[1])] = isset($match[2]) && $match[2] ? $match[2] : (isset($match[3]) ? $match[3] : true);
|
$cacheControl[strtolower($match[1])] = isset($match[3]) ? $match[3] : (isset($match[2]) ? $match[2] : true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $cacheControl;
|
return $cacheControl;
|
||||||
|
@ -1007,7 +1007,7 @@ class Request
|
|||||||
|
|
||||||
// trim and remove port number from host
|
// trim and remove port number from host
|
||||||
// host is lowercase as per RFC 952/2181
|
// host is lowercase as per RFC 952/2181
|
||||||
$host = strtolower(trim(preg_replace('/:\d+$/', '', $host)));
|
$host = strtolower(preg_replace('/:\d+$/', '', trim($host)));
|
||||||
|
|
||||||
// as the host can come from the user (HTTP_HOST and depending on the configuration, SERVER_NAME too can come from the user)
|
// as the host can come from the user (HTTP_HOST and depending on the configuration, SERVER_NAME too can come from the user)
|
||||||
// check that it does not contain forbidden characters (see RFC 952 and RFC 2181)
|
// check that it does not contain forbidden characters (see RFC 952 and RFC 2181)
|
||||||
|
@ -150,4 +150,3 @@ class RequestMatcher implements RequestMatcherInterface
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,6 +245,12 @@ class Response
|
|||||||
$this->setProtocolVersion('1.1');
|
$this->setProtocolVersion('1.1');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if we need to send extra expire info headers
|
||||||
|
if ('1.0' == $this->getProtocolVersion() && 'no-cache' == $this->headers->get('Cache-Control')) {
|
||||||
|
$this->headers->set('pragma', 'no-cache');
|
||||||
|
$this->headers->set('expires', -1);
|
||||||
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,6 +168,13 @@ class HeaderBagTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals('max-age=10, public, s-maxage=100', $bag->get('cache-control'));
|
$this->assertEquals('max-age=10, public, s-maxage=100', $bag->get('cache-control'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testCacheControlDirectiveParsingQuotedZero()
|
||||||
|
{
|
||||||
|
$bag = new HeaderBag(array('cache-control' => 'max-age="0"'));
|
||||||
|
$this->assertTrue($bag->hasCacheControlDirective('max-age'));
|
||||||
|
$this->assertEquals(0, $bag->getCacheControlDirective('max-age'));
|
||||||
|
}
|
||||||
|
|
||||||
public function testCacheControlDirectiveOverrideWithReplace()
|
public function testCacheControlDirectiveOverrideWithReplace()
|
||||||
{
|
{
|
||||||
$bag = new HeaderBag(array('cache-control' => 'private, max-age=100'));
|
$bag = new HeaderBag(array('cache-control' => 'private, max-age=100'));
|
||||||
|
@ -351,6 +351,23 @@ class ResponseTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals('', $response->getContent());
|
$this->assertEquals('', $response->getContent());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testPrepareSetsPragmaOnHttp10Only()
|
||||||
|
{
|
||||||
|
$request = Request::create('/', 'GET');
|
||||||
|
$request->server->set('SERVER_PROTOCOL', 'HTTP/1.0');
|
||||||
|
|
||||||
|
$response = new Response('foo');
|
||||||
|
$response->prepare($request);
|
||||||
|
$this->assertEquals('no-cache', $response->headers->get('pragma'));
|
||||||
|
$this->assertEquals('-1', $response->headers->get('expires'));
|
||||||
|
|
||||||
|
$request->server->set('SERVER_PROTOCOL', 'HTTP/1.1');
|
||||||
|
$response = new Response('foo');
|
||||||
|
$response->prepare($request);
|
||||||
|
$this->assertFalse($response->headers->has('pragma'));
|
||||||
|
$this->assertFalse($response->headers->has('expires'));
|
||||||
|
}
|
||||||
|
|
||||||
public function testSetCache()
|
public function testSetCache()
|
||||||
{
|
{
|
||||||
$response = new Response();
|
$response = new Response();
|
||||||
|
@ -54,6 +54,7 @@ class NativeFileSessionHandlerTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function savePathDataProvider()
|
public function savePathDataProvider()
|
||||||
{
|
{
|
||||||
$base = sys_get_temp_dir();
|
$base = sys_get_temp_dir();
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
array("$base/foo", "$base/foo", "$base/foo"),
|
array("$base/foo", "$base/foo", "$base/foo"),
|
||||||
array("5;$base/foo", "5;$base/foo", "$base/foo"),
|
array("5;$base/foo", "5;$base/foo", "$base/foo"),
|
||||||
|
@ -40,7 +40,7 @@ class MongoDbProfilerStorageTestDataCollector extends DataCollector
|
|||||||
public function collect(Request $request, Response $response, \Exception $exception = null)
|
public function collect(Request $request, Response $response, \Exception $exception = null)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName()
|
public function getName()
|
||||||
{
|
{
|
||||||
return 'test_data_collector';
|
return 'test_data_collector';
|
||||||
@ -126,4 +126,3 @@ class MongoDbProfilerStorageTest extends AbstractProfilerStorageTest
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +125,8 @@ function get_data($index, $dataDir, $locale = 'en', $constraint = null)
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
function icu_version() {
|
function icu_version()
|
||||||
|
{
|
||||||
exec('icu-config --version', $output, $result);
|
exec('icu-config --version', $output, $result);
|
||||||
|
|
||||||
if ($result !== 0 || !isset($output[0])) {
|
if ($result !== 0 || !isset($output[0])) {
|
||||||
@ -135,13 +136,15 @@ function icu_version() {
|
|||||||
return $output[0];
|
return $output[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalize_icu_version($version) {
|
function normalize_icu_version($version)
|
||||||
|
{
|
||||||
preg_match('/^(?P<version>[0-9]\.[0-9]|[0-9]{2,})/', $version, $matches);
|
preg_match('/^(?P<version>[0-9]\.[0-9]|[0-9]{2,})/', $version, $matches);
|
||||||
|
|
||||||
return $matches['version'];
|
return $matches['version'];
|
||||||
}
|
}
|
||||||
|
|
||||||
function download_icu_data($version) {
|
function download_icu_data($version)
|
||||||
|
{
|
||||||
$icu = parse_ini_file(__DIR__.'/icu.ini');
|
$icu = parse_ini_file(__DIR__.'/icu.ini');
|
||||||
|
|
||||||
if (!isset($icu[$version])) {
|
if (!isset($icu[$version])) {
|
||||||
@ -624,4 +627,4 @@ create_stub_datafile($defaultLocale, $stubRegionDir, $countries);
|
|||||||
|
|
||||||
// Clean up
|
// Clean up
|
||||||
clear_directory($currDir);
|
clear_directory($currDir);
|
||||||
rmdir($currDir);
|
rmdir($currDir);
|
||||||
|
@ -18,7 +18,7 @@ use Symfony\Component\Process\Process;
|
|||||||
*/
|
*/
|
||||||
abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
protected abstract function getProcess($commandline, $cwd = null, array $env = null, $stdin = null, $timeout = 60, array $options = array());
|
abstract protected function getProcess($commandline, $cwd = null, array $env = null, $stdin = null, $timeout = 60, array $options = array());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException Symfony\Component\Process\Exception\InvalidArgumentException
|
* @expectedException Symfony\Component\Process\Exception\InvalidArgumentException
|
||||||
@ -282,7 +282,6 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->markTestSkipped('Windows does not support POSIX signals');
|
$this->markTestSkipped('Windows does not support POSIX signals');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$process = $this->getProcess('php -r "while (true) {}"');
|
$process = $this->getProcess('php -r "while (true) {}"');
|
||||||
$process->start();
|
$process->start();
|
||||||
$process->stop();
|
$process->stop();
|
||||||
|
@ -58,7 +58,6 @@ class DefaultAuthenticationSuccessHandler implements AuthenticationSuccessHandle
|
|||||||
return $this->httpUtils->createRedirectResponse($request, $this->determineTargetUrl($request));
|
return $this->httpUtils->createRedirectResponse($request, $this->determineTargetUrl($request));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the provider key.
|
* Get the provider key.
|
||||||
*
|
*
|
||||||
|
@ -75,6 +75,7 @@ class ContextListener implements ListenerInterface
|
|||||||
|
|
||||||
if (null === $session || null === $token = $session->get('_security_'.$this->contextKey)) {
|
if (null === $session || null === $token = $session->get('_security_'.$this->contextKey)) {
|
||||||
$this->context->setToken(null);
|
$this->context->setToken(null);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ class HttpUtils
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $path === $request->getPathInfo();
|
return $path === rawurldecode($request->getPathInfo());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -97,6 +97,11 @@ class HttpUtilsTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$this->assertTrue($utils->checkRequestPath($this->getRequest(), '/'));
|
$this->assertTrue($utils->checkRequestPath($this->getRequest(), '/'));
|
||||||
$this->assertFalse($utils->checkRequestPath($this->getRequest(), '/foo'));
|
$this->assertFalse($utils->checkRequestPath($this->getRequest(), '/foo'));
|
||||||
|
$this->assertTrue($utils->checkRequestPath($this->getRequest('/foo%20bar'), '/foo bar'));
|
||||||
|
// Plus must not decoded to space
|
||||||
|
$this->assertTrue($utils->checkRequestPath($this->getRequest('/foo+bar'), '/foo+bar'));
|
||||||
|
// Checking unicode
|
||||||
|
$this->assertTrue($utils->checkRequestPath($this->getRequest(urlencode('/вход')), '/вход'));
|
||||||
|
|
||||||
$urlMatcher = $this->getMock('Symfony\Component\Routing\Matcher\UrlMatcherInterface');
|
$urlMatcher = $this->getMock('Symfony\Component\Routing\Matcher\UrlMatcherInterface');
|
||||||
$urlMatcher
|
$urlMatcher
|
||||||
|
@ -62,7 +62,7 @@ class Regex extends Constraint
|
|||||||
* Convert the htmlPattern to a suitable format for HTML5 pattern.
|
* Convert the htmlPattern to a suitable format for HTML5 pattern.
|
||||||
* Example: /^[a-z]+$/ would be converted to [a-z]+
|
* Example: /^[a-z]+$/ would be converted to [a-z]+
|
||||||
* However, if options are specified, it cannot be converted
|
* However, if options are specified, it cannot be converted
|
||||||
*
|
*
|
||||||
* Pattern is also ignored if match=false since the pattern should
|
* Pattern is also ignored if match=false since the pattern should
|
||||||
* then be reversed before application.
|
* then be reversed before application.
|
||||||
*
|
*
|
||||||
@ -78,7 +78,7 @@ class Regex extends Constraint
|
|||||||
if (!$this->match) {
|
if (!$this->match) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preg_match('/^(.)(\^?)(.*?)(\$?)\1$/', $this->pattern, $matches)) {
|
if (preg_match('/^(.)(\^?)(.*?)(\$?)\1$/', $this->pattern, $matches)) {
|
||||||
$delimiter = $matches[1];
|
$delimiter = $matches[1];
|
||||||
$start = empty($matches[2]) ? '.*' : '';
|
$start = empty($matches[2]) ? '.*' : '';
|
||||||
|
@ -162,7 +162,7 @@ class RegexValidatorTest extends \PHPUnit_Framework_TestCase
|
|||||||
'pattern' => '/[a-z]+/',
|
'pattern' => '/[a-z]+/',
|
||||||
));
|
));
|
||||||
$this->assertEquals('.*[a-z]+.*', $constraint->getHtmlPattern());
|
$this->assertEquals('.*[a-z]+.*', $constraint->getHtmlPattern());
|
||||||
|
|
||||||
// Dropped because of match=false
|
// Dropped because of match=false
|
||||||
$constraint = new Regex(array(
|
$constraint = new Regex(array(
|
||||||
'pattern' => '/[a-z]+/',
|
'pattern' => '/[a-z]+/',
|
||||||
@ -170,5 +170,4 @@ class RegexValidatorTest extends \PHPUnit_Framework_TestCase
|
|||||||
));
|
));
|
||||||
$this->assertNull($constraint->getHtmlPattern());
|
$this->assertNull($constraint->getHtmlPattern());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user