upgraded dependencies

This commit is contained in:
RafficMohammed
2023-01-08 01:59:16 +05:30
parent 51056e3aad
commit f9ae387337
6895 changed files with 133617 additions and 178680 deletions

View File

@@ -29,8 +29,6 @@ class ApplicationTester
use TesterTrait;
private $application;
private $input;
private $statusCode;
public function __construct(Application $application)
{
@@ -47,12 +45,9 @@ class ApplicationTester
* * verbosity: Sets the output verbosity flag
* * capture_stderr_separately: Make output of stdOut and stdErr separately available
*
* @param array $input An array of arguments and options
* @param array $options An array of options
*
* @return int The command exit code
*/
public function run(array $input, $options = [])
public function run(array $input, array $options = [])
{
$prevShellVerbosity = getenv('SHELL_VERBOSITY');

View File

@@ -0,0 +1,56 @@
<?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\Console\Tester;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Completion\CompletionInput;
use Symfony\Component\Console\Completion\CompletionSuggestions;
/**
* Eases the testing of command completion.
*
* @author Jérôme Tamarelle <jerome@tamarelle.net>
*/
class CommandCompletionTester
{
private $command;
public function __construct(Command $command)
{
$this->command = $command;
}
/**
* Create completion suggestions from input tokens.
*/
public function complete(array $input): array
{
$currentIndex = \count($input);
if ('' === end($input)) {
array_pop($input);
}
array_unshift($input, $this->command->getName());
$completionInput = CompletionInput::fromTokens($input, $currentIndex);
$completionInput->bind($this->command->getDefinition());
$suggestions = new CompletionSuggestions();
$this->command->complete($completionInput, $suggestions);
$options = [];
foreach ($suggestions->getOptionSuggestions() as $option) {
$options[] = '--'.$option->getName();
}
return array_map('strval', array_merge($options, $suggestions->getValueSuggestions()));
}
}

View File

@@ -25,8 +25,6 @@ class CommandTester
use TesterTrait;
private $command;
private $input;
private $statusCode;
public function __construct(Command $command)
{

View File

@@ -0,0 +1,55 @@
<?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\Console\Tester\Constraint;
use PHPUnit\Framework\Constraint\Constraint;
use Symfony\Component\Console\Command\Command;
final class CommandIsSuccessful extends Constraint
{
/**
* {@inheritdoc}
*/
public function toString(): string
{
return 'is successful';
}
/**
* {@inheritdoc}
*/
protected function matches($other): bool
{
return Command::SUCCESS === $other;
}
/**
* {@inheritdoc}
*/
protected function failureDescription($other): string
{
return 'the command '.$this->toString();
}
/**
* {@inheritdoc}
*/
protected function additionalFailureDescription($other): string
{
$mapping = [
Command::FAILURE => 'Command failed.',
Command::INVALID => 'Command was invalid.',
];
return $mapping[$other] ?? sprintf('Command returned exit status %d.', $other);
}
}

View File

@@ -11,10 +11,12 @@
namespace Symfony\Component\Console\Tester;
use PHPUnit\Framework\Assert;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Output\StreamOutput;
use Symfony\Component\Console\Tester\Constraint\CommandIsSuccessful;
/**
* @author Amrouche Hamza <hamza.simperfit@gmail.com>
@@ -25,15 +27,19 @@ trait TesterTrait
private $output;
private $inputs = [];
private $captureStreamsIndependently = false;
/** @var InputInterface */
private $input;
/** @var int */
private $statusCode;
/**
* Gets the display returned by the last execution of the command or application.
*
* @param bool $normalize Whether to normalize end of lines to \n or not
* @throws \RuntimeException If it's called before the execute method
*
* @return string The display
* @return string
*/
public function getDisplay($normalize = false)
public function getDisplay(bool $normalize = false)
{
if (null === $this->output) {
throw new \RuntimeException('Output not initialized, did you execute the command before requesting the display?');
@@ -57,7 +63,7 @@ trait TesterTrait
*
* @return string
*/
public function getErrorOutput($normalize = false)
public function getErrorOutput(bool $normalize = false)
{
if (!$this->captureStreamsIndependently) {
throw new \LogicException('The error output is not available when the tester is run without "capture_stderr_separately" option set.');
@@ -77,7 +83,7 @@ trait TesterTrait
/**
* Gets the input instance used by the last execution of the command or application.
*
* @return InputInterface The current input instance
* @return InputInterface
*/
public function getInput()
{
@@ -87,7 +93,7 @@ trait TesterTrait
/**
* Gets the output instance used by the last execution of the command or application.
*
* @return OutputInterface The current output instance
* @return OutputInterface
*/
public function getOutput()
{
@@ -97,13 +103,24 @@ trait TesterTrait
/**
* Gets the status code returned by the last execution of the command or application.
*
* @return int The status code
* @throws \RuntimeException If it's called before the execute method
*
* @return int
*/
public function getStatusCode()
{
if (null === $this->statusCode) {
throw new \RuntimeException('Status code not initialized, did you execute the command before requesting the status code?');
}
return $this->statusCode;
}
public function assertCommandIsSuccessful(string $message = ''): void
{
Assert::assertThat($this->statusCode, new CommandIsSuccessful(), $message);
}
/**
* Sets the user inputs.
*