Merge branch '3.2' into 3.3
* 3.2: typo [Console] Fix tests [Console] Fixed different behaviour of key and value user inputs in multiple choice question [Cache] Dont use pipelining with RedisCluster [Yaml] fix colon without space deprecation [Intl] Fix intl tests for PHP < 5.5.10
This commit is contained in:
commit
bb84872e6d
@ -303,6 +303,14 @@ trait RedisTrait
|
||||
foreach ($results as $k => list($h, $c)) {
|
||||
$results[$k] = $connections[$h][$c];
|
||||
}
|
||||
} elseif ($this->redis instanceof \RedisCluster) {
|
||||
// phpredis doesn't support pipelining with RedisCluster
|
||||
// see https://github.com/phpredis/phpredis/blob/develop/cluster.markdown#pipelining
|
||||
$results = array();
|
||||
foreach ($generator() as $command => $args) {
|
||||
$results[] = call_user_func_array(array($this->redis, $command), $args);
|
||||
$ids[] = $args[0];
|
||||
}
|
||||
} else {
|
||||
$this->redis->multi(\Redis::PIPELINE);
|
||||
foreach ($generator() as $command => $args) {
|
||||
|
@ -137,7 +137,7 @@ class ChoiceQuestion extends Question
|
||||
|
||||
if ($multiselect) {
|
||||
// Check for a separated comma values
|
||||
if (!preg_match('/^[a-zA-Z0-9_-]+(?:,[a-zA-Z0-9_-]+)*$/', $selectedChoices, $matches)) {
|
||||
if (!preg_match('/^[^,]+(?:,[^,]+)*$/', $selectedChoices, $matches)) {
|
||||
throw new InvalidArgumentException(sprintf($errorMessage, $selected));
|
||||
}
|
||||
$selectedChoices = explode(',', $selectedChoices);
|
||||
|
@ -267,6 +267,37 @@ class QuestionHelperTest extends AbstractQuestionHelperTest
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider specialCharacterInMultipleChoice
|
||||
*/
|
||||
public function testSpecialCharacterChoiceFromMultipleChoiceList($providedAnswer, $expectedValue)
|
||||
{
|
||||
$possibleChoices = array(
|
||||
'.',
|
||||
'src',
|
||||
);
|
||||
|
||||
$dialog = new QuestionHelper();
|
||||
$inputStream = $this->getInputStream($providedAnswer."\n");
|
||||
$helperSet = new HelperSet(array(new FormatterHelper()));
|
||||
$dialog->setHelperSet($helperSet);
|
||||
|
||||
$question = new ChoiceQuestion('Please select the directory', $possibleChoices);
|
||||
$question->setMaxAttempts(1);
|
||||
$question->setMultiselect(true);
|
||||
$answer = $dialog->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question);
|
||||
|
||||
$this->assertSame($expectedValue, $answer);
|
||||
}
|
||||
|
||||
public function specialCharacterInMultipleChoice()
|
||||
{
|
||||
return array(
|
||||
array('.', array('.')),
|
||||
array('., src', array('.', 'src')),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider mixedKeysChoiceListAnswerProvider
|
||||
*/
|
||||
|
@ -318,7 +318,7 @@ abstract class AbstractIntlDateFormatterTest extends TestCase
|
||||
|
||||
/**
|
||||
* @dataProvider formatTimezoneProvider
|
||||
* @requires PHP 5.5
|
||||
* @requires PHP 5.5.10
|
||||
*/
|
||||
public function testFormatTimezone($pattern, $timezone, $expected)
|
||||
{
|
||||
@ -423,6 +423,9 @@ abstract class AbstractIntlDateFormatterTest extends TestCase
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires PHP 5.5.10
|
||||
*/
|
||||
public function testFormatWithDateTimeZoneGmt()
|
||||
{
|
||||
$formatter = $this->getDateFormatter('en', IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT, new \DateTimeZone('GMT'), IntlDateFormatter::GREGORIAN, 'zzz');
|
||||
|
@ -53,8 +53,8 @@ CHANGELOG
|
||||
-----
|
||||
|
||||
* Mappings with a colon (`:`) that is not followed by a whitespace are deprecated
|
||||
and will lead to a `ParseException` in Symfony 4.0 (e.g. `foo:bar` must be
|
||||
`foo: bar`).
|
||||
when the mapping key is not quoted and will lead to a `ParseException` in
|
||||
Symfony 4.0 (e.g. `foo:bar` must be `foo: bar`).
|
||||
|
||||
* Added support for parsing PHP constants:
|
||||
|
||||
|
@ -479,6 +479,7 @@ class Inline
|
||||
}
|
||||
|
||||
// key
|
||||
$isKeyQuoted = in_array($mapping[$i], array('"', "'"), true);
|
||||
$key = self::parseScalar($mapping, $flags, array(':', ' '), $i, false, array(), true);
|
||||
|
||||
if (':' !== $key && false === $i = strpos($mapping, ':', $i)) {
|
||||
@ -497,8 +498,8 @@ class Inline
|
||||
}
|
||||
}
|
||||
|
||||
if (':' !== $key && (!isset($mapping[$i + 1]) || !in_array($mapping[$i + 1], array(' ', ',', '[', ']', '{', '}'), true))) {
|
||||
@trigger_error('Using a colon that is not followed by an indication character (i.e. " ", ",", "[", "]", "{", "}" is deprecated since version 3.2 and will throw a ParseException in 4.0.', E_USER_DEPRECATED);
|
||||
if (':' !== $key && !$isKeyQuoted && (!isset($mapping[$i + 1]) || !in_array($mapping[$i + 1], array(' ', ',', '[', ']', '{', '}'), true))) {
|
||||
@trigger_error('Using a colon after an unquoted mapping key that is not followed by an indication character (i.e. " ", ",", "[", "]", "{", "}") is deprecated since version 3.2 and will throw a ParseException in 4.0.', E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
while ($i < $len) {
|
||||
|
@ -168,7 +168,7 @@ class InlineTest extends TestCase
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @expectedDeprecation Using a colon that is not followed by an indication character (i.e. " ", ",", "[", "]", "{", "}" is deprecated since version 3.2 and will throw a ParseException in 4.0.
|
||||
* @expectedDeprecation Using a colon after an unquoted mapping key that is not followed by an indication character (i.e. " ", ",", "[", "]", "{", "}") is deprecated since version 3.2 and will throw a ParseException in 4.0.
|
||||
* throws \Symfony\Component\Yaml\Exception\ParseException in 4.0
|
||||
*/
|
||||
public function testParseMappingKeyWithColonNotFollowedBySpace()
|
||||
@ -391,6 +391,8 @@ class InlineTest extends TestCase
|
||||
array('{\'foo\': \'bar\', "bar": \'foo: bar\'}', array('foo' => 'bar', 'bar' => 'foo: bar')),
|
||||
array('{\'foo\'\'\': \'bar\', "bar\"": \'foo: bar\'}', array('foo\'' => 'bar', 'bar"' => 'foo: bar')),
|
||||
array('{\'foo: \': \'bar\', "bar: ": \'foo: bar\'}', array('foo: ' => 'bar', 'bar: ' => 'foo: bar')),
|
||||
array('{"foo:bar": "baz"}', array('foo:bar' => 'baz')),
|
||||
array('{"foo":"bar"}', array('foo' => 'bar')),
|
||||
|
||||
// nested sequences and mappings
|
||||
array('[foo, [bar, foo]]', array('foo', array('bar', 'foo'))),
|
||||
@ -460,6 +462,8 @@ class InlineTest extends TestCase
|
||||
array('{\'foo\': \'bar\', "bar": \'foo: bar\'}', (object) array('foo' => 'bar', 'bar' => 'foo: bar')),
|
||||
array('{\'foo\'\'\': \'bar\', "bar\"": \'foo: bar\'}', (object) array('foo\'' => 'bar', 'bar"' => 'foo: bar')),
|
||||
array('{\'foo: \': \'bar\', "bar: ": \'foo: bar\'}', (object) array('foo: ' => 'bar', 'bar: ' => 'foo: bar')),
|
||||
array('{"foo:bar": "baz"}', (object) array('foo:bar' => 'baz')),
|
||||
array('{"foo":"bar"}', (object) array('foo' => 'bar')),
|
||||
|
||||
// nested sequences and mappings
|
||||
array('[foo, [bar, foo]]', array('foo', array('bar', 'foo'))),
|
||||
|
Reference in New Issue
Block a user