Merge branch '2.4'
* 2.4: Revert PHPUnit version, revert APC configuration removed APC on the CLI for Travis as it does not work well with PHPUnit and Composer anyway [Security] Replace exception mocks with actual exception instances. Remove an unused argument. Use `Filesystem::chmod` instead of `chmod` when dumping file [Form] Added test for disabling buttons [Form] Added check for parent disabled status in Button form elements Fixes URL validator to accept single part urls tweaked Travis configuration to get more tests running fixed float comparison in unit tests for HHVM upgraded PHPUnit to version 4 for better HHVM support [Process] fixed HHVM usage on the CLI Fix class names in ApcUniversalClassLoader tests. fixed the profiler when an uncalled listener throws an exception when instantiated fixed CS Added test case for 4c6a2d15095c13b2a35751b2b2712b183be489c4 Fixed bug in ChoiceType triggering a warning when not using utf-8 fixed CS Avoid levenshtein comparison when using ContainerBuilder.
This commit is contained in:
commit
8d69022c04
@ -21,6 +21,7 @@ before_script:
|
|||||||
- sh -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm" ] && [ $(php -r "echo PHP_MINOR_VERSION;") -le 4 ]; then echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;'
|
- sh -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm" ] && [ $(php -r "echo PHP_MINOR_VERSION;") -le 4 ]; then echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;'
|
||||||
- sh -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;'
|
- sh -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;'
|
||||||
- sh -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;'
|
- sh -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;'
|
||||||
|
- sudo locale-gen fr_FR.UTF-8 && sudo update-locale
|
||||||
- COMPOSER_ROOT_VERSION=dev-master composer --prefer-source --dev install
|
- COMPOSER_ROOT_VERSION=dev-master composer --prefer-source --dev install
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
@ -14,6 +14,7 @@ namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
|
|||||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||||
|
use Symfony\Component\Filesystem\Exception\IOException;
|
||||||
use Symfony\Component\Filesystem\Filesystem;
|
use Symfony\Component\Filesystem\Filesystem;
|
||||||
|
|
||||||
class CompilerDebugDumpPass implements CompilerPassInterface
|
class CompilerDebugDumpPass implements CompilerPassInterface
|
||||||
@ -24,8 +25,11 @@ class CompilerDebugDumpPass implements CompilerPassInterface
|
|||||||
|
|
||||||
$filesystem = new Filesystem();
|
$filesystem = new Filesystem();
|
||||||
$filesystem->dumpFile($filename, implode("\n", $container->getCompiler()->getLog()), null);
|
$filesystem->dumpFile($filename, implode("\n", $container->getCompiler()->getLog()), null);
|
||||||
|
try {
|
||||||
|
$filesystem->chmod($filename, 0666, umask());
|
||||||
|
} catch (IOException $e) {
|
||||||
// discard chmod failure (some filesystem may not support it)
|
// discard chmod failure (some filesystem may not support it)
|
||||||
@chmod($filename, 0666 & ~umask());
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getCompilerLogFilename(ContainerInterface $container)
|
public static function getCompilerLogFilename(ContainerInterface $container)
|
||||||
|
@ -14,6 +14,7 @@ namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
|
|||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\Dumper\XmlDumper;
|
use Symfony\Component\DependencyInjection\Dumper\XmlDumper;
|
||||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||||
|
use Symfony\Component\Filesystem\Exception\IOException;
|
||||||
use Symfony\Component\Filesystem\Filesystem;
|
use Symfony\Component\Filesystem\Filesystem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -31,7 +32,10 @@ class ContainerBuilderDebugDumpPass implements CompilerPassInterface
|
|||||||
$filename = $container->getParameter('debug.container.dump');
|
$filename = $container->getParameter('debug.container.dump');
|
||||||
$filesystem = new Filesystem();
|
$filesystem = new Filesystem();
|
||||||
$filesystem->dumpFile($filename, $dumper->dump(), null);
|
$filesystem->dumpFile($filename, $dumper->dump(), null);
|
||||||
|
try {
|
||||||
|
$filesystem->chmod($filename, 0666, umask());
|
||||||
|
} catch (IOException $e) {
|
||||||
// discard chmod failure (some filesystem may not support it)
|
// discard chmod failure (some filesystem may not support it)
|
||||||
@chmod($filename, 0666 & ~umask());
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,9 +36,9 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
{% if collector.notcalledlisteners %}
|
|
||||||
<h2>Not Called Listeners</h2>
|
<h2>Not Called Listeners</h2>
|
||||||
|
|
||||||
|
{% if collector.notcalledlisteners %}
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Event name</th>
|
<th>Event name</th>
|
||||||
@ -52,6 +52,17 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
{% else %}
|
||||||
|
<p>
|
||||||
|
<strong>No uncalled listeners</strong>.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
|
||||||
|
All listeners were called for this request or an error occurred
|
||||||
|
when trying to collect uncalled listeners (in which case check the
|
||||||
|
logs to get more information).
|
||||||
|
|
||||||
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
@ -58,10 +58,8 @@ class ApcUniversalClassLoaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function getLoadClassTests()
|
public function getLoadClassTests()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('\\Apc\\Namespaced\\Foo', '\\Apc\\Namespaced\\Foo', '->loadClass() loads Apc\Namespaced\Foo class'),
|
array('\\Apc\\Namespaced\\Foo', 'Apc\\Namespaced\\Foo', '->loadClass() loads Apc\Namespaced\Foo class'),
|
||||||
array('Apc_Pearlike_Foo', 'Apc_Pearlike_Foo', '->loadClass() loads Apc_Pearlike_Foo class'),
|
array('Apc_Pearlike_Foo', 'Apc_Pearlike_Foo', '->loadClass() loads Apc_Pearlike_Foo class'),
|
||||||
array('\\Apc\\Namespaced\\Bar', '\\Apc\\Namespaced\\Bar', '->loadClass() loads Apc\Namespaced\Bar class with a leading slash'),
|
|
||||||
array('Apc_Pearlike_Bar', '\\Apc_Pearlike_Bar', '->loadClass() loads Apc_Pearlike_Bar class with a leading slash'),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,9 +80,9 @@ class ApcUniversalClassLoaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function getLoadClassFromFallbackTests()
|
public function getLoadClassFromFallbackTests()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('\\Apc\\Namespaced\\Baz', '\\Apc\\Namespaced\\Baz', '->loadClass() loads Apc\Namespaced\Baz class'),
|
array('\\Apc\\Namespaced\\Baz', 'Apc\\Namespaced\\Baz', '->loadClass() loads Apc\Namespaced\Baz class'),
|
||||||
array('Apc_Pearlike_Baz', 'Apc_Pearlike_Baz', '->loadClass() loads Apc_Pearlike_Baz class'),
|
array('Apc_Pearlike_Baz', 'Apc_Pearlike_Baz', '->loadClass() loads Apc_Pearlike_Baz class'),
|
||||||
array('\\Apc\\Namespaced\\FooBar', '\\Apc\\Namespaced\\FooBar', '->loadClass() loads Apc\Namespaced\Baz class from fallback dir'),
|
array('\\Apc\\Namespaced\\FooBar', 'Apc\\Namespaced\\FooBar', '->loadClass() loads Apc\Namespaced\Baz class from fallback dir'),
|
||||||
array('Apc_Pearlike_FooBar', 'Apc_Pearlike_FooBar', '->loadClass() loads Apc_Pearlike_Baz class from fallback dir'),
|
array('Apc_Pearlike_FooBar', 'Apc_Pearlike_FooBar', '->loadClass() loads Apc_Pearlike_Baz class from fallback dir'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -110,7 +108,7 @@ class ApcUniversalClassLoaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
'Apc\\NamespaceCollision\\A' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha',
|
'Apc\\NamespaceCollision\\A' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha',
|
||||||
'Apc\\NamespaceCollision\\A\\B' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/beta',
|
'Apc\\NamespaceCollision\\A\\B' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/beta',
|
||||||
),
|
),
|
||||||
'\Apc\NamespaceCollision\A\Foo',
|
'Apc\NamespaceCollision\A\Foo',
|
||||||
'->loadClass() loads NamespaceCollision\A\Foo from alpha.',
|
'->loadClass() loads NamespaceCollision\A\Foo from alpha.',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
@ -118,7 +116,7 @@ class ApcUniversalClassLoaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
'Apc\\NamespaceCollision\\A\\B' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/beta',
|
'Apc\\NamespaceCollision\\A\\B' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/beta',
|
||||||
'Apc\\NamespaceCollision\\A' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha',
|
'Apc\\NamespaceCollision\\A' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha',
|
||||||
),
|
),
|
||||||
'\Apc\NamespaceCollision\A\Bar',
|
'Apc\NamespaceCollision\A\Bar',
|
||||||
'->loadClass() loads NamespaceCollision\A\Bar from alpha.',
|
'->loadClass() loads NamespaceCollision\A\Bar from alpha.',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
@ -126,7 +124,7 @@ class ApcUniversalClassLoaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
'Apc\\NamespaceCollision\\A' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha',
|
'Apc\\NamespaceCollision\\A' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha',
|
||||||
'Apc\\NamespaceCollision\\A\\B' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/beta',
|
'Apc\\NamespaceCollision\\A\\B' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/beta',
|
||||||
),
|
),
|
||||||
'\Apc\NamespaceCollision\A\B\Foo',
|
'Apc\NamespaceCollision\A\B\Foo',
|
||||||
'->loadClass() loads NamespaceCollision\A\B\Foo from beta.',
|
'->loadClass() loads NamespaceCollision\A\B\Foo from beta.',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
@ -134,7 +132,7 @@ class ApcUniversalClassLoaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
'Apc\\NamespaceCollision\\A\\B' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/beta',
|
'Apc\\NamespaceCollision\\A\\B' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/beta',
|
||||||
'Apc\\NamespaceCollision\\A' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha',
|
'Apc\\NamespaceCollision\\A' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha',
|
||||||
),
|
),
|
||||||
'\Apc\NamespaceCollision\A\B\Bar',
|
'Apc\NamespaceCollision\A\B\Bar',
|
||||||
'->loadClass() loads NamespaceCollision\A\B\Bar from beta.',
|
'->loadClass() loads NamespaceCollision\A\B\Bar from beta.',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
namespace Symfony\Component\Config;
|
namespace Symfony\Component\Config;
|
||||||
|
|
||||||
use Symfony\Component\Config\Resource\ResourceInterface;
|
use Symfony\Component\Config\Resource\ResourceInterface;
|
||||||
|
use Symfony\Component\Filesystem\Exception\IOException;
|
||||||
use Symfony\Component\Filesystem\Filesystem;
|
use Symfony\Component\Filesystem\Filesystem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -93,14 +94,23 @@ class ConfigCache
|
|||||||
*/
|
*/
|
||||||
public function write($content, array $metadata = null)
|
public function write($content, array $metadata = null)
|
||||||
{
|
{
|
||||||
$mode = 0666 & ~umask();
|
$mode = 0666;
|
||||||
|
$umask = umask();
|
||||||
$filesystem = new Filesystem();
|
$filesystem = new Filesystem();
|
||||||
$filesystem->dumpFile($this->file, $content, null);
|
$filesystem->dumpFile($this->file, $content, null);
|
||||||
@chmod($this->file, $mode);
|
try {
|
||||||
|
$filesystem->chmod($this->file, $mode, $umask);
|
||||||
|
} catch (IOException $e) {
|
||||||
|
// discard chmod failure (some filesystem may not support it)
|
||||||
|
}
|
||||||
|
|
||||||
if (null !== $metadata && true === $this->debug) {
|
if (null !== $metadata && true === $this->debug) {
|
||||||
$filesystem->dumpFile($this->getMetaFile(), serialize($metadata), null);
|
$filesystem->dumpFile($this->getMetaFile(), serialize($metadata), null);
|
||||||
@chmod($this->getMetaFile(), $mode);
|
try {
|
||||||
|
$filesystem->chmod($this->getMetaFile(), $mode, $umask);
|
||||||
|
} catch (IOException $e) {
|
||||||
|
// discard chmod failure (some filesystem may not support it)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -460,15 +460,10 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||||||
{
|
{
|
||||||
$id = strtolower($id);
|
$id = strtolower($id);
|
||||||
|
|
||||||
try {
|
if ($service = parent::get($id, ContainerInterface::NULL_ON_INVALID_REFERENCE)) {
|
||||||
return parent::get($id, ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE);
|
return $service;
|
||||||
} catch (InactiveScopeException $e) {
|
|
||||||
if (ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $invalidBehavior) {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
throw $e;
|
|
||||||
} catch (InvalidArgumentException $e) {
|
|
||||||
if (isset($this->loading[$id])) {
|
if (isset($this->loading[$id])) {
|
||||||
throw new LogicException(sprintf('The service "%s" has a circular reference to itself.', $id), 0, $e);
|
throw new LogicException(sprintf('The service "%s" has a circular reference to itself.', $id), 0, $e);
|
||||||
}
|
}
|
||||||
@ -505,7 +500,6 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||||||
|
|
||||||
return $service;
|
return $service;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Merges a ContainerBuilder with the current ContainerBuilder configuration.
|
* Merges a ContainerBuilder with the current ContainerBuilder configuration.
|
||||||
|
@ -142,8 +142,19 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface
|
|||||||
*/
|
*/
|
||||||
public function getNotCalledListeners()
|
public function getNotCalledListeners()
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
|
$allListeners = $this->getListeners();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
if (null !== $this->logger) {
|
||||||
|
$this->logger->info(sprintf('An exception was thrown while getting the uncalled listeners (%s)', $e->getMessage()), array('exception' => $e));
|
||||||
|
}
|
||||||
|
|
||||||
|
// unable to retrieve the uncalled listeners
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
$notCalled = array();
|
$notCalled = array();
|
||||||
foreach ($this->getListeners() as $eventName => $listeners) {
|
foreach ($allListeners as $eventName => $listeners) {
|
||||||
foreach ($listeners as $listener) {
|
foreach ($listeners as $listener) {
|
||||||
$called = false;
|
$called = false;
|
||||||
if (isset($this->called[$eventName])) {
|
if (isset($this->called[$eventName])) {
|
||||||
|
@ -321,9 +321,13 @@ class Button implements \IteratorAggregate, FormInterface
|
|||||||
*/
|
*/
|
||||||
public function isDisabled()
|
public function isDisabled()
|
||||||
{
|
{
|
||||||
|
if (null === $this->parent || !$this->parent->isDisabled()) {
|
||||||
return $this->config->getDisabled();
|
return $this->config->getDisabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unsupported method.
|
* Unsupported method.
|
||||||
*
|
*
|
||||||
|
@ -252,6 +252,8 @@ class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface
|
|||||||
public function setAttribute($name, $value)
|
public function setAttribute($name, $value)
|
||||||
{
|
{
|
||||||
$this->attributes[$name] = $value;
|
$this->attributes[$name] = $value;
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -260,6 +262,8 @@ class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface
|
|||||||
public function setAttributes(array $attributes)
|
public function setAttributes(array $attributes)
|
||||||
{
|
{
|
||||||
$this->attributes = $attributes;
|
$this->attributes = $attributes;
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -286,6 +290,8 @@ class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface
|
|||||||
public function setDisabled($disabled)
|
public function setDisabled($disabled)
|
||||||
{
|
{
|
||||||
$this->disabled = $disabled;
|
$this->disabled = $disabled;
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -410,6 +416,8 @@ class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface
|
|||||||
public function setType(ResolvedFormTypeInterface $type)
|
public function setType(ResolvedFormTypeInterface $type)
|
||||||
{
|
{
|
||||||
$this->type = $type;
|
$this->type = $type;
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -166,7 +166,7 @@ class ChoiceType extends AbstractType
|
|||||||
$choices = null !== $options['choices'] ? $options['choices'] : array();
|
$choices = null !== $options['choices'] ? $options['choices'] : array();
|
||||||
|
|
||||||
// Reuse existing choice lists in order to increase performance
|
// Reuse existing choice lists in order to increase performance
|
||||||
$hash = hash('sha256', json_encode(array($choices, $options['preferred_choices'])));
|
$hash = hash('sha256', serialize(array($choices, $options['preferred_choices'])));
|
||||||
|
|
||||||
if (!isset($choiceListCache[$hash])) {
|
if (!isset($choiceListCache[$hash])) {
|
||||||
$choiceListCache[$hash] = new SimpleChoiceList($choices, $options['preferred_choices']);
|
$choiceListCache[$hash] = new SimpleChoiceList($choices, $options['preferred_choices']);
|
||||||
|
70
src/Symfony/Component/Form/Tests/ButtonTest.php
Normal file
70
src/Symfony/Component/Form/Tests/ButtonTest.php
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
<?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\Form\Tests;
|
||||||
|
|
||||||
|
use Symfony\Component\Form\ButtonBuilder;
|
||||||
|
use Symfony\Component\Form\FormBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||||
|
*/
|
||||||
|
class ButtonTest extends \PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
private $dispatcher;
|
||||||
|
|
||||||
|
private $factory;
|
||||||
|
|
||||||
|
protected function setUp()
|
||||||
|
{
|
||||||
|
$this->dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
|
||||||
|
$this->factory = $this->getMock('Symfony\Component\Form\FormFactoryInterface');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider getDisabledStates
|
||||||
|
*/
|
||||||
|
public function testDisabledIfParentIsDisabled($parentDisabled, $buttonDisabled, $result)
|
||||||
|
{
|
||||||
|
$form = $this->getFormBuilder('form')
|
||||||
|
->setDisabled($parentDisabled)
|
||||||
|
->getForm();
|
||||||
|
|
||||||
|
$button = $this->getButtonBuilder('button')
|
||||||
|
->setDisabled($buttonDisabled)
|
||||||
|
->getForm();
|
||||||
|
|
||||||
|
$button->setParent($form);
|
||||||
|
|
||||||
|
$this->assertSame($result, $button->isDisabled());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDisabledStates()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
// parent, button, result
|
||||||
|
array(true, true, true),
|
||||||
|
array(true, false, true),
|
||||||
|
array(false, true, true),
|
||||||
|
array(false, false, false),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getButtonBuilder($name)
|
||||||
|
{
|
||||||
|
return new ButtonBuilder($name);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getFormBuilder($name)
|
||||||
|
{
|
||||||
|
return new FormBuilder($name, null, $this->dispatcher, $this->factory);
|
||||||
|
}
|
||||||
|
}
|
@ -380,7 +380,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
|
|||||||
|
|
||||||
$form->submit('foobar');
|
$form->submit('foobar');
|
||||||
|
|
||||||
$this->assertSame(null, $form->getData());
|
$this->assertNull($form->getData());
|
||||||
$this->assertSame('foobar', $form->getViewData());
|
$this->assertSame('foobar', $form->getViewData());
|
||||||
$this->assertEmpty($form->getExtraData());
|
$this->assertEmpty($form->getExtraData());
|
||||||
$this->assertFalse($form->isSynchronized());
|
$this->assertFalse($form->isSynchronized());
|
||||||
@ -445,7 +445,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
|
|||||||
|
|
||||||
$form->submit('foobar');
|
$form->submit('foobar');
|
||||||
|
|
||||||
$this->assertSame(null, $form->getData());
|
$this->assertNull($form->getData());
|
||||||
$this->assertSame('foobar', $form->getViewData());
|
$this->assertSame('foobar', $form->getViewData());
|
||||||
$this->assertEmpty($form->getExtraData());
|
$this->assertEmpty($form->getExtraData());
|
||||||
$this->assertFalse($form->isSynchronized());
|
$this->assertFalse($form->isSynchronized());
|
||||||
@ -1216,6 +1216,47 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://github.com/symfony/symfony/issues/10409
|
||||||
|
public function testReuseNonUtf8ChoiceLists()
|
||||||
|
{
|
||||||
|
$form1 = $this->factory->createNamed('name', 'choice', null, array(
|
||||||
|
'choices' => array(
|
||||||
|
'meter' => 'm',
|
||||||
|
'millimeter' => 'mm',
|
||||||
|
'micrometer' => chr(181).'meter',
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
$form2 = $this->factory->createNamed('name', 'choice', null, array(
|
||||||
|
'choices' => array(
|
||||||
|
'meter' => 'm',
|
||||||
|
'millimeter' => 'mm',
|
||||||
|
'micrometer' => chr(181).'meter',
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
$form3 = $this->factory->createNamed('name', 'choice', null, array(
|
||||||
|
'choices' => array(
|
||||||
|
'meter' => 'm',
|
||||||
|
'millimeter' => 'mm',
|
||||||
|
'micrometer' => null,
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
// $form1 and $form2 use the same ChoiceList
|
||||||
|
$this->assertSame(
|
||||||
|
$form1->getConfig()->getOption('choice_list'),
|
||||||
|
$form2->getConfig()->getOption('choice_list')
|
||||||
|
);
|
||||||
|
|
||||||
|
// $form3 doesn't, but used to use the same when using json_encode()
|
||||||
|
// instead of serialize for the hashing algorithm
|
||||||
|
$this->assertNotSame(
|
||||||
|
$form1->getConfig()->getOption('choice_list'),
|
||||||
|
$form3->getConfig()->getOption('choice_list')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function testInitializeWithDefaultObjectChoice()
|
public function testInitializeWithDefaultObjectChoice()
|
||||||
{
|
{
|
||||||
$obj1 = (object) array('value' => 'a', 'label' => 'A');
|
$obj1 = (object) array('value' => 'a', 'label' => 'A');
|
||||||
|
@ -170,34 +170,28 @@ class SimpleFormTest extends AbstractFormTest
|
|||||||
$this->assertFalse($child->isRequired());
|
$this->assertFalse($child->isRequired());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAlwaysDisabledIfParentDisabled()
|
/**
|
||||||
|
* @dataProvider getDisabledStates
|
||||||
|
*/
|
||||||
|
public function testAlwaysDisabledIfParentDisabled($parentDisabled, $disabled, $result)
|
||||||
{
|
{
|
||||||
$parent = $this->getBuilder()->setDisabled(true)->getForm();
|
$parent = $this->getBuilder()->setDisabled($parentDisabled)->getForm();
|
||||||
$child = $this->getBuilder()->setDisabled(false)->getForm();
|
$child = $this->getBuilder()->setDisabled($disabled)->getForm();
|
||||||
|
|
||||||
$child->setParent($parent);
|
$child->setParent($parent);
|
||||||
|
|
||||||
$this->assertTrue($child->isDisabled());
|
$this->assertSame($result, $child->isDisabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDisabled()
|
public function getDisabledStates()
|
||||||
{
|
{
|
||||||
$parent = $this->getBuilder()->setDisabled(false)->getForm();
|
return array(
|
||||||
$child = $this->getBuilder()->setDisabled(true)->getForm();
|
// parent, button, result
|
||||||
|
array(true, true, true),
|
||||||
$child->setParent($parent);
|
array(true, false, true),
|
||||||
|
array(false, true, true),
|
||||||
$this->assertTrue($child->isDisabled());
|
array(false, false, false),
|
||||||
}
|
);
|
||||||
|
|
||||||
public function testNotDisabled()
|
|
||||||
{
|
|
||||||
$parent = $this->getBuilder()->setDisabled(false)->getForm();
|
|
||||||
$child = $this->getBuilder()->setDisabled(false)->getForm();
|
|
||||||
|
|
||||||
$child->setParent($parent);
|
|
||||||
|
|
||||||
$this->assertFalse($child->isDisabled());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetRootReturnsRootOfParent()
|
public function testGetRootReturnsRootOfParent()
|
||||||
|
@ -522,7 +522,7 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
|
|||||||
protected function lock(Request $request, Response $entry)
|
protected function lock(Request $request, Response $entry)
|
||||||
{
|
{
|
||||||
// try to acquire a lock to call the backend
|
// try to acquire a lock to call the backend
|
||||||
$lock = $this->store->lock($request, $entry);
|
$lock = $this->store->lock($request);
|
||||||
|
|
||||||
// there is already another process calling the backend
|
// there is already another process calling the backend
|
||||||
if (true !== $lock) {
|
if (true !== $lock) {
|
||||||
|
@ -780,7 +780,7 @@ abstract class AbstractNumberFormatterTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
|
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
|
||||||
$parsedValue = $formatter->parse($value, NumberFormatter::TYPE_DOUBLE);
|
$parsedValue = $formatter->parse($value, NumberFormatter::TYPE_DOUBLE);
|
||||||
$this->assertSame($expectedValue, $parsedValue);
|
$this->assertEquals($expectedValue, $parsedValue, '', 0.001);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function parseTypeDoubleProvider()
|
public function parseTypeDoubleProvider()
|
||||||
|
@ -34,8 +34,8 @@ class PhpExecutableFinder
|
|||||||
public function find()
|
public function find()
|
||||||
{
|
{
|
||||||
// HHVM support
|
// HHVM support
|
||||||
if (defined('HHVM_VERSION') && false !== $hhvm = getenv('PHP_BINARY')) {
|
if (defined('HHVM_VERSION')) {
|
||||||
return $hhvm;
|
return (false !== ($hhvm = getenv('PHP_BINARY')) ? $hhvm : PHP_BINARY).' --php';
|
||||||
}
|
}
|
||||||
|
|
||||||
// PHP_BINARY return the current sapi executable
|
// PHP_BINARY return the current sapi executable
|
||||||
|
@ -64,7 +64,7 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertSame('MyBundle:Blog:show', $route->getDefault('_controller'));
|
$this->assertSame('MyBundle:Blog:show', $route->getDefault('_controller'));
|
||||||
$this->assertSame('\w+', $route->getRequirement('slug'));
|
$this->assertSame('\w+', $route->getRequirement('slug'));
|
||||||
$this->assertSame('en|fr|de', $route->getRequirement('_locale'));
|
$this->assertSame('en|fr|de', $route->getRequirement('_locale'));
|
||||||
$this->assertSame(null, $route->getDefault('slug'));
|
$this->assertNull($route->getDefault('slug'));
|
||||||
$this->assertSame('RouteCompiler', $route->getOption('compiler_class'));
|
$this->assertSame('RouteCompiler', $route->getOption('compiler_class'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ class AuthenticationProviderManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
} elseif (null !== $exception) {
|
} elseif (null !== $exception) {
|
||||||
$provider->expects($this->once())
|
$provider->expects($this->once())
|
||||||
->method('authenticate')
|
->method('authenticate')
|
||||||
->will($this->throwException($this->getMock($exception, null, array(), '', false)))
|
->will($this->throwException($this->getMock($exception, null, array(), '', true)))
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ namespace Symfony\Component\Security\Core\Tests\Authentication\Provider;
|
|||||||
use Symfony\Component\Security\Core\Encoder\PlaintextPasswordEncoder;
|
use Symfony\Component\Security\Core\Encoder\PlaintextPasswordEncoder;
|
||||||
|
|
||||||
use Symfony\Component\Security\Core\Authentication\Provider\DaoAuthenticationProvider;
|
use Symfony\Component\Security\Core\Authentication\Provider\DaoAuthenticationProvider;
|
||||||
|
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
|
||||||
|
|
||||||
class DaoAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
|
class DaoAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
@ -37,7 +38,7 @@ class DaoAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
|
|||||||
$userProvider = $this->getMock('Symfony\\Component\\Security\\Core\\User\\UserProviderInterface');
|
$userProvider = $this->getMock('Symfony\\Component\\Security\\Core\\User\\UserProviderInterface');
|
||||||
$userProvider->expects($this->once())
|
$userProvider->expects($this->once())
|
||||||
->method('loadUserByUsername')
|
->method('loadUserByUsername')
|
||||||
->will($this->throwException($this->getMock('Symfony\\Component\\Security\\Core\\Exception\\UsernameNotFoundException', null, array(), '', false)))
|
->will($this->throwException(new UsernameNotFoundException()))
|
||||||
;
|
;
|
||||||
|
|
||||||
$provider = new DaoAuthenticationProvider($userProvider, $this->getMock('Symfony\\Component\\Security\\Core\\User\\UserCheckerInterface'), 'key', $this->getMock('Symfony\\Component\\Security\\Core\\Encoder\\EncoderFactoryInterface'));
|
$provider = new DaoAuthenticationProvider($userProvider, $this->getMock('Symfony\\Component\\Security\\Core\\User\\UserCheckerInterface'), 'key', $this->getMock('Symfony\\Component\\Security\\Core\\Encoder\\EncoderFactoryInterface'));
|
||||||
@ -55,7 +56,7 @@ class DaoAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
|
|||||||
$userProvider = $this->getMock('Symfony\\Component\\Security\\Core\\User\\UserProviderInterface');
|
$userProvider = $this->getMock('Symfony\\Component\\Security\\Core\\User\\UserProviderInterface');
|
||||||
$userProvider->expects($this->once())
|
$userProvider->expects($this->once())
|
||||||
->method('loadUserByUsername')
|
->method('loadUserByUsername')
|
||||||
->will($this->throwException($this->getMock('RuntimeException', null, array(), '', false)))
|
->will($this->throwException(new \RuntimeException()))
|
||||||
;
|
;
|
||||||
|
|
||||||
$provider = new DaoAuthenticationProvider($userProvider, $this->getMock('Symfony\\Component\\Security\\Core\\User\\UserCheckerInterface'), 'key', $this->getMock('Symfony\\Component\\Security\\Core\\Encoder\\EncoderFactoryInterface'));
|
$provider = new DaoAuthenticationProvider($userProvider, $this->getMock('Symfony\\Component\\Security\\Core\\User\\UserCheckerInterface'), 'key', $this->getMock('Symfony\\Component\\Security\\Core\\Encoder\\EncoderFactoryInterface'));
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
namespace Symfony\Component\Security\Core\Tests\Authentication\Provider;
|
namespace Symfony\Component\Security\Core\Tests\Authentication\Provider;
|
||||||
|
|
||||||
use Symfony\Component\Security\Core\Authentication\Provider\PreAuthenticatedAuthenticationProvider;
|
use Symfony\Component\Security\Core\Authentication\Provider\PreAuthenticatedAuthenticationProvider;
|
||||||
|
use Symfony\Component\Security\Core\Exception\LockedException;
|
||||||
|
|
||||||
class PreAuthenticatedAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
|
class PreAuthenticatedAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
@ -79,7 +80,7 @@ class PreAuthenticatedAuthenticationProviderTest extends \PHPUnit_Framework_Test
|
|||||||
$userChecker = $this->getMock('Symfony\Component\Security\Core\User\UserCheckerInterface');
|
$userChecker = $this->getMock('Symfony\Component\Security\Core\User\UserCheckerInterface');
|
||||||
$userChecker->expects($this->once())
|
$userChecker->expects($this->once())
|
||||||
->method('checkPostAuth')
|
->method('checkPostAuth')
|
||||||
->will($this->throwException($this->getMock('Symfony\Component\Security\Core\Exception\LockedException', null, array(), '', false)))
|
->will($this->throwException(new LockedException()))
|
||||||
;
|
;
|
||||||
|
|
||||||
$provider = $this->getProvider($user, $userChecker);
|
$provider = $this->getProvider($user, $userChecker);
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
namespace Symfony\Component\Security\Core\Tests\Authentication\Provider;
|
namespace Symfony\Component\Security\Core\Tests\Authentication\Provider;
|
||||||
|
|
||||||
use Symfony\Component\Security\Core\Authentication\Provider\RememberMeAuthenticationProvider;
|
use Symfony\Component\Security\Core\Authentication\Provider\RememberMeAuthenticationProvider;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\RememberMeToken;
|
use Symfony\Component\Security\Core\Exception\AccountExpiredException;
|
||||||
use Symfony\Component\Security\Core\Role\Role;
|
use Symfony\Component\Security\Core\Role\Role;
|
||||||
|
|
||||||
class RememberMeAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
|
class RememberMeAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
|
||||||
@ -52,7 +52,7 @@ class RememberMeAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
|
|||||||
$userChecker = $this->getMock('Symfony\Component\Security\Core\User\UserCheckerInterface');
|
$userChecker = $this->getMock('Symfony\Component\Security\Core\User\UserCheckerInterface');
|
||||||
$userChecker->expects($this->once())
|
$userChecker->expects($this->once())
|
||||||
->method('checkPostAuth')
|
->method('checkPostAuth')
|
||||||
->will($this->throwException($this->getMock('Symfony\Component\Security\Core\Exception\AccountExpiredException', null, array(), '', false)))
|
->will($this->throwException(new AccountExpiredException()))
|
||||||
;
|
;
|
||||||
|
|
||||||
$provider = $this->getProvider($userChecker);
|
$provider = $this->getProvider($userChecker);
|
||||||
|
@ -11,10 +11,12 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Security\Core\Tests\Authentication\Provider;
|
namespace Symfony\Component\Security\Core\Tests\Authentication\Provider;
|
||||||
|
|
||||||
use Symfony\Component\Security\Core\Authentication\Provider\UserAuthenticationProvider;
|
use Symfony\Component\Security\Core\Exception\AccountExpiredException;
|
||||||
|
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
|
||||||
|
use Symfony\Component\Security\Core\Exception\CredentialsExpiredException;
|
||||||
|
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
|
||||||
use Symfony\Component\Security\Core\Role\Role;
|
use Symfony\Component\Security\Core\Role\Role;
|
||||||
use Symfony\Component\Security\Core\Role\SwitchUserRole;
|
use Symfony\Component\Security\Core\Role\SwitchUserRole;
|
||||||
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
|
|
||||||
|
|
||||||
class UserAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
|
class UserAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
@ -41,7 +43,7 @@ class UserAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
|
|||||||
$provider = $this->getProvider(false, false);
|
$provider = $this->getProvider(false, false);
|
||||||
$provider->expects($this->once())
|
$provider->expects($this->once())
|
||||||
->method('retrieveUser')
|
->method('retrieveUser')
|
||||||
->will($this->throwException($this->getMock('Symfony\Component\Security\Core\Exception\UsernameNotFoundException', null, array(), '', false)))
|
->will($this->throwException(new UsernameNotFoundException()))
|
||||||
;
|
;
|
||||||
|
|
||||||
$provider->authenticate($this->getSupportedToken());
|
$provider->authenticate($this->getSupportedToken());
|
||||||
@ -55,7 +57,7 @@ class UserAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
|
|||||||
$provider = $this->getProvider(false, true);
|
$provider = $this->getProvider(false, true);
|
||||||
$provider->expects($this->once())
|
$provider->expects($this->once())
|
||||||
->method('retrieveUser')
|
->method('retrieveUser')
|
||||||
->will($this->throwException($this->getMock('Symfony\Component\Security\Core\Exception\UsernameNotFoundException', null, array(), '', false)))
|
->will($this->throwException(new UsernameNotFoundException()))
|
||||||
;
|
;
|
||||||
|
|
||||||
$provider->authenticate($this->getSupportedToken());
|
$provider->authenticate($this->getSupportedToken());
|
||||||
@ -83,7 +85,7 @@ class UserAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
|
|||||||
$userChecker = $this->getMock('Symfony\Component\Security\Core\User\UserCheckerInterface');
|
$userChecker = $this->getMock('Symfony\Component\Security\Core\User\UserCheckerInterface');
|
||||||
$userChecker->expects($this->once())
|
$userChecker->expects($this->once())
|
||||||
->method('checkPreAuth')
|
->method('checkPreAuth')
|
||||||
->will($this->throwException($this->getMock('Symfony\Component\Security\Core\Exception\CredentialsExpiredException', null, array(), '', false)))
|
->will($this->throwException(new CredentialsExpiredException()))
|
||||||
;
|
;
|
||||||
|
|
||||||
$provider = $this->getProvider($userChecker);
|
$provider = $this->getProvider($userChecker);
|
||||||
@ -103,7 +105,7 @@ class UserAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
|
|||||||
$userChecker = $this->getMock('Symfony\Component\Security\Core\User\UserCheckerInterface');
|
$userChecker = $this->getMock('Symfony\Component\Security\Core\User\UserCheckerInterface');
|
||||||
$userChecker->expects($this->once())
|
$userChecker->expects($this->once())
|
||||||
->method('checkPostAuth')
|
->method('checkPostAuth')
|
||||||
->will($this->throwException($this->getMock('Symfony\Component\Security\Core\Exception\AccountExpiredException', null, array(), '', false)))
|
->will($this->throwException(new AccountExpiredException()))
|
||||||
;
|
;
|
||||||
|
|
||||||
$provider = $this->getProvider($userChecker);
|
$provider = $this->getProvider($userChecker);
|
||||||
@ -128,7 +130,7 @@ class UserAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
|
|||||||
;
|
;
|
||||||
$provider->expects($this->once())
|
$provider->expects($this->once())
|
||||||
->method('checkAuthentication')
|
->method('checkAuthentication')
|
||||||
->will($this->throwException($this->getMock('Symfony\Component\Security\Core\Exception\BadCredentialsException', null, array(), '', false)))
|
->will($this->throwException(new BadCredentialsException()))
|
||||||
;
|
;
|
||||||
|
|
||||||
$provider->authenticate($this->getSupportedToken());
|
$provider->authenticate($this->getSupportedToken());
|
||||||
|
@ -25,7 +25,7 @@ class UrlValidator extends ConstraintValidator
|
|||||||
const PATTERN = '~^
|
const PATTERN = '~^
|
||||||
(%s):// # protocol
|
(%s):// # protocol
|
||||||
(
|
(
|
||||||
([\pL\pN\pS-]+\.)+([\pL]|xn\-\-[\pL\pN-]+)+ # a domain name
|
([\pL\pN\pS-\.])+(\.?([\pL]|xn\-\-[\pL\pN-]+)+\.?) # a domain name
|
||||||
| # or
|
| # or
|
||||||
\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} # a IP address
|
\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} # a IP address
|
||||||
| # or
|
| # or
|
||||||
|
@ -72,6 +72,7 @@ class UrlValidatorTest extends \PHPUnit_Framework_TestCase
|
|||||||
return array(
|
return array(
|
||||||
array('http://a.pl'),
|
array('http://a.pl'),
|
||||||
array('http://www.google.com'),
|
array('http://www.google.com'),
|
||||||
|
array('http://www.google.com.'),
|
||||||
array('http://www.google.museum'),
|
array('http://www.google.museum'),
|
||||||
array('https://google.com/'),
|
array('https://google.com/'),
|
||||||
array('https://google.com:80/'),
|
array('https://google.com:80/'),
|
||||||
@ -85,6 +86,7 @@ class UrlValidatorTest extends \PHPUnit_Framework_TestCase
|
|||||||
array('http://symfony.com/#?'),
|
array('http://symfony.com/#?'),
|
||||||
array('http://www.symfony.com/doc/current/book/validation.html#supported-constraints'),
|
array('http://www.symfony.com/doc/current/book/validation.html#supported-constraints'),
|
||||||
array('http://very.long.domain.name.com/'),
|
array('http://very.long.domain.name.com/'),
|
||||||
|
array('http://localhost/'),
|
||||||
array('http://127.0.0.1/'),
|
array('http://127.0.0.1/'),
|
||||||
array('http://127.0.0.1:80/'),
|
array('http://127.0.0.1:80/'),
|
||||||
array('http://[::1]/'),
|
array('http://[::1]/'),
|
||||||
@ -152,6 +154,7 @@ class UrlValidatorTest extends \PHPUnit_Framework_TestCase
|
|||||||
array('http://127.0.0.1:aa/'),
|
array('http://127.0.0.1:aa/'),
|
||||||
array('ftp://[::1]/'),
|
array('ftp://[::1]/'),
|
||||||
array('http://[::1'),
|
array('http://[::1'),
|
||||||
|
array('http://hello.☎/'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user