Update to Drupal 8.0.0-beta15. For more information, see: https://www.drupal.org/node/2563023
This commit is contained in:
parent
2720a9ec4b
commit
f3791f1da3
1898 changed files with 54300 additions and 11481 deletions
|
@ -215,8 +215,8 @@ class ArgvInput extends Input
|
|||
|
||||
$option = $this->definition->getOption($name);
|
||||
|
||||
// Convert false values (from a previous call to substr()) to null
|
||||
if (false === $value) {
|
||||
// Convert empty values to null
|
||||
if (!isset($value[0])) {
|
||||
$value = null;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,12 +46,9 @@ class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
|
|||
*/
|
||||
public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
|
||||
{
|
||||
$outputStream = $this->hasStdoutSupport() ? 'php://stdout' : 'php://output';
|
||||
$errorStream = $this->hasStderrSupport() ? 'php://stderr' : 'php://output';
|
||||
parent::__construct($this->openOutputStream(), $verbosity, $decorated, $formatter);
|
||||
|
||||
parent::__construct(fopen($outputStream, 'w'), $verbosity, $decorated, $formatter);
|
||||
|
||||
$this->stderr = new StreamOutput(fopen($errorStream, 'w'), $verbosity, $decorated, $this->getFormatter());
|
||||
$this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated, $this->getFormatter());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -129,4 +126,24 @@ class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
|
|||
{
|
||||
return 'OS400' === php_uname('s');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return resource
|
||||
*/
|
||||
private function openOutputStream()
|
||||
{
|
||||
$outputStream = $this->hasStdoutSupport() ? 'php://stdout' : 'php://output';
|
||||
|
||||
return @fopen($outputStream, 'w') ?: fopen('php://output', 'w');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return resource
|
||||
*/
|
||||
private function openErrorStream()
|
||||
{
|
||||
$errorStream = $this->hasStderrSupport() ? 'php://stderr' : 'php://output';
|
||||
|
||||
return fopen($errorStream, 'w');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -162,7 +162,7 @@ class ChoiceQuestion extends Question
|
|||
throw new \InvalidArgumentException(sprintf($errorMessage, $value));
|
||||
}
|
||||
|
||||
$multiselectChoices[] = $choices[(string) $result];
|
||||
$multiselectChoices[] = (string) $result;
|
||||
}
|
||||
|
||||
if ($multiselect) {
|
||||
|
|
|
@ -379,7 +379,7 @@ class SymfonyStyle extends OutputStyle
|
|||
{
|
||||
$chars = substr(str_replace(PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2);
|
||||
|
||||
if (false === $chars) {
|
||||
if (!isset($chars[0])) {
|
||||
return $this->newLine(); //empty history, so we should start with a new line.
|
||||
}
|
||||
//Prepend new line for each non LF chars (This means no blank line was output before)
|
||||
|
|
|
@ -36,15 +36,18 @@ class QuestionHelperTest extends \PHPUnit_Framework_TestCase
|
|||
$questionHelper->setInputStream($this->getInputStream("\n1\n 1 \nFabien\n1\nFabien\n1\n0,2\n 0 , 2 \n\n\n"));
|
||||
|
||||
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '2');
|
||||
$question->setMaxAttempts(1);
|
||||
// first answer is an empty answer, we're supposed to receive the default value
|
||||
$this->assertEquals('Spiderman', $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
|
||||
|
||||
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes);
|
||||
$question->setMaxAttempts(1);
|
||||
$this->assertEquals('Batman', $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
|
||||
$this->assertEquals('Batman', $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
|
||||
|
||||
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes);
|
||||
$question->setErrorMessage('Input "%s" is not a superhero!');
|
||||
$question->setMaxAttempts(2);
|
||||
$this->assertEquals('Batman', $questionHelper->ask($this->createInputInterfaceMock(), $output = $this->createOutputInterface(), $question));
|
||||
|
||||
rewind($output->getStream());
|
||||
|
@ -61,6 +64,7 @@ class QuestionHelperTest extends \PHPUnit_Framework_TestCase
|
|||
}
|
||||
|
||||
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, null);
|
||||
$question->setMaxAttempts(1);
|
||||
$question->setMultiselect(true);
|
||||
|
||||
$this->assertEquals(array('Batman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
|
||||
|
@ -68,11 +72,13 @@ class QuestionHelperTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertEquals(array('Superman', 'Spiderman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
|
||||
|
||||
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '0,1');
|
||||
$question->setMaxAttempts(1);
|
||||
$question->setMultiselect(true);
|
||||
|
||||
$this->assertEquals(array('Superman', 'Batman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
|
||||
|
||||
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, ' 0 , 1 ');
|
||||
$question->setMaxAttempts(1);
|
||||
$question->setMultiselect(true);
|
||||
|
||||
$this->assertEquals(array('Superman', 'Batman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
|
||||
|
@ -227,6 +233,7 @@ class QuestionHelperTest extends \PHPUnit_Framework_TestCase
|
|||
$dialog->setHelperSet($helperSet);
|
||||
|
||||
$question = new ChoiceQuestion('Please select the environment to load', $possibleChoices);
|
||||
$question->setMaxAttempts(1);
|
||||
$answer = $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question);
|
||||
|
||||
$this->assertSame($expectedValue, $answer);
|
||||
|
|
Reference in a new issue