mirror of
https://github.com/standardebooks/web.git
synced 2025-07-12 09:32:24 -04:00
Update composer packages
This commit is contained in:
parent
58cc098058
commit
415aed8b31
59 changed files with 3352 additions and 2347 deletions
13
vendor/symfony/console/Tests/ApplicationTest.php
vendored
13
vendor/symfony/console/Tests/ApplicationTest.php
vendored
|
@ -968,6 +968,19 @@ class ApplicationTest extends TestCase
|
|||
$this->assertSame('called'.PHP_EOL, $tester->getDisplay(), '->run() does not call interact() if -n is passed');
|
||||
}
|
||||
|
||||
public function testRunWithGlobalOptionAndNoCommand()
|
||||
{
|
||||
$application = new Application();
|
||||
$application->setAutoExit(false);
|
||||
$application->setCatchExceptions(false);
|
||||
$application->getDefinition()->addOption(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL));
|
||||
|
||||
$output = new StreamOutput(fopen('php://memory', 'w', false));
|
||||
$input = new ArgvInput(['cli.php', '--foo', 'bar']);
|
||||
|
||||
$this->assertSame(0, $application->run($input, $output));
|
||||
}
|
||||
|
||||
/**
|
||||
* Issue #9285.
|
||||
*
|
||||
|
|
|
@ -237,6 +237,43 @@ class QuestionHelperTest extends AbstractQuestionHelperTest
|
|||
$this->assertSame('b', $dialog->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question));
|
||||
}
|
||||
|
||||
public function getInputs()
|
||||
{
|
||||
return [
|
||||
['$'], // 1 byte character
|
||||
['¢'], // 2 bytes character
|
||||
['€'], // 3 bytes character
|
||||
['𐍈'], // 4 bytes character
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getInputs
|
||||
*/
|
||||
public function testAskWithAutocompleteWithMultiByteCharacter($character)
|
||||
{
|
||||
if (!$this->hasSttyAvailable()) {
|
||||
$this->markTestSkipped('`stty` is required to test autocomplete functionality');
|
||||
}
|
||||
|
||||
$inputStream = $this->getInputStream("$character\n");
|
||||
|
||||
$possibleChoices = [
|
||||
'$' => '1 byte character',
|
||||
'¢' => '2 bytes character',
|
||||
'€' => '3 bytes character',
|
||||
'𐍈' => '4 bytes character',
|
||||
];
|
||||
|
||||
$dialog = new QuestionHelper();
|
||||
$dialog->setHelperSet(new HelperSet([new FormatterHelper()]));
|
||||
|
||||
$question = new ChoiceQuestion('Please select a character', $possibleChoices);
|
||||
$question->setMaxAttempts(1);
|
||||
|
||||
$this->assertSame($character, $dialog->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question));
|
||||
}
|
||||
|
||||
public function testAutocompleteWithTrailingBackslash()
|
||||
{
|
||||
if (!$this->hasSttyAvailable()) {
|
||||
|
@ -549,7 +586,7 @@ class QuestionHelperTest extends AbstractQuestionHelperTest
|
|||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Console\Exception\RuntimeException
|
||||
* @expectedExceptionMessage Aborted
|
||||
* @expectedExceptionMessage Aborted.
|
||||
*/
|
||||
public function testAskThrowsExceptionOnMissingInput()
|
||||
{
|
||||
|
@ -559,7 +596,17 @@ class QuestionHelperTest extends AbstractQuestionHelperTest
|
|||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Console\Exception\RuntimeException
|
||||
* @expectedExceptionMessage Aborted
|
||||
* @expectedExceptionMessage Aborted.
|
||||
*/
|
||||
public function testAskThrowsExceptionOnMissingInputForChoiceQuestion()
|
||||
{
|
||||
$dialog = new QuestionHelper();
|
||||
$dialog->ask($this->createStreamableInputInterfaceMock($this->getInputStream('')), $this->createOutputInterface(), new ChoiceQuestion('Choice', ['a', 'b']));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Console\Exception\RuntimeException
|
||||
* @expectedExceptionMessage Aborted.
|
||||
*/
|
||||
public function testAskThrowsExceptionOnMissingInputWithValidator()
|
||||
{
|
||||
|
|
|
@ -124,7 +124,7 @@ class SymfonyQuestionHelperTest extends AbstractQuestionHelperTest
|
|||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Console\Exception\RuntimeException
|
||||
* @expectedExceptionMessage Aborted
|
||||
* @expectedExceptionMessage Aborted.
|
||||
*/
|
||||
public function testAskThrowsExceptionOnMissingInput()
|
||||
{
|
||||
|
|
|
@ -312,6 +312,14 @@ class ArgvInputTest extends TestCase
|
|||
|
||||
$input = new ArgvInput(['cli.php', '-fbbar', 'foo']);
|
||||
$this->assertEquals('foo', $input->getFirstArgument(), '->getFirstArgument() returns the first argument from the raw input');
|
||||
|
||||
$input = new ArgvInput(['cli.php', '--foo', 'fooval', 'bar']);
|
||||
$input->bind(new InputDefinition([new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputArgument('arg')]));
|
||||
$this->assertSame('bar', $input->getFirstArgument());
|
||||
|
||||
$input = new ArgvInput(['cli.php', '-bf', 'fooval', 'argval']);
|
||||
$input->bind(new InputDefinition([new InputOption('bar', 'b', InputOption::VALUE_NONE), new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputArgument('arg')]));
|
||||
$this->assertSame('argval', $input->getFirstArgument());
|
||||
}
|
||||
|
||||
public function testHasParameterOption()
|
||||
|
|
|
@ -17,6 +17,7 @@ use Symfony\Component\Console\Command\Command;
|
|||
use Symfony\Component\Console\Helper\HelperSet;
|
||||
use Symfony\Component\Console\Helper\QuestionHelper;
|
||||
use Symfony\Component\Console\Output\Output;
|
||||
use Symfony\Component\Console\Question\ChoiceQuestion;
|
||||
use Symfony\Component\Console\Question\Question;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
use Symfony\Component\Console\Tester\CommandTester;
|
||||
|
@ -139,7 +140,7 @@ class CommandTesterTest extends TestCase
|
|||
|
||||
/**
|
||||
* @expectedException \RuntimeException
|
||||
* @expectedMessage Aborted
|
||||
* @expectedExceptionMessage Aborted.
|
||||
*/
|
||||
public function testCommandWithWrongInputsNumber()
|
||||
{
|
||||
|
@ -153,13 +154,40 @@ class CommandTesterTest extends TestCase
|
|||
$command->setHelperSet(new HelperSet([new QuestionHelper()]));
|
||||
$command->setCode(function ($input, $output) use ($questions, $command) {
|
||||
$helper = $command->getHelper('question');
|
||||
$helper->ask($input, $output, new ChoiceQuestion('choice', ['a', 'b']));
|
||||
$helper->ask($input, $output, new Question($questions[0]));
|
||||
$helper->ask($input, $output, new Question($questions[1]));
|
||||
$helper->ask($input, $output, new Question($questions[2]));
|
||||
});
|
||||
|
||||
$tester = new CommandTester($command);
|
||||
$tester->setInputs(['a', 'Bobby', 'Fine']);
|
||||
$tester->execute([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \RuntimeException
|
||||
* @expectedExceptionMessage Aborted.
|
||||
*/
|
||||
public function testCommandWithQuestionsButNoInputs()
|
||||
{
|
||||
$questions = [
|
||||
'What\'s your name?',
|
||||
'How are you?',
|
||||
'Where do you come from?',
|
||||
];
|
||||
|
||||
$command = new Command('foo');
|
||||
$command->setHelperSet(new HelperSet([new QuestionHelper()]));
|
||||
$command->setCode(function ($input, $output) use ($questions, $command) {
|
||||
$helper = $command->getHelper('question');
|
||||
$helper->ask($input, $output, new ChoiceQuestion('choice', ['a', 'b']));
|
||||
$helper->ask($input, $output, new Question($questions[0]));
|
||||
$helper->ask($input, $output, new Question($questions[1]));
|
||||
$helper->ask($input, $output, new Question($questions[2]));
|
||||
});
|
||||
|
||||
$tester = new CommandTester($command);
|
||||
$tester->setInputs(['Bobby', 'Fine']);
|
||||
$tester->execute([]);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue