mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-06 03:50:04 +02:00
Update composer
This commit is contained in:
parent
330cdbe615
commit
0c83c9a678
442 changed files with 9523 additions and 10793 deletions
49
vendor/symfony/console/Tester/TesterTrait.php
vendored
49
vendor/symfony/console/Tester/TesterTrait.php
vendored
|
@ -23,20 +23,25 @@ use Symfony\Component\Console\Tester\Constraint\CommandIsSuccessful;
|
|||
*/
|
||||
trait TesterTrait
|
||||
{
|
||||
private StreamOutput $output;
|
||||
private array $inputs = [];
|
||||
private bool $captureStreamsIndependently = false;
|
||||
private InputInterface $input;
|
||||
private int $statusCode;
|
||||
/** @var StreamOutput */
|
||||
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.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws \RuntimeException If it's called before the execute method
|
||||
*/
|
||||
public function getDisplay(bool $normalize = false): string
|
||||
public function getDisplay(bool $normalize = false)
|
||||
{
|
||||
if (!isset($this->output)) {
|
||||
if (null === $this->output) {
|
||||
throw new \RuntimeException('Output not initialized, did you execute the command before requesting the display?');
|
||||
}
|
||||
|
||||
|
@ -55,8 +60,10 @@ trait TesterTrait
|
|||
* Gets the output written to STDERR by the application.
|
||||
*
|
||||
* @param bool $normalize Whether to normalize end of lines to \n or not
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getErrorOutput(bool $normalize = false): string
|
||||
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.');
|
||||
|
@ -75,16 +82,20 @@ trait TesterTrait
|
|||
|
||||
/**
|
||||
* Gets the input instance used by the last execution of the command or application.
|
||||
*
|
||||
* @return InputInterface
|
||||
*/
|
||||
public function getInput(): InputInterface
|
||||
public function getInput()
|
||||
{
|
||||
return $this->input;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the output instance used by the last execution of the command or application.
|
||||
*
|
||||
* @return OutputInterface
|
||||
*/
|
||||
public function getOutput(): OutputInterface
|
||||
public function getOutput()
|
||||
{
|
||||
return $this->output;
|
||||
}
|
||||
|
@ -92,11 +103,17 @@ trait TesterTrait
|
|||
/**
|
||||
* Gets the status code returned by the last execution of the command or application.
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @throws \RuntimeException If it's called before the execute method
|
||||
*/
|
||||
public function getStatusCode(): int
|
||||
public function getStatusCode()
|
||||
{
|
||||
return $this->statusCode ?? throw new \RuntimeException('Status code not initialized, did you execute the command before requesting the status code?');
|
||||
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
|
||||
|
@ -112,7 +129,7 @@ trait TesterTrait
|
|||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setInputs(array $inputs): static
|
||||
public function setInputs(array $inputs)
|
||||
{
|
||||
$this->inputs = $inputs;
|
||||
|
||||
|
@ -128,9 +145,9 @@ trait TesterTrait
|
|||
* * verbosity: Sets the output verbosity flag
|
||||
* * capture_stderr_separately: Make output of stdOut and stdErr separately available
|
||||
*/
|
||||
private function initOutput(array $options): void
|
||||
private function initOutput(array $options)
|
||||
{
|
||||
$this->captureStreamsIndependently = $options['capture_stderr_separately'] ?? false;
|
||||
$this->captureStreamsIndependently = \array_key_exists('capture_stderr_separately', $options) && $options['capture_stderr_separately'];
|
||||
if (!$this->captureStreamsIndependently) {
|
||||
$this->output = new StreamOutput(fopen('php://memory', 'w', false));
|
||||
if (isset($options['decorated'])) {
|
||||
|
@ -152,10 +169,12 @@ trait TesterTrait
|
|||
|
||||
$reflectedOutput = new \ReflectionObject($this->output);
|
||||
$strErrProperty = $reflectedOutput->getProperty('stderr');
|
||||
$strErrProperty->setAccessible(true);
|
||||
$strErrProperty->setValue($this->output, $errorOutput);
|
||||
|
||||
$reflectedParent = $reflectedOutput->getParentClass();
|
||||
$streamProperty = $reflectedParent->getProperty('stream');
|
||||
$streamProperty->setAccessible(true);
|
||||
$streamProperty->setValue($this->output, fopen('php://memory', 'w', false));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue