Merge branch '2.3' into 2.6
* 2.3: [DependencyInjection] Removed extra strtolower calls [Validator] Fixed Choice when an empty array is used in the "choices" option Fixed tests [StringUtil] Fixed singularification of 'selfies' Fix Portuguese (Portugal) translation for Security improved exception when missing required component CS: unalign = Show a better error when the port is in use CS: unalign => [FrameworkBundle] Check for 'xlf' instead of 'xliff' Add better phpdoc message for getListeners method of the EventDispatcher Conflicts: src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php src/Symfony/Bundle/TwigBundle/Command/LintCommand.php src/Symfony/Component/DependencyInjection/ContainerBuilder.php src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services11.php src/Symfony/Component/Validator/Constraints/ChoiceValidator.php
This commit is contained in:
commit
3928ed5fce
@ -95,7 +95,7 @@ class DoctrineTokenProvider implements TokenProviderInterface
|
||||
$paramValues = array('value' => $tokenValue,
|
||||
'lastUsed' => $lastUsed,
|
||||
'series' => $series,);
|
||||
$paramTypes = array('value' => \PDO::PARAM_STR,
|
||||
$paramTypes = array('value' => \PDO::PARAM_STR,
|
||||
'lastUsed' => DoctrineType::DATETIME,
|
||||
'series' => \PDO::PARAM_STR,);
|
||||
$updated = $this->conn->executeUpdate($sql, $paramValues, $paramTypes);
|
||||
|
@ -26,9 +26,6 @@ class LazyServiceProjectServiceContainer extends Container
|
||||
$this->services =
|
||||
$this->scopedServices =
|
||||
$this->scopeStacks = array();
|
||||
|
||||
$this->set('service_container', $this);
|
||||
|
||||
$this->scopes = array();
|
||||
$this->scopeChildren = array();
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ class TransChoiceTokenParser extends TransTokenParser
|
||||
if ($stream->test('into')) {
|
||||
// {% transchoice count into "fr" %}
|
||||
$stream->next();
|
||||
$locale = $this->parser->getExpressionParser()->parseExpression();
|
||||
$locale = $this->parser->getExpressionParser()->parseExpression();
|
||||
}
|
||||
|
||||
$stream->expect(\Twig_Token::BLOCK_END_TYPE);
|
||||
|
@ -53,7 +53,7 @@ class TransTokenParser extends \Twig_TokenParser
|
||||
if ($stream->test('into')) {
|
||||
// {% trans into "fr" %}
|
||||
$stream->next();
|
||||
$locale = $this->parser->getExpressionParser()->parseExpression();
|
||||
$locale = $this->parser->getExpressionParser()->parseExpression();
|
||||
} elseif (!$stream->test(\Twig_Token::BLOCK_END_TYPE)) {
|
||||
throw new \Twig_Error_Syntax('Unexpected token. Twig was looking for the "with", "from", or "into" keyword.', $stream->getCurrent()->getLine(), $stream->getFilename());
|
||||
}
|
||||
|
@ -41,4 +41,25 @@ abstract class ServerCommand extends ContainerAwareCommand
|
||||
{
|
||||
return sys_get_temp_dir().'/'.strtr($address, '.:', '--').'.pid';
|
||||
}
|
||||
|
||||
protected function isOtherServerProcessRunning($address)
|
||||
{
|
||||
$lockFile = $this->getLockFile($address);
|
||||
|
||||
if (file_exists($lockFile)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
list($hostname, $port) = explode(':', $address);
|
||||
|
||||
$fp = @fsockopen($hostname, $port, $errno, $errstr, 5);
|
||||
|
||||
if (false !== $fp) {
|
||||
fclose($fp);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ use Symfony\Component\Process\ProcessBuilder;
|
||||
*
|
||||
* @author Michał Pipa <michal.pipa.xsolve@gmail.com>
|
||||
*/
|
||||
class ServerRunCommand extends ContainerAwareCommand
|
||||
class ServerRunCommand extends ServerCommand
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
@ -96,15 +96,28 @@ EOF
|
||||
}
|
||||
|
||||
$env = $this->getContainer()->getParameter('kernel.environment');
|
||||
$address = $input->getArgument('address');
|
||||
|
||||
if (false === strpos($address, ':')) {
|
||||
$output->writeln('The address has to be of the form <comment>bind-address:port</comment>.');
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ($this->isOtherServerProcessRunning($address)) {
|
||||
$output->writeln(sprintf('<error>A process is already listening on http://%s.</error>', $address));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ('prod' === $env) {
|
||||
$output->writeln('<error>Running PHP built-in server in production environment is NOT recommended!</error>');
|
||||
}
|
||||
|
||||
$output->writeln(sprintf("Server running on <info>http://%s</info>\n", $input->getArgument('address')));
|
||||
$output->writeln(sprintf("Server running on <info>http://%s</info>\n", $address));
|
||||
$output->writeln('Quit the server with CONTROL-C.');
|
||||
|
||||
if (null === $builder = $this->createPhpProcessBuilder($input, $output, $env)) {
|
||||
if (null === $builder = $this->createPhpProcessBuilder($output, $adress, $input->getOption('router'), $env)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -131,9 +144,9 @@ EOF
|
||||
return $process->getExitCode();
|
||||
}
|
||||
|
||||
private function createPhpProcessBuilder(InputInterface $input, OutputInterface $output, $env)
|
||||
private function createPhpProcessBuilder(OutputInterface $output, $address, $router, $env)
|
||||
{
|
||||
$router = $input->getOption('router') ?: $this
|
||||
$router = $router ?: $this
|
||||
->getContainer()
|
||||
->get('kernel')
|
||||
->locateResource(sprintf('@FrameworkBundle/Resources/config/router_%s.php', $env))
|
||||
@ -154,6 +167,6 @@ EOF
|
||||
return;
|
||||
}
|
||||
|
||||
return new ProcessBuilder(array($binary, '-S', $input->getArgument('address'), $router));
|
||||
return new ProcessBuilder(array($binary, '-S', $address, $router));
|
||||
}
|
||||
}
|
||||
|
@ -160,27 +160,6 @@ EOF
|
||||
}
|
||||
}
|
||||
|
||||
private function isOtherServerProcessRunning($address)
|
||||
{
|
||||
$lockFile = $this->getLockFile($address);
|
||||
|
||||
if (file_exists($lockFile)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
list($hostname, $port) = explode(':', $address);
|
||||
|
||||
$fp = @fsockopen($hostname, $port, $errno, $errstr, 5);
|
||||
|
||||
if (false !== $fp) {
|
||||
fclose($fp);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine the absolute file path for the router script, using the environment to choose a standard script
|
||||
* if no custom router script is specified.
|
||||
|
@ -141,7 +141,7 @@ EOF
|
||||
}
|
||||
}
|
||||
|
||||
if ($input->getOption('output-format') == 'xliff') {
|
||||
if ($input->getOption('output-format') == 'xlf') {
|
||||
$output->writeln('Xliff output version is <info>1.2</info>');
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ class PhpStringTokenParser
|
||||
{
|
||||
protected static $replacements = array(
|
||||
'\\' => '\\',
|
||||
'$' => '$',
|
||||
'$' => '$',
|
||||
'n' => "\n",
|
||||
'r' => "\r",
|
||||
't' => "\t",
|
||||
|
@ -22,7 +22,7 @@ class FirewallEntryPointTest extends WebTestCase
|
||||
|
||||
$client->request('GET', '/secure/resource', array(), array(), array(
|
||||
'PHP_AUTH_USER' => 'unknown',
|
||||
'PHP_AUTH_PW' => 'credentials',
|
||||
'PHP_AUTH_PW' => 'credentials',
|
||||
));
|
||||
|
||||
$this->assertEquals(
|
||||
|
@ -470,7 +470,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
||||
return $service;
|
||||
}
|
||||
|
||||
if (!$this->hasDefinition($id) && isset($this->aliasDefinitions[$id])) {
|
||||
if (!array_key_exists($id, $this->definitions) && isset($this->aliasDefinitions[$id])) {
|
||||
return $this->get($this->aliasDefinitions[$id]);
|
||||
}
|
||||
|
||||
@ -684,7 +684,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
||||
throw new InvalidArgumentException('$id must be a string, or an Alias object.');
|
||||
}
|
||||
|
||||
if ($alias === strtolower($id)) {
|
||||
if ($alias === (string) $id) {
|
||||
throw new InvalidArgumentException(sprintf('An alias can not reference itself, got a circular reference on "%s".', $alias));
|
||||
}
|
||||
|
||||
@ -746,7 +746,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
||||
{
|
||||
$id = strtolower($id);
|
||||
|
||||
if (!$this->hasAlias($id)) {
|
||||
if (!isset($this->aliasDefinitions[$id])) {
|
||||
throw new InvalidArgumentException(sprintf('The service alias "%s" does not exist.', $id));
|
||||
}
|
||||
|
||||
@ -864,7 +864,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
||||
{
|
||||
$id = strtolower($id);
|
||||
|
||||
if (!$this->hasDefinition($id)) {
|
||||
if (!array_key_exists($id, $this->definitions)) {
|
||||
throw new InvalidArgumentException(sprintf('The service definition "%s" does not exist.', $id));
|
||||
}
|
||||
|
||||
@ -886,8 +886,10 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
||||
*/
|
||||
public function findDefinition($id)
|
||||
{
|
||||
while ($this->hasAlias($id)) {
|
||||
$id = (string) $this->getAlias($id);
|
||||
$id = strtolower($id);
|
||||
|
||||
while (isset($this->aliasDefinitions[$id])) {
|
||||
$id = (string) $this->aliasDefinitions[$id];
|
||||
}
|
||||
|
||||
return $this->getDefinition($id);
|
||||
|
@ -898,9 +898,6 @@ EOF;
|
||||
\$this->services =
|
||||
\$this->scopedServices =
|
||||
\$this->scopeStacks = array();
|
||||
|
||||
\$this->set('service_container', \$this);
|
||||
|
||||
EOF;
|
||||
|
||||
$code .= "\n";
|
||||
|
@ -190,6 +190,13 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertTrue($builder->has('bar'), '->setAlias() defines a new service');
|
||||
$this->assertTrue($builder->get('bar') === $builder->get('foo'), '->setAlias() creates a service that is an alias to another one');
|
||||
|
||||
try {
|
||||
$builder->setAlias('foobar', 'foobar');
|
||||
$this->fail('->setAlias() throws an InvalidArgumentException if the alias references itself');
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
$this->assertEquals('An alias can not reference itself, got a circular reference on "foobar".', $e->getMessage(), '->setAlias() throws an InvalidArgumentException if the alias references itself');
|
||||
}
|
||||
|
||||
try {
|
||||
$builder->getAlias('foobar');
|
||||
$this->fail('->getAlias() throws an InvalidArgumentException if the alias does not exist');
|
||||
|
@ -29,9 +29,6 @@ class ProjectServiceContainer extends Container
|
||||
$this->services =
|
||||
$this->scopedServices =
|
||||
$this->scopeStacks = array();
|
||||
|
||||
$this->set('service_container', $this);
|
||||
|
||||
$this->scopes = array();
|
||||
$this->scopeChildren = array();
|
||||
$this->methodMap = array(
|
||||
|
@ -33,9 +33,6 @@ class ProjectServiceContainer extends Container
|
||||
$this->services =
|
||||
$this->scopedServices =
|
||||
$this->scopeStacks = array();
|
||||
|
||||
$this->set('service_container', $this);
|
||||
|
||||
$this->scopes = array();
|
||||
$this->scopeChildren = array();
|
||||
$this->methodMap = array(
|
||||
|
@ -29,9 +29,6 @@ class ProjectServiceContainer extends Container
|
||||
$this->services =
|
||||
$this->scopedServices =
|
||||
$this->scopeStacks = array();
|
||||
|
||||
$this->set('service_container', $this);
|
||||
|
||||
$this->scopes = array();
|
||||
$this->scopeChildren = array();
|
||||
$this->methodMap = array(
|
||||
|
@ -77,7 +77,7 @@ interface EventDispatcherInterface
|
||||
public function removeSubscriber(EventSubscriberInterface $subscriber);
|
||||
|
||||
/**
|
||||
* Gets the listeners of a specific event or all listeners.
|
||||
* Gets the listeners of a specific event or all listeners sorted by descending priority.
|
||||
*
|
||||
* @param string $eventName The name of the event
|
||||
*
|
||||
|
@ -155,7 +155,7 @@ class MongoDbSessionHandler implements \SessionHandlerInterface
|
||||
public function read($sessionId)
|
||||
{
|
||||
$dbData = $this->getCollection()->findOne(array(
|
||||
$this->options['id_field'] => $sessionId,
|
||||
$this->options['id_field'] => $sessionId,
|
||||
$this->options['expiry_field'] => array('$gte' => new \MongoDate()),
|
||||
));
|
||||
|
||||
|
@ -94,14 +94,14 @@ class UriSigner
|
||||
ksort($params);
|
||||
$url['query'] = http_build_query($params, '', '&');
|
||||
|
||||
$scheme = isset($url['scheme']) ? $url['scheme'].'://' : '';
|
||||
$host = isset($url['host']) ? $url['host'] : '';
|
||||
$port = isset($url['port']) ? ':'.$url['port'] : '';
|
||||
$user = isset($url['user']) ? $url['user'] : '';
|
||||
$pass = isset($url['pass']) ? ':'.$url['pass'] : '';
|
||||
$pass = ($user || $pass) ? "$pass@" : '';
|
||||
$path = isset($url['path']) ? $url['path'] : '';
|
||||
$query = isset($url['query']) && $url['query'] ? '?'.$url['query'] : '';
|
||||
$scheme = isset($url['scheme']) ? $url['scheme'].'://' : '';
|
||||
$host = isset($url['host']) ? $url['host'] : '';
|
||||
$port = isset($url['port']) ? ':'.$url['port'] : '';
|
||||
$user = isset($url['user']) ? $url['user'] : '';
|
||||
$pass = isset($url['pass']) ? ':'.$url['pass'] : '';
|
||||
$pass = ($user || $pass) ? "$pass@" : '';
|
||||
$path = isset($url['path']) ? $url['path'] : '';
|
||||
$query = isset($url['query']) && $url['query'] ? '?'.$url['query'] : '';
|
||||
$fragment = isset($url['fragment']) ? '#'.$url['fragment'] : '';
|
||||
|
||||
return $scheme.$user.$pass.$host.$port.$path.$query.$fragment;
|
||||
|
@ -48,7 +48,7 @@ class ProcessUtils
|
||||
}
|
||||
|
||||
$escapedArgument = '';
|
||||
$quote = false;
|
||||
$quote = false;
|
||||
foreach (preg_split('/(")/i', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
|
||||
if ('"' === $part) {
|
||||
$escapedArgument .= '\\"';
|
||||
|
@ -60,6 +60,9 @@ class StringUtil
|
||||
// indices (index), appendices (appendix), prices (price)
|
||||
array('seci', 4, false, true, array('ex', 'ix', 'ice')),
|
||||
|
||||
// selfies (selfie)
|
||||
array('seifles', 7, true, true, 'selfie'),
|
||||
|
||||
// movies (movie)
|
||||
array('seivom', 6, true, true, 'movie'),
|
||||
|
||||
|
@ -119,6 +119,7 @@ class StringUtilTest extends \PHPUnit_Framework_TestCase
|
||||
array('sandwiches', array('sandwich', 'sandwiche')),
|
||||
array('scarves', array('scarf', 'scarve', 'scarff')),
|
||||
array('schemas', 'schema'), //schemata
|
||||
array('selfies', 'selfie'),
|
||||
array('sheriffs', 'sheriff'),
|
||||
array('shoes', array('sho', 'shoe')),
|
||||
array('spies', 'spy'),
|
||||
|
@ -4,7 +4,7 @@
|
||||
<body>
|
||||
<trans-unit id="1">
|
||||
<source>An authentication exception occurred.</source>
|
||||
<target>Ocorreu um excepção durante a autenticação.</target>
|
||||
<target>Ocorreu uma excepção durante a autenticação.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="2">
|
||||
<source>Authentication credentials could not be found.</source>
|
||||
@ -20,7 +20,7 @@
|
||||
</trans-unit>
|
||||
<trans-unit id="5">
|
||||
<source>Cookie has already been used by someone else.</source>
|
||||
<target>Este cookie já esta em uso.</target>
|
||||
<target>Este cookie já está em uso.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="6">
|
||||
<source>Not privileged to request the resource.</source>
|
||||
@ -64,7 +64,7 @@
|
||||
</trans-unit>
|
||||
<trans-unit id="16">
|
||||
<source>Account is locked.</source>
|
||||
<target>A conta esta trancada.</target>
|
||||
<target>A conta está trancada.</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
|
@ -26,6 +26,10 @@ class YamlFileDumper extends FileDumper
|
||||
*/
|
||||
protected function format(MessageCatalogue $messages, $domain)
|
||||
{
|
||||
if (!class_exists('Symfony\Component\Yaml\Yaml')) {
|
||||
throw new \LogicException('Dumping translations in the YAML format requires the Symfony Yaml component.');
|
||||
}
|
||||
|
||||
return Yaml::dump($messages->all($domain));
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,10 @@ class CsvFileLoader extends ArrayLoader
|
||||
}
|
||||
|
||||
$catalogue = parent::load($messages, $locale, $domain);
|
||||
$catalogue->addResource(new FileResource($resource));
|
||||
|
||||
if (class_exists('Symfony\Component\Config\Resource\FileResource')) {
|
||||
$catalogue->addResource(new FileResource($resource));
|
||||
}
|
||||
|
||||
return $catalogue;
|
||||
}
|
||||
|
@ -52,7 +52,10 @@ class IcuDatFileLoader extends IcuResFileLoader
|
||||
$messages = $this->flatten($rb);
|
||||
$catalogue = new MessageCatalogue($locale);
|
||||
$catalogue->add($messages, $domain);
|
||||
$catalogue->addResource(new FileResource($resource.'.dat'));
|
||||
|
||||
if (class_exists('Symfony\Component\Config\Resource\FileResource')) {
|
||||
$catalogue->addResource(new FileResource($resource.'.dat'));
|
||||
}
|
||||
|
||||
return $catalogue;
|
||||
}
|
||||
|
@ -52,7 +52,10 @@ class IcuResFileLoader implements LoaderInterface
|
||||
$messages = $this->flatten($rb);
|
||||
$catalogue = new MessageCatalogue($locale);
|
||||
$catalogue->add($messages, $domain);
|
||||
$catalogue->addResource(new DirectoryResource($resource));
|
||||
|
||||
if (class_exists('Symfony\Component\Config\Resource\DirectoryResource')) {
|
||||
$catalogue->addResource(new DirectoryResource($resource));
|
||||
}
|
||||
|
||||
return $catalogue;
|
||||
}
|
||||
|
@ -38,7 +38,10 @@ class IniFileLoader extends ArrayLoader
|
||||
$messages = parse_ini_file($resource, true);
|
||||
|
||||
$catalogue = parent::load($messages, $locale, $domain);
|
||||
$catalogue->addResource(new FileResource($resource));
|
||||
|
||||
if (class_exists('Symfony\Component\Config\Resource\FileResource')) {
|
||||
$catalogue->addResource(new FileResource($resource));
|
||||
}
|
||||
|
||||
return $catalogue;
|
||||
}
|
||||
|
@ -66,7 +66,10 @@ class MoFileLoader extends ArrayLoader
|
||||
}
|
||||
|
||||
$catalogue = parent::load($messages, $locale, $domain);
|
||||
$catalogue->addResource(new FileResource($resource));
|
||||
|
||||
if (class_exists('Symfony\Component\Config\Resource\FileResource')) {
|
||||
$catalogue->addResource(new FileResource($resource));
|
||||
}
|
||||
|
||||
return $catalogue;
|
||||
}
|
||||
|
@ -42,7 +42,10 @@ class PhpFileLoader extends ArrayLoader
|
||||
$messages = require $resource;
|
||||
|
||||
$catalogue = parent::load($messages, $locale, $domain);
|
||||
$catalogue->addResource(new FileResource($resource));
|
||||
|
||||
if (class_exists('Symfony\Component\Config\Resource\FileResource')) {
|
||||
$catalogue->addResource(new FileResource($resource));
|
||||
}
|
||||
|
||||
return $catalogue;
|
||||
}
|
||||
|
@ -44,7 +44,10 @@ class PoFileLoader extends ArrayLoader
|
||||
}
|
||||
|
||||
$catalogue = parent::load($messages, $locale, $domain);
|
||||
$catalogue->addResource(new FileResource($resource));
|
||||
|
||||
if (class_exists('Symfony\Component\Config\Resource\FileResource')) {
|
||||
$catalogue->addResource(new FileResource($resource));
|
||||
}
|
||||
|
||||
return $catalogue;
|
||||
}
|
||||
|
@ -68,7 +68,10 @@ class QtFileLoader implements LoaderInterface
|
||||
}
|
||||
$translation = $translation->nextSibling;
|
||||
}
|
||||
$catalogue->addResource(new FileResource($resource));
|
||||
|
||||
if (class_exists('Symfony\Component\Config\Resource\FileResource')) {
|
||||
$catalogue->addResource(new FileResource($resource));
|
||||
}
|
||||
}
|
||||
|
||||
libxml_use_internal_errors($internalErrors);
|
||||
|
@ -78,7 +78,10 @@ class XliffFileLoader implements LoaderInterface
|
||||
$catalogue->setMetadata((string) $source, array('notes' => $notes), $domain);
|
||||
}
|
||||
}
|
||||
$catalogue->addResource(new FileResource($resource));
|
||||
|
||||
if (class_exists('Symfony\Component\Config\Resource\FileResource')) {
|
||||
$catalogue->addResource(new FileResource($resource));
|
||||
}
|
||||
|
||||
return $catalogue;
|
||||
}
|
||||
|
@ -43,6 +43,10 @@ class YamlFileLoader extends ArrayLoader
|
||||
throw new NotFoundResourceException(sprintf('File "%s" not found.', $resource));
|
||||
}
|
||||
|
||||
if (!class_exists('Symfony\Component\Yaml\Parser')) {
|
||||
throw new \LogicException('Loading translations from the YAML format requires the Symfony Yaml component.');
|
||||
}
|
||||
|
||||
if (null === $this->yamlParser) {
|
||||
$this->yamlParser = new YamlParser();
|
||||
}
|
||||
@ -64,7 +68,10 @@ class YamlFileLoader extends ArrayLoader
|
||||
}
|
||||
|
||||
$catalogue = parent::load($messages, $locale, $domain);
|
||||
$catalogue->addResource(new FileResource($resource));
|
||||
|
||||
if (class_exists('Symfony\Component\Config\Resource\FileResource')) {
|
||||
$catalogue->addResource(new FileResource($resource));
|
||||
}
|
||||
|
||||
return $catalogue;
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ EOF;
|
||||
'42 cannot be used here',
|
||||
'this is the message template',
|
||||
array(),
|
||||
array('some_value' => 42),
|
||||
array('some_value' => 42),
|
||||
'some_value',
|
||||
null
|
||||
);
|
||||
|
@ -167,6 +167,20 @@ class ChoiceValidatorTest extends AbstractConstraintValidatorTest
|
||||
->assertRaised();
|
||||
}
|
||||
|
||||
public function testInvalidChoiceEmptyChoices()
|
||||
{
|
||||
$constraint = new Choice(array(
|
||||
'choices' => array(),
|
||||
'message' => 'myMessage',
|
||||
));
|
||||
|
||||
$this->validator->validate('baz', $constraint);
|
||||
|
||||
$this->buildViolation('myMessage')
|
||||
->setParameter('{{ value }}', '"baz"')
|
||||
->assertRaised();
|
||||
}
|
||||
|
||||
public function testInvalidChoiceMultiple()
|
||||
{
|
||||
$constraint = new Choice(array(
|
||||
|
Reference in New Issue
Block a user