Update to Drupal 8.0.0 beta 14. For more information, see https://drupal.org/node/2544542
This commit is contained in:
parent
3b2511d96d
commit
81ccda77eb
2155 changed files with 54307 additions and 46870 deletions
12
core/vendor/symfony/console/Application.php
vendored
12
core/vendor/symfony/console/Application.php
vendored
|
@ -488,7 +488,7 @@ class Application
|
|||
if (empty($namespaces)) {
|
||||
$message = sprintf('There are no commands defined in the "%s" namespace.', $namespace);
|
||||
|
||||
if ($alternatives = $this->findAlternatives($namespace, $allNamespaces, array())) {
|
||||
if ($alternatives = $this->findAlternatives($namespace, $allNamespaces)) {
|
||||
if (1 == count($alternatives)) {
|
||||
$message .= "\n\nDid you mean this?\n ";
|
||||
} else {
|
||||
|
@ -537,7 +537,7 @@ class Application
|
|||
|
||||
$message = sprintf('Command "%s" is not defined.', $name);
|
||||
|
||||
if ($alternatives = $this->findAlternatives($name, $allCommands, array())) {
|
||||
if ($alternatives = $this->findAlternatives($name, $allCommands)) {
|
||||
if (1 == count($alternatives)) {
|
||||
$message .= "\n\nDid you mean this?\n ";
|
||||
} else {
|
||||
|
@ -628,7 +628,7 @@ class Application
|
|||
*/
|
||||
public function asText($namespace = null, $raw = false)
|
||||
{
|
||||
trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
|
||||
$descriptor = new TextDescriptor();
|
||||
$output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, !$raw);
|
||||
|
@ -649,7 +649,7 @@ class Application
|
|||
*/
|
||||
public function asXml($namespace = null, $asDom = false)
|
||||
{
|
||||
trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
|
||||
$descriptor = new XmlDescriptor();
|
||||
|
||||
|
@ -1086,7 +1086,7 @@ class Application
|
|||
}
|
||||
}
|
||||
|
||||
$alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2*$threshold; });
|
||||
$alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; });
|
||||
asort($alternatives);
|
||||
|
||||
return array_keys($alternatives);
|
||||
|
@ -1142,7 +1142,7 @@ class Application
|
|||
$lines[] = str_pad($line, $width);
|
||||
$line = $char;
|
||||
}
|
||||
if (strlen($line)) {
|
||||
if ('' !== $line) {
|
||||
$lines[] = count($lines) ? str_pad($line, $width) : $line;
|
||||
}
|
||||
|
||||
|
|
|
@ -645,7 +645,7 @@ class Command
|
|||
*/
|
||||
public function asText()
|
||||
{
|
||||
trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
|
||||
$descriptor = new TextDescriptor();
|
||||
$output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
|
||||
|
@ -665,7 +665,7 @@ class Command
|
|||
*/
|
||||
public function asXml($asDom = false)
|
||||
{
|
||||
trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
|
||||
$descriptor = new XmlDescriptor();
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ EOF
|
|||
}
|
||||
|
||||
if ($input->getOption('xml')) {
|
||||
trigger_error('The --xml option was deprecated in version 2.7 and will be removed in version 3.0. Use the --format option instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The --xml option was deprecated in version 2.7 and will be removed in version 3.0. Use the --format option instead.', E_USER_DEPRECATED);
|
||||
|
||||
$input->setOption('format', 'xml');
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ EOF
|
|||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
if ($input->getOption('xml')) {
|
||||
trigger_error('The --xml option was deprecated in version 2.7 and will be removed in version 3.0. Use the --format option instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The --xml option was deprecated in version 2.7 and will be removed in version 3.0. Use the --format option instead.', E_USER_DEPRECATED);
|
||||
|
||||
$input->setOption('format', 'xml');
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ class TextDescriptor extends Descriptor
|
|||
$totalWidth = isset($options['total_width']) ? $options['total_width'] : strlen($argument->getName());
|
||||
$spacingWidth = $totalWidth - strlen($argument->getName()) + 2;
|
||||
|
||||
$this->writeText(sprintf(" <info>%s</info>%s%s%s",
|
||||
$this->writeText(sprintf(' <info>%s</info>%s%s%s',
|
||||
$argument->getName(),
|
||||
str_repeat(' ', $spacingWidth),
|
||||
// + 17 = 2 spaces + <info> + </info> + 2 spaces
|
||||
|
@ -77,7 +77,7 @@ class TextDescriptor extends Descriptor
|
|||
|
||||
$spacingWidth = $totalWidth - strlen($synopsis) + 2;
|
||||
|
||||
$this->writeText(sprintf(" <info>%s</info>%s%s%s%s",
|
||||
$this->writeText(sprintf(' <info>%s</info>%s%s%s%s',
|
||||
$synopsis,
|
||||
str_repeat(' ', $spacingWidth),
|
||||
// + 17 = 2 spaces + <info> + </info> + 2 spaces
|
||||
|
@ -207,7 +207,7 @@ class TextDescriptor extends Descriptor
|
|||
foreach ($namespace['commands'] as $name) {
|
||||
$this->writeText("\n");
|
||||
$spacingWidth = $width - strlen($name);
|
||||
$this->writeText(sprintf(" <info>%s</info>%s%s", $name, str_repeat(' ', $spacingWidth), $description->getCommand($name)->getDescription()), $options);
|
||||
$this->writeText(sprintf(' <info>%s</info>%s%s', $name, str_repeat(' ', $spacingWidth), $description->getCommand($name)->getDescription()), $options);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -266,7 +266,8 @@ class TextDescriptor extends Descriptor
|
|||
{
|
||||
$totalWidth = 0;
|
||||
foreach ($options as $option) {
|
||||
$nameLength = 4 + strlen($option->getName()) + 2; // - + shortcut + , + whitespace + name + --
|
||||
// "-" + shortcut + ", --" + name
|
||||
$nameLength = 1 + max(strlen($option->getShortcut()), 1) + 4 + strlen($option->getName());
|
||||
|
||||
if ($option->acceptValue()) {
|
||||
$valueLength = 1 + strlen($option->getName()); // = + value
|
||||
|
|
|
@ -33,7 +33,7 @@ class OutputFormatter implements OutputFormatterInterface
|
|||
*/
|
||||
public static function escape($text)
|
||||
{
|
||||
return preg_replace('/([^\\\\]?)</is', '$1\\<', $text);
|
||||
return preg_replace('/([^\\\\]?)</', '$1\\<', $text);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -146,7 +146,7 @@ class OutputFormatter implements OutputFormatterInterface
|
|||
$offset = 0;
|
||||
$output = '';
|
||||
$tagRegex = '[a-z][a-z0-9_=;-]*';
|
||||
preg_match_all("#<(($tagRegex) | /($tagRegex)?)>#isx", $message, $matches, PREG_OFFSET_CAPTURE);
|
||||
preg_match_all("#<(($tagRegex) | /($tagRegex)?)>#ix", $message, $matches, PREG_OFFSET_CAPTURE);
|
||||
foreach ($matches[0] as $i => $match) {
|
||||
$pos = $match[1];
|
||||
$text = $match[0];
|
||||
|
|
|
@ -29,6 +29,7 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface
|
|||
'magenta' => array('set' => 35, 'unset' => 39),
|
||||
'cyan' => array('set' => 36, 'unset' => 39),
|
||||
'white' => array('set' => 37, 'unset' => 39),
|
||||
'default' => array('set' => 39, 'unset' => 39),
|
||||
);
|
||||
private static $availableBackgroundColors = array(
|
||||
'black' => array('set' => 40, 'unset' => 49),
|
||||
|
@ -39,6 +40,7 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface
|
|||
'magenta' => array('set' => 45, 'unset' => 49),
|
||||
'cyan' => array('set' => 46, 'unset' => 49),
|
||||
'white' => array('set' => 47, 'unset' => 49),
|
||||
'default' => array('set' => 49, 'unset' => 49),
|
||||
);
|
||||
private static $availableOptions = array(
|
||||
'bold' => array('set' => 1, 'unset' => 22),
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace Symfony\Component\Console\Helper;
|
|||
*/
|
||||
class DebugFormatterHelper extends Helper
|
||||
{
|
||||
private $colors = array('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white');
|
||||
private $colors = array('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'default');
|
||||
private $started = array();
|
||||
private $count = -1;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ class DialogHelper extends InputAwareHelper
|
|||
public function __construct($triggerDeprecationError = true)
|
||||
{
|
||||
if ($triggerDeprecationError) {
|
||||
trigger_error('"Symfony\Component\Console\Helper\DialogHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\QuestionHelper" instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('"Symfony\Component\Console\Helper\DialogHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\QuestionHelper" instead.', E_USER_DEPRECATED);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -466,18 +466,18 @@ class DialogHelper extends InputAwareHelper
|
|||
*/
|
||||
private function validateAttempts($interviewer, OutputInterface $output, $validator, $attempts)
|
||||
{
|
||||
$error = null;
|
||||
$e = null;
|
||||
while (false === $attempts || $attempts--) {
|
||||
if (null !== $error) {
|
||||
$output->writeln($this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error'));
|
||||
if (null !== $e) {
|
||||
$output->writeln($this->getHelperSet()->get('formatter')->formatBlock($e->getMessage(), 'error'));
|
||||
}
|
||||
|
||||
try {
|
||||
return call_user_func($validator, $interviewer());
|
||||
} catch (\Exception $error) {
|
||||
} catch (\Exception $e) {
|
||||
}
|
||||
}
|
||||
|
||||
throw $error;
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,11 +79,11 @@ class HelperSet implements \IteratorAggregate
|
|||
}
|
||||
|
||||
if ('dialog' === $name && $this->helpers[$name] instanceof DialogHelper) {
|
||||
trigger_error('"Symfony\Component\Console\Helper\DialogHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\QuestionHelper" instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('"Symfony\Component\Console\Helper\DialogHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\QuestionHelper" instead.', E_USER_DEPRECATED);
|
||||
} elseif ('progress' === $name && $this->helpers[$name] instanceof ProgressHelper) {
|
||||
trigger_error('"Symfony\Component\Console\Helper\ProgressHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\ProgressBar" instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('"Symfony\Component\Console\Helper\ProgressHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\ProgressBar" instead.', E_USER_DEPRECATED);
|
||||
} elseif ('table' === $name && $this->helpers[$name] instanceof TableHelper) {
|
||||
trigger_error('"Symfony\Component\Console\Helper\TableHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\Table" instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('"Symfony\Component\Console\Helper\TableHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\Table" instead.', E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
return $this->helpers[$name];
|
||||
|
|
|
@ -177,7 +177,7 @@ class ProgressBar
|
|||
*/
|
||||
public function getStep()
|
||||
{
|
||||
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the getProgress() method instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the getProgress() method instead.', E_USER_DEPRECATED);
|
||||
|
||||
return $this->getProgress();
|
||||
}
|
||||
|
@ -368,13 +368,13 @@ class ProgressBar
|
|||
*/
|
||||
public function setCurrent($step)
|
||||
{
|
||||
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the setProgress() method instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the setProgress() method instead.', E_USER_DEPRECATED);
|
||||
|
||||
$this->setProgress($step);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether to overwrite the progressbar, false for new line
|
||||
* Sets whether to overwrite the progressbar, false for new line.
|
||||
*
|
||||
* @param bool $overwrite
|
||||
*/
|
||||
|
@ -401,8 +401,8 @@ class ProgressBar
|
|||
$this->max = $step;
|
||||
}
|
||||
|
||||
$prevPeriod = intval($this->step / $this->redrawFreq);
|
||||
$currPeriod = intval($step / $this->redrawFreq);
|
||||
$prevPeriod = (int) ($this->step / $this->redrawFreq);
|
||||
$currPeriod = (int) ($step / $this->redrawFreq);
|
||||
$this->step = $step;
|
||||
$this->percent = $this->max ? (float) $this->step / $this->max : 0;
|
||||
if ($prevPeriod !== $currPeriod || $this->max === $step) {
|
||||
|
|
|
@ -121,7 +121,7 @@ class ProgressHelper extends Helper
|
|||
public function __construct($triggerDeprecationError = true)
|
||||
{
|
||||
if ($triggerDeprecationError) {
|
||||
trigger_error('The '.__CLASS__.' class is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\ProgressBar class instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__CLASS__.' class is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\ProgressBar class instead.', E_USER_DEPRECATED);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
17
core/vendor/symfony/console/Helper/Table.php
vendored
17
core/vendor/symfony/console/Helper/Table.php
vendored
|
@ -171,7 +171,7 @@ class Table
|
|||
if ($row instanceof TableSeparator) {
|
||||
$this->rows[] = $row;
|
||||
|
||||
return;
|
||||
return $this;
|
||||
}
|
||||
|
||||
if (!is_array($row)) {
|
||||
|
@ -385,7 +385,7 @@ class Table
|
|||
$unmergedRows = array();
|
||||
foreach ($rows[$line] as $column => $cell) {
|
||||
if ($cell instanceof TableCell && $cell->getRowspan() > 1) {
|
||||
$nbLines = $cell->getRowspan()-1;
|
||||
$nbLines = $cell->getRowspan() - 1;
|
||||
$lines = array($cell);
|
||||
if (strstr($cell, "\n")) {
|
||||
$lines = explode("\n", $cell);
|
||||
|
@ -412,7 +412,7 @@ class Table
|
|||
array_splice($rows[$unmergedRowKey], $cellKey, 0, array($cell));
|
||||
}
|
||||
} else {
|
||||
$row = $this->copyRow($rows, $unmergedRowKey-1);
|
||||
$row = $this->copyRow($rows, $unmergedRowKey - 1);
|
||||
foreach ($unmergedRow as $column => $cell) {
|
||||
if (!empty($cell)) {
|
||||
$row[$column] = $unmergedRow[$column];
|
||||
|
@ -476,7 +476,7 @@ class Table
|
|||
{
|
||||
$columns = count($row);
|
||||
foreach ($row as $column) {
|
||||
$columns += $column instanceof TableCell ? ($column->getColspan()-1) : 0;
|
||||
$columns += $column instanceof TableCell ? ($column->getColspan() - 1) : 0;
|
||||
}
|
||||
|
||||
return $columns;
|
||||
|
@ -491,11 +491,11 @@ class Table
|
|||
*/
|
||||
private function getRowColumns($row)
|
||||
{
|
||||
$columns = range(0, $this->numberOfColumns-1);
|
||||
$columns = range(0, $this->numberOfColumns - 1);
|
||||
foreach ($row as $cellKey => $cell) {
|
||||
if ($cell instanceof TableCell && $cell->getColspan() > 1) {
|
||||
// exclude grouped columns.
|
||||
$columns = array_diff($columns, range($cellKey+1, $cellKey + $cell->getColspan()-1));
|
||||
$columns = array_diff($columns, range($cellKey + 1, $cellKey + $cell->getColspan() - 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -550,12 +550,13 @@ class Table
|
|||
{
|
||||
if (isset($row[$column])) {
|
||||
$cell = $row[$column];
|
||||
$cellWidth = Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
|
||||
if ($cell instanceof TableCell && $cell->getColspan() > 1) {
|
||||
// we assume that cell value will be across more than one column.
|
||||
$cell = substr($cell, 0, strlen($cell)/$cell->getColspan());
|
||||
$cellWidth = $cellWidth / $cell->getColspan();
|
||||
}
|
||||
|
||||
return Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
|
||||
return $cellWidth;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -37,7 +37,7 @@ class TableHelper extends Helper
|
|||
public function __construct($triggerDeprecationError = true)
|
||||
{
|
||||
if ($triggerDeprecationError) {
|
||||
trigger_error('The '.__CLASS__.' class is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\Table class instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__CLASS__.' class is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\Table class instead.', E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
$this->table = new Table(new NullOutput());
|
||||
|
|
|
@ -221,7 +221,7 @@ class ArgvInput extends Input
|
|||
}
|
||||
|
||||
if (null !== $value && !$option->acceptValue()) {
|
||||
throw new \RuntimeException(sprintf('The "--%s" option does not accept a value.', $name, $value));
|
||||
throw new \RuntimeException(sprintf('The "--%s" option does not accept a value.', $name));
|
||||
}
|
||||
|
||||
if (null === $value && $option->acceptValue() && count($this->parsed)) {
|
||||
|
|
|
@ -449,7 +449,7 @@ class InputDefinition
|
|||
*/
|
||||
public function asText()
|
||||
{
|
||||
trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
|
||||
$descriptor = new TextDescriptor();
|
||||
$output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
|
||||
|
@ -469,7 +469,7 @@ class InputDefinition
|
|||
*/
|
||||
public function asXml($asDom = false)
|
||||
{
|
||||
trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
|
||||
$descriptor = new XmlDescriptor();
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ class StringInput extends ArgvInput
|
|||
public function __construct($input, InputDefinition $definition = null)
|
||||
{
|
||||
if ($definition) {
|
||||
trigger_error('The $definition argument of the '.__METHOD__.' method is deprecated and will be removed in 3.0. Set this parameter with the bind() method instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The $definition argument of the '.__METHOD__.' method is deprecated and will be removed in 3.0. Set this parameter with the bind() method instead.', E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
parent::__construct(array(), null);
|
||||
|
|
|
@ -30,6 +30,9 @@ use Symfony\Component\Console\Formatter\OutputFormatterInterface;
|
|||
*/
|
||||
class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
|
||||
{
|
||||
/**
|
||||
* @var StreamOutput
|
||||
*/
|
||||
private $stderr;
|
||||
|
||||
/**
|
||||
|
@ -43,14 +46,12 @@ class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
|
|||
*/
|
||||
public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
|
||||
{
|
||||
$outputStream = 'php://stdout';
|
||||
if (!$this->hasStdoutSupport()) {
|
||||
$outputStream = 'php://output';
|
||||
}
|
||||
$outputStream = $this->hasStdoutSupport() ? 'php://stdout' : 'php://output';
|
||||
$errorStream = $this->hasStderrSupport() ? 'php://stderr' : 'php://output';
|
||||
|
||||
parent::__construct(fopen($outputStream, 'w'), $verbosity, $decorated, $formatter);
|
||||
|
||||
$this->stderr = new StreamOutput(fopen('php://stderr', 'w'), $verbosity, $decorated, $this->getFormatter());
|
||||
$this->stderr = new StreamOutput(fopen($errorStream, 'w'), $verbosity, $decorated, $this->getFormatter());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -100,14 +101,32 @@ class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
|
|||
* Returns true if current environment supports writing console output to
|
||||
* STDOUT.
|
||||
*
|
||||
* IBM iSeries (OS400) exhibits character-encoding issues when writing to
|
||||
* STDOUT and doesn't properly convert ASCII to EBCDIC, resulting in garbage
|
||||
* output.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function hasStdoutSupport()
|
||||
{
|
||||
return ('OS400' != php_uname('s'));
|
||||
return false === $this->isRunningOS400();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if current environment supports writing console output to
|
||||
* STDERR.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function hasStderrSupport()
|
||||
{
|
||||
return false === $this->isRunningOS400();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if current executing environment is IBM iSeries (OS400), which
|
||||
* doesn't properly convert character-encodings between ASCII to EBCDIC.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function isRunningOS400()
|
||||
{
|
||||
return 'OS400' === php_uname('s');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -161,7 +161,8 @@ class ChoiceQuestion extends Question
|
|||
if (false === $result) {
|
||||
throw new \InvalidArgumentException(sprintf($errorMessage, $value));
|
||||
}
|
||||
array_push($multiselectChoices, (string) $result);
|
||||
|
||||
$multiselectChoices[] = $choices[(string) $result];
|
||||
}
|
||||
|
||||
if ($multiselect) {
|
||||
|
|
2
core/vendor/symfony/console/Shell.php
vendored
2
core/vendor/symfony/console/Shell.php
vendored
|
@ -206,7 +206,7 @@ EOF;
|
|||
} else {
|
||||
$this->output->write($this->getPrompt());
|
||||
$line = fgets(STDIN, 1024);
|
||||
$line = (!$line && strlen($line) == 0) ? false : rtrim($line);
|
||||
$line = (false === $line || '' === $line) ? false : rtrim($line);
|
||||
}
|
||||
|
||||
return $line;
|
||||
|
|
111
core/vendor/symfony/console/Style/SymfonyStyle.php
vendored
111
core/vendor/symfony/console/Style/SymfonyStyle.php
vendored
|
@ -18,6 +18,7 @@ use Symfony\Component\Console\Helper\ProgressBar;
|
|||
use Symfony\Component\Console\Helper\SymfonyQuestionHelper;
|
||||
use Symfony\Component\Console\Helper\Table;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\BufferedOutput;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Question\ChoiceQuestion;
|
||||
use Symfony\Component\Console\Question\ConfirmationQuestion;
|
||||
|
@ -36,6 +37,7 @@ class SymfonyStyle extends OutputStyle
|
|||
private $questionHelper;
|
||||
private $progressBar;
|
||||
private $lineLength;
|
||||
private $bufferedOutput;
|
||||
|
||||
/**
|
||||
* @param InputInterface $input
|
||||
|
@ -44,7 +46,9 @@ class SymfonyStyle extends OutputStyle
|
|||
public function __construct(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$this->input = $input;
|
||||
$this->lineLength = min($this->getTerminalWidth(), self::MAX_LINE_LENGTH);
|
||||
$this->bufferedOutput = new BufferedOutput($output->getVerbosity(), false, clone $output->getFormatter());
|
||||
// Windows cmd wraps lines as soon as the terminal width is reached, whether there are following chars or not.
|
||||
$this->lineLength = min($this->getTerminalWidth() - (int) (DIRECTORY_SEPARATOR === '\\'), self::MAX_LINE_LENGTH);
|
||||
|
||||
parent::__construct($output);
|
||||
}
|
||||
|
@ -60,6 +64,7 @@ class SymfonyStyle extends OutputStyle
|
|||
*/
|
||||
public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false)
|
||||
{
|
||||
$this->autoPrependBlock();
|
||||
$messages = is_array($messages) ? array_values($messages) : array($messages);
|
||||
$lines = array();
|
||||
|
||||
|
@ -71,7 +76,7 @@ class SymfonyStyle extends OutputStyle
|
|||
// wrap and add newlines for each element
|
||||
foreach ($messages as $key => $message) {
|
||||
$message = OutputFormatter::escape($message);
|
||||
$lines = array_merge($lines, explode("\n", wordwrap($message, $this->lineLength - Helper::strlen($prefix))));
|
||||
$lines = array_merge($lines, explode(PHP_EOL, wordwrap($message, $this->lineLength - Helper::strlen($prefix), PHP_EOL, true)));
|
||||
|
||||
if (count($messages) > 1 && $key < count($messages) - 1) {
|
||||
$lines[] = '';
|
||||
|
@ -92,7 +97,8 @@ class SymfonyStyle extends OutputStyle
|
|||
}
|
||||
}
|
||||
|
||||
$this->writeln(implode("\n", $lines)."\n");
|
||||
$this->writeln($lines);
|
||||
$this->newLine();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -100,7 +106,12 @@ class SymfonyStyle extends OutputStyle
|
|||
*/
|
||||
public function title($message)
|
||||
{
|
||||
$this->writeln(sprintf("\n<comment>%s</>\n<comment>%s</>\n", $message, str_repeat('=', strlen($message))));
|
||||
$this->autoPrependBlock();
|
||||
$this->writeln(array(
|
||||
sprintf('<comment>%s</>', $message),
|
||||
sprintf('<comment>%s</>', str_repeat('=', strlen($message))),
|
||||
));
|
||||
$this->newLine();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -108,7 +119,12 @@ class SymfonyStyle extends OutputStyle
|
|||
*/
|
||||
public function section($message)
|
||||
{
|
||||
$this->writeln(sprintf("<comment>%s</>\n<comment>%s</>\n", $message, str_repeat('-', strlen($message))));
|
||||
$this->autoPrependBlock();
|
||||
$this->writeln(array(
|
||||
sprintf('<comment>%s</>', $message),
|
||||
sprintf('<comment>%s</>', str_repeat('-', strlen($message))),
|
||||
));
|
||||
$this->newLine();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -116,13 +132,13 @@ class SymfonyStyle extends OutputStyle
|
|||
*/
|
||||
public function listing(array $elements)
|
||||
{
|
||||
$this->autoPrependText();
|
||||
$elements = array_map(function ($element) {
|
||||
return sprintf(' * %s', $element);
|
||||
},
|
||||
$elements
|
||||
);
|
||||
return sprintf(' * %s', $element);
|
||||
}, $elements);
|
||||
|
||||
$this->writeln(implode("\n", $elements)."\n");
|
||||
$this->writeln($elements);
|
||||
$this->newLine();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -130,6 +146,8 @@ class SymfonyStyle extends OutputStyle
|
|||
*/
|
||||
public function text($message)
|
||||
{
|
||||
$this->autoPrependText();
|
||||
|
||||
if (!is_array($message)) {
|
||||
$this->writeln(sprintf(' // %s', $message));
|
||||
|
||||
|
@ -205,7 +223,7 @@ class SymfonyStyle extends OutputStyle
|
|||
$question = new Question($question, $default);
|
||||
$question->setValidator($validator);
|
||||
|
||||
return $this->askQuestion($question, $validator);
|
||||
return $this->askQuestion($question);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -214,9 +232,11 @@ class SymfonyStyle extends OutputStyle
|
|||
public function askHidden($question, $validator = null)
|
||||
{
|
||||
$question = new Question($question);
|
||||
$question->setHidden(true);
|
||||
|
||||
return $this->askQuestion($question, $validator);
|
||||
$question->setHidden(true);
|
||||
$question->setValidator($validator);
|
||||
|
||||
return $this->askQuestion($question);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -290,17 +310,51 @@ class SymfonyStyle extends OutputStyle
|
|||
*/
|
||||
public function askQuestion(Question $question)
|
||||
{
|
||||
if ($this->input->isInteractive()) {
|
||||
$this->autoPrependBlock();
|
||||
}
|
||||
|
||||
if (!$this->questionHelper) {
|
||||
$this->questionHelper = new SymfonyQuestionHelper();
|
||||
}
|
||||
|
||||
$answer = $this->questionHelper->ask($this->input, $this, $question);
|
||||
|
||||
$this->newLine();
|
||||
if ($this->input->isInteractive()) {
|
||||
$this->newLine();
|
||||
$this->bufferedOutput->write("\n");
|
||||
}
|
||||
|
||||
return $answer;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function writeln($messages, $type = self::OUTPUT_NORMAL)
|
||||
{
|
||||
parent::writeln($messages, $type);
|
||||
$this->bufferedOutput->writeln($this->reduceBuffer($messages), $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
|
||||
{
|
||||
parent::write($messages, $newline, $type);
|
||||
$this->bufferedOutput->write($this->reduceBuffer($messages), $newline, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function newLine($count = 1)
|
||||
{
|
||||
parent::newLine($count);
|
||||
$this->bufferedOutput->write(str_repeat("\n", $count));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ProgressBar
|
||||
*/
|
||||
|
@ -320,4 +374,33 @@ class SymfonyStyle extends OutputStyle
|
|||
|
||||
return $dimensions[0] ?: self::MAX_LINE_LENGTH;
|
||||
}
|
||||
|
||||
private function autoPrependBlock()
|
||||
{
|
||||
$chars = substr(str_replace(PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2);
|
||||
|
||||
if (false === $chars) {
|
||||
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)
|
||||
$this->newLine(2 - substr_count($chars, "\n"));
|
||||
}
|
||||
|
||||
private function autoPrependText()
|
||||
{
|
||||
$fetched = $this->bufferedOutput->fetch();
|
||||
//Prepend new line if last char isn't EOL:
|
||||
if ("\n" !== substr($fetched, -1)) {
|
||||
$this->newLine();
|
||||
}
|
||||
}
|
||||
|
||||
private function reduceBuffer($messages)
|
||||
{
|
||||
// We need to know if the two last chars are PHP_EOL
|
||||
// Preserve the last 4 chars inserted (PHP_EOL on windows is two chars) in the history buffer
|
||||
return array_map(function ($value) {
|
||||
return substr($value, -4);
|
||||
}, array_merge(array($this->bufferedOutput->fetch()), (array) $messages));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -495,8 +495,6 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testLegacyAsText()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$application = new Application();
|
||||
$application->add(new \FooCommand());
|
||||
$this->ensureStaticCommandHelp($application);
|
||||
|
@ -509,8 +507,6 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testLegacyAsXml()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$application = new Application();
|
||||
$application->add(new \FooCommand());
|
||||
$this->ensureStaticCommandHelp($application);
|
||||
|
@ -679,7 +675,7 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* Issue #9285
|
||||
* Issue #9285.
|
||||
*
|
||||
* If the "verbose" option is just before an argument in ArgvInput,
|
||||
* an argument value should not be treated as verbosity value.
|
||||
|
|
|
@ -314,8 +314,6 @@ class CommandTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testLegacyAsText()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$command = new \TestCommand();
|
||||
$command->setApplication(new Application());
|
||||
$tester = new CommandTester($command);
|
||||
|
@ -328,8 +326,6 @@ class CommandTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testLegacyAsXml()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$command = new \TestCommand();
|
||||
$command->setApplication(new Application());
|
||||
$tester = new CommandTester($command);
|
||||
|
|
|
@ -42,6 +42,7 @@ class ObjectsProvider
|
|||
'input_option_3' => new InputOption('option_name', 'o', InputOption::VALUE_REQUIRED, 'option description'),
|
||||
'input_option_4' => new InputOption('option_name', 'o', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, 'option description', array()),
|
||||
'input_option_5' => new InputOption('option_name', 'o', InputOption::VALUE_REQUIRED, "multiline\noption description"),
|
||||
'input_option_6' => new InputOption('option_name', array('o', 'O'), InputOption::VALUE_REQUIRED, 'option with multiple shortcuts'),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
11
core/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_0.php
vendored
Normal file
11
core/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_0.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
||||
//Ensure has single blank line at start when using block element
|
||||
return function (InputInterface $input, OutputInterface $output) {
|
||||
$output = new SymfonyStyle($input, $output);
|
||||
$output->caution('Lorem ipsum dolor sit amet');
|
||||
};
|
13
core/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_1.php
vendored
Normal file
13
core/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_1.php
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
||||
//Ensure has single blank line between titles and blocks
|
||||
return function (InputInterface $input, OutputInterface $output) {
|
||||
$output = new SymfonyStyle($input, $output);
|
||||
$output->title('Title');
|
||||
$output->warning('Lorem ipsum dolor sit amet');
|
||||
$output->title('Title');
|
||||
};
|
16
core/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_2.php
vendored
Normal file
16
core/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_2.php
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
||||
//Ensure has single blank line between blocks
|
||||
return function (InputInterface $input, OutputInterface $output) {
|
||||
$output = new SymfonyStyle($input, $output);
|
||||
$output->warning('Warning');
|
||||
$output->caution('Caution');
|
||||
$output->error('Error');
|
||||
$output->success('Success');
|
||||
$output->note('Note');
|
||||
$output->block('Custom block', 'CUSTOM', 'fg=white;bg=green', 'X ', true);
|
||||
};
|
12
core/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_3.php
vendored
Normal file
12
core/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_3.php
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
||||
//Ensure has single blank line between two titles
|
||||
return function (InputInterface $input, OutputInterface $output) {
|
||||
$output = new SymfonyStyle($input, $output);
|
||||
$output->title('First title');
|
||||
$output->title('Second title');
|
||||
};
|
34
core/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_4.php
vendored
Normal file
34
core/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_4.php
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
||||
//Ensure has single blank line after any text and a title
|
||||
return function (InputInterface $input, OutputInterface $output) {
|
||||
$output = new SymfonyStyle($input, $output);
|
||||
|
||||
$output->write('Lorem ipsum dolor sit amet');
|
||||
$output->title('First title');
|
||||
|
||||
$output->writeln('Lorem ipsum dolor sit amet');
|
||||
$output->title('Second title');
|
||||
|
||||
$output->write('Lorem ipsum dolor sit amet');
|
||||
$output->write('');
|
||||
$output->title('Third title');
|
||||
|
||||
//Ensure edge case by appending empty strings to history:
|
||||
$output->write('Lorem ipsum dolor sit amet');
|
||||
$output->write(array('', '', ''));
|
||||
$output->title('Fourth title');
|
||||
|
||||
//Ensure have manual control over number of blank lines:
|
||||
$output->writeln('Lorem ipsum dolor sit amet');
|
||||
$output->writeln(array('', '')); //Should append an extra blank line
|
||||
$output->title('Fifth title');
|
||||
|
||||
$output->writeln('Lorem ipsum dolor sit amet');
|
||||
$output->newLine(2); //Should append an extra blank line
|
||||
$output->title('Fifth title');
|
||||
};
|
29
core/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_5.php
vendored
Normal file
29
core/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_5.php
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
||||
//Ensure has proper line ending before outputing a text block like with SymfonyStyle::listing() or SymfonyStyle::text()
|
||||
return function (InputInterface $input, OutputInterface $output) {
|
||||
$output = new SymfonyStyle($input, $output);
|
||||
|
||||
$output->writeln('Lorem ipsum dolor sit amet');
|
||||
$output->listing(array(
|
||||
'Lorem ipsum dolor sit amet',
|
||||
'consectetur adipiscing elit',
|
||||
));
|
||||
|
||||
//Even using write:
|
||||
$output->write('Lorem ipsum dolor sit amet');
|
||||
$output->listing(array(
|
||||
'Lorem ipsum dolor sit amet',
|
||||
'consectetur adipiscing elit',
|
||||
));
|
||||
|
||||
$output->write('Lorem ipsum dolor sit amet');
|
||||
$output->text(array(
|
||||
'Lorem ipsum dolor sit amet',
|
||||
'consectetur adipiscing elit',
|
||||
));
|
||||
};
|
16
core/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_6.php
vendored
Normal file
16
core/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_6.php
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
||||
//Ensure has proper blank line after text block when using a block like with SymfonyStyle::success
|
||||
return function (InputInterface $input, OutputInterface $output) {
|
||||
$output = new SymfonyStyle($input, $output);
|
||||
|
||||
$output->listing(array(
|
||||
'Lorem ipsum dolor sit amet',
|
||||
'consectetur adipiscing elit',
|
||||
));
|
||||
$output->success('Lorem ipsum dolor sit amet');
|
||||
};
|
15
core/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_7.php
vendored
Normal file
15
core/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_7.php
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
||||
//Ensure questions do not output anything when input is non-interactive
|
||||
return function (InputInterface $input, OutputInterface $output) {
|
||||
$output = new SymfonyStyle($input, $output);
|
||||
$output->title('Title');
|
||||
$output->askHidden('Hidden question');
|
||||
$output->choice('Choice question with default', array('choice1', 'choice2'), 'choice1');
|
||||
$output->confirm('Confirmation with yes default', true);
|
||||
$output->text('Duis aute irure dolor in reprehenderit in voluptate velit esse');
|
||||
};
|
3
core/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_0.txt
vendored
Normal file
3
core/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_0.txt
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
|
||||
! [CAUTION] Lorem ipsum dolor sit amet
|
||||
|
9
core/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_1.txt
vendored
Normal file
9
core/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_1.txt
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
|
||||
Title
|
||||
=====
|
||||
|
||||
[WARNING] Lorem ipsum dolor sit amet
|
||||
|
||||
Title
|
||||
=====
|
||||
|
13
core/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_2.txt
vendored
Normal file
13
core/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_2.txt
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
|
||||
[WARNING] Warning
|
||||
|
||||
! [CAUTION] Caution
|
||||
|
||||
[ERROR] Error
|
||||
|
||||
[OK] Success
|
||||
|
||||
! [NOTE] Note
|
||||
|
||||
X [CUSTOM] Custom block
|
||||
|
7
core/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_3.txt
vendored
Normal file
7
core/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_3.txt
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
|
||||
First title
|
||||
===========
|
||||
|
||||
Second title
|
||||
============
|
||||
|
32
core/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_4.txt
vendored
Normal file
32
core/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_4.txt
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
Lorem ipsum dolor sit amet
|
||||
|
||||
First title
|
||||
===========
|
||||
|
||||
Lorem ipsum dolor sit amet
|
||||
|
||||
Second title
|
||||
============
|
||||
|
||||
Lorem ipsum dolor sit amet
|
||||
|
||||
Third title
|
||||
===========
|
||||
|
||||
Lorem ipsum dolor sit amet
|
||||
|
||||
Fourth title
|
||||
============
|
||||
|
||||
Lorem ipsum dolor sit amet
|
||||
|
||||
|
||||
Fifth title
|
||||
===========
|
||||
|
||||
Lorem ipsum dolor sit amet
|
||||
|
||||
|
||||
Fifth title
|
||||
===========
|
||||
|
11
core/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_5.txt
vendored
Normal file
11
core/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_5.txt
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
Lorem ipsum dolor sit amet
|
||||
* Lorem ipsum dolor sit amet
|
||||
* consectetur adipiscing elit
|
||||
|
||||
Lorem ipsum dolor sit amet
|
||||
* Lorem ipsum dolor sit amet
|
||||
* consectetur adipiscing elit
|
||||
|
||||
Lorem ipsum dolor sit amet
|
||||
// Lorem ipsum dolor sit amet
|
||||
// consectetur adipiscing elit
|
6
core/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_6.txt
vendored
Normal file
6
core/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_6.txt
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
|
||||
* Lorem ipsum dolor sit amet
|
||||
* consectetur adipiscing elit
|
||||
|
||||
[OK] Lorem ipsum dolor sit amet
|
||||
|
5
core/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_7.txt
vendored
Normal file
5
core/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_7.txt
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
|
||||
Title
|
||||
=====
|
||||
|
||||
// Duis aute irure dolor in reprehenderit in voluptate velit esse
|
1
core/vendor/symfony/console/Tests/Fixtures/input_option_6.json
vendored
Normal file
1
core/vendor/symfony/console/Tests/Fixtures/input_option_6.json
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"name":"--option_name","shortcut":"-o|-O","accept_value":true,"is_value_required":true,"is_multiple":false,"description":"option with multiple shortcuts","default":null}
|
9
core/vendor/symfony/console/Tests/Fixtures/input_option_6.md
vendored
Normal file
9
core/vendor/symfony/console/Tests/Fixtures/input_option_6.md
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
**option_name:**
|
||||
|
||||
* Name: `--option_name`
|
||||
* Shortcut: `-o|-O`
|
||||
* Accept value: yes
|
||||
* Is value required: yes
|
||||
* Is multiple: no
|
||||
* Description: option with multiple shortcuts
|
||||
* Default: `NULL`
|
1
core/vendor/symfony/console/Tests/Fixtures/input_option_6.txt
vendored
Normal file
1
core/vendor/symfony/console/Tests/Fixtures/input_option_6.txt
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
<info>-o|O, --option_name=OPTION_NAME</info> option with multiple shortcuts
|
5
core/vendor/symfony/console/Tests/Fixtures/input_option_6.xml
vendored
Normal file
5
core/vendor/symfony/console/Tests/Fixtures/input_option_6.xml
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<option name="--option_name" shortcut="-o" shortcuts="-o|-O" accept_value="1" is_value_required="1" is_multiple="0">
|
||||
<description>option with multiple shortcuts</description>
|
||||
<defaults/>
|
||||
</option>
|
|
@ -37,6 +37,9 @@ class OutputFormatterStyleTest extends \PHPUnit_Framework_TestCase
|
|||
$style->setForeground('blue');
|
||||
$this->assertEquals("\033[34mfoo\033[39m", $style->apply('foo'));
|
||||
|
||||
$style->setForeground('default');
|
||||
$this->assertEquals("\033[39mfoo\033[39m", $style->apply('foo'));
|
||||
|
||||
$this->setExpectedException('InvalidArgumentException');
|
||||
$style->setForeground('undefined-color');
|
||||
}
|
||||
|
@ -51,6 +54,9 @@ class OutputFormatterStyleTest extends \PHPUnit_Framework_TestCase
|
|||
$style->setBackground('yellow');
|
||||
$this->assertEquals("\033[43mfoo\033[49m", $style->apply('foo'));
|
||||
|
||||
$style->setBackground('default');
|
||||
$this->assertEquals("\033[49mfoo\033[49m", $style->apply('foo'));
|
||||
|
||||
$this->setExpectedException('InvalidArgumentException');
|
||||
$style->setBackground('undefined-color');
|
||||
}
|
||||
|
|
|
@ -22,11 +22,6 @@ use Symfony\Component\Console\Output\StreamOutput;
|
|||
*/
|
||||
class LegacyDialogHelperTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected function setUp()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
public function testSelect()
|
||||
{
|
||||
$dialog = new DialogHelper();
|
||||
|
|
|
@ -19,11 +19,6 @@ use Symfony\Component\Console\Output\StreamOutput;
|
|||
*/
|
||||
class LegacyProgressHelperTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected function setUp()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
public function testAdvance()
|
||||
{
|
||||
$progress = new ProgressHelper();
|
||||
|
|
|
@ -23,7 +23,6 @@ class LegacyTableHelperTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
$this->stream = fopen('php://memory', 'r+');
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@ namespace Symfony\Component\Console\Tests\Helper;
|
|||
|
||||
use Symfony\Component\Console\Helper\DebugFormatterHelper;
|
||||
use Symfony\Component\Console\Helper\HelperSet;
|
||||
use Symfony\Component\Console\Helper\Helper;
|
||||
use Symfony\Component\Console\Output\StreamOutput;
|
||||
use Symfony\Component\Console\Helper\ProcessHelper;
|
||||
use Symfony\Component\Process\Process;
|
||||
|
@ -59,7 +58,7 @@ EOT;
|
|||
|
||||
EOT;
|
||||
$successOutputDebugWithTags = <<<EOT
|
||||
RUN php -r "echo \"<info>42</info>\";"
|
||||
RUN php -r "echo '<info>42</info>';"
|
||||
OUT <info>42</info>
|
||||
RES Command ran successfully
|
||||
|
||||
|
@ -92,7 +91,7 @@ EOT;
|
|||
array('', 'php -r "echo 42;"', StreamOutput::VERBOSITY_VERBOSE, null),
|
||||
array($successOutputVerbose, 'php -r "echo 42;"', StreamOutput::VERBOSITY_VERY_VERBOSE, null),
|
||||
array($successOutputDebug, 'php -r "echo 42;"', StreamOutput::VERBOSITY_DEBUG, null),
|
||||
array($successOutputDebugWithTags, 'php -r "echo \"<info>42</info>\";"', StreamOutput::VERBOSITY_DEBUG, null),
|
||||
array($successOutputDebugWithTags, 'php -r "echo \'<info>42</info>\';"', StreamOutput::VERBOSITY_DEBUG, null),
|
||||
array('', 'php -r "syntax error"', StreamOutput::VERBOSITY_VERBOSE, null),
|
||||
array($syntaxErrorOutputVerbose, 'php -r "fwrite(STDERR, \'error message\');usleep(50000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_VERY_VERBOSE, null),
|
||||
array($syntaxErrorOutputDebug, 'php -r "fwrite(STDERR, \'error message\');usleep(50000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_DEBUG, null),
|
||||
|
|
|
@ -323,17 +323,17 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
" 0/200 [>---------------------------] 0%\n".
|
||||
" 20/200 [==>-------------------------] 10%\n".
|
||||
" 40/200 [=====>----------------------] 20%\n".
|
||||
" 60/200 [========>-------------------] 30%\n".
|
||||
" 80/200 [===========>----------------] 40%\n".
|
||||
" 100/200 [==============>-------------] 50%\n".
|
||||
" 120/200 [================>-----------] 60%\n".
|
||||
" 140/200 [===================>--------] 70%\n".
|
||||
" 160/200 [======================>-----] 80%\n".
|
||||
" 180/200 [=========================>--] 90%\n".
|
||||
" 200/200 [============================] 100%",
|
||||
' 0/200 [>---------------------------] 0%'.PHP_EOL.
|
||||
' 20/200 [==>-------------------------] 10%'.PHP_EOL.
|
||||
' 40/200 [=====>----------------------] 20%'.PHP_EOL.
|
||||
' 60/200 [========>-------------------] 30%'.PHP_EOL.
|
||||
' 80/200 [===========>----------------] 40%'.PHP_EOL.
|
||||
' 100/200 [==============>-------------] 50%'.PHP_EOL.
|
||||
' 120/200 [================>-----------] 60%'.PHP_EOL.
|
||||
' 140/200 [===================>--------] 70%'.PHP_EOL.
|
||||
' 160/200 [======================>-----] 80%'.PHP_EOL.
|
||||
' 180/200 [=========================>--] 90%'.PHP_EOL.
|
||||
' 200/200 [============================] 100%',
|
||||
stream_get_contents($output->getStream())
|
||||
);
|
||||
}
|
||||
|
@ -349,9 +349,9 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
" 0/50 [>---------------------------] 0%\n".
|
||||
" 25/50 [==============>-------------] 50%\n".
|
||||
" 50/50 [============================] 100%",
|
||||
' 0/50 [>---------------------------] 0%'.PHP_EOL.
|
||||
' 25/50 [==============>-------------] 50%'.PHP_EOL.
|
||||
' 50/50 [============================] 100%',
|
||||
stream_get_contents($output->getStream())
|
||||
);
|
||||
}
|
||||
|
@ -364,8 +364,8 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
" 0 [>---------------------------]\n".
|
||||
" 1 [->--------------------------]",
|
||||
' 0 [>---------------------------]'.PHP_EOL.
|
||||
' 1 [->--------------------------]',
|
||||
stream_get_contents($output->getStream())
|
||||
);
|
||||
}
|
||||
|
@ -500,7 +500,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
|||
$mem = 100000 * $i;
|
||||
$colors = $i++ ? '41;37' : '44;37';
|
||||
|
||||
return "\033[".$colors."m ".Helper::formatMemory($mem)." \033[0m";
|
||||
return "\033[".$colors.'m '.Helper::formatMemory($mem)." \033[0m";
|
||||
});
|
||||
$bar->setFormat(" \033[44;37m %title:-37s% \033[0m\n %current%/%max% %bar% %percent:3s%%\n 🏁 %remaining:-10s% %memory:37s%");
|
||||
$bar->setBarCharacter($done = "\033[32m●\033[0m");
|
||||
|
@ -518,17 +518,17 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertEquals(
|
||||
$this->generateOutput(
|
||||
" \033[44;37m Starting the demo... fingers crossed \033[0m\n".
|
||||
" 0/15 ".$progress.str_repeat($empty, 26)." 0%\n".
|
||||
' 0/15 '.$progress.str_repeat($empty, 26)." 0%\n".
|
||||
" \xf0\x9f\x8f\x81 1 sec \033[44;37m 0 B \033[0m"
|
||||
).
|
||||
$this->generateOutput(
|
||||
" \033[44;37m Looks good to me... \033[0m\n".
|
||||
" 4/15 ".str_repeat($done, 7).$progress.str_repeat($empty, 19)." 26%\n".
|
||||
' 4/15 '.str_repeat($done, 7).$progress.str_repeat($empty, 19)." 26%\n".
|
||||
" \xf0\x9f\x8f\x81 1 sec \033[41;37m 97 KiB \033[0m"
|
||||
).
|
||||
$this->generateOutput(
|
||||
" \033[44;37m Thanks, bye \033[0m\n".
|
||||
" 15/15 ".str_repeat($done, 28)." 100%\n".
|
||||
' 15/15 '.str_repeat($done, 28)." 100%\n".
|
||||
" \xf0\x9f\x8f\x81 1 sec \033[41;37m 195 KiB \033[0m"
|
||||
),
|
||||
stream_get_contents($output->getStream())
|
||||
|
@ -570,7 +570,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* Provides each defined format
|
||||
* Provides each defined format.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
|
|
@ -180,10 +180,10 @@ TABLE
|
|||
array(
|
||||
array('ISBN', 'Title', 'Author'),
|
||||
array(
|
||||
array("99921-58-10-7", "Divine\nComedy", "Dante Alighieri"),
|
||||
array("9971-5-0210-2", "Harry Potter\nand the Chamber of Secrets", "Rowling\nJoanne K."),
|
||||
array("9971-5-0210-2", "Harry Potter\nand the Chamber of Secrets", "Rowling\nJoanne K."),
|
||||
array("960-425-059-0", "The Lord of the Rings", "J. R. R.\nTolkien"),
|
||||
array('99921-58-10-7', "Divine\nComedy", 'Dante Alighieri'),
|
||||
array('9971-5-0210-2', "Harry Potter\nand the Chamber of Secrets", "Rowling\nJoanne K."),
|
||||
array('9971-5-0210-2', "Harry Potter\nand the Chamber of Secrets", "Rowling\nJoanne K."),
|
||||
array('960-425-059-0', 'The Lord of the Rings', "J. R. R.\nTolkien"),
|
||||
),
|
||||
'default',
|
||||
<<<TABLE
|
||||
|
@ -550,6 +550,8 @@ TABLE;
|
|||
TABLE;
|
||||
|
||||
$this->assertEquals($expected, $this->getOutputContent($output));
|
||||
|
||||
$this->assertEquals($table, $table->addRow(new TableSeparator()), 'fluent interface on addRow() with a single TableSeparator() works');
|
||||
}
|
||||
|
||||
protected function getOutputStream()
|
||||
|
|
|
@ -376,7 +376,7 @@ class InputDefinitionTest extends \PHPUnit_Framework_TestCase
|
|||
array(new InputDefinition(array(new InputOption('foo'), new InputArgument('foo', InputArgument::REQUIRED))), '[--foo] [--] <foo>', 'puts [--] between options and arguments'),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public function testGetShortSynopsis()
|
||||
{
|
||||
$definition = new InputDefinition(array(new InputOption('foo'), new InputOption('bar'), new InputArgument('cat')));
|
||||
|
@ -388,8 +388,6 @@ class InputDefinitionTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testLegacyAsText()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$definition = new InputDefinition(array(
|
||||
new InputArgument('foo', InputArgument::OPTIONAL, 'The foo argument'),
|
||||
new InputArgument('baz', InputArgument::OPTIONAL, 'The baz argument', true),
|
||||
|
@ -400,7 +398,7 @@ class InputDefinitionTest extends \PHPUnit_Framework_TestCase
|
|||
new InputOption('qux', '', InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'The qux option', array('http://foo.com/', 'bar')),
|
||||
new InputOption('qux2', '', InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'The qux2 option', array('foo' => 'bar')),
|
||||
));
|
||||
|
||||
|
||||
$this->assertStringEqualsFile(self::$fixtures.'/definition_astext.txt', $definition->asText(), '->asText() returns a textual representation of the InputDefinition');
|
||||
}
|
||||
|
||||
|
@ -409,8 +407,6 @@ class InputDefinitionTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testLegacyAsXml()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$definition = new InputDefinition(array(
|
||||
new InputArgument('foo', InputArgument::OPTIONAL, 'The foo argument'),
|
||||
new InputArgument('baz', InputArgument::OPTIONAL, 'The baz argument', true),
|
||||
|
|
|
@ -46,8 +46,6 @@ class StringInputTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testLegacyInputOptionDefinitionInConstructor()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$definition = new InputDefinition(
|
||||
array(new InputOption('foo', null, InputOption::VALUE_REQUIRED))
|
||||
);
|
||||
|
|
64
core/vendor/symfony/console/Tests/Style/SymfonyStyleTest.php
vendored
Normal file
64
core/vendor/symfony/console/Tests/Style/SymfonyStyleTest.php
vendored
Normal file
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
|
||||
namespace Symfony\Component\Console\Tests\Style;
|
||||
|
||||
use PHPUnit_Framework_TestCase;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
use Symfony\Component\Console\Tester\CommandTester;
|
||||
|
||||
class SymfonyStyleTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/** @var Command */
|
||||
protected $command;
|
||||
/** @var CommandTester */
|
||||
protected $tester;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->command = new Command('sfstyle');
|
||||
$this->tester = new CommandTester($this->command);
|
||||
}
|
||||
|
||||
protected function tearDown()
|
||||
{
|
||||
$this->command = null;
|
||||
$this->tester = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider inputCommandToOutputFilesProvider
|
||||
*/
|
||||
public function testOutputs($inputCommandFilepath, $outputFilepath)
|
||||
{
|
||||
$code = require $inputCommandFilepath;
|
||||
$this->command->setCode($code);
|
||||
$this->tester->execute(array(), array('interactive' => false, 'decorated' => false));
|
||||
$this->assertStringEqualsFile($outputFilepath, $this->tester->getDisplay(true));
|
||||
}
|
||||
|
||||
public function inputCommandToOutputFilesProvider()
|
||||
{
|
||||
$baseDir = __DIR__.'/../Fixtures/Style/SymfonyStyle';
|
||||
|
||||
return array_map(null, glob($baseDir.'/command/command_*.php'), glob($baseDir.'/output/output_*.txt'));
|
||||
}
|
||||
|
||||
public function testLongWordsBlockWrapping()
|
||||
{
|
||||
$word = 'Lopadotemachoselachogaleokranioleipsanodrimhypotrimmatosilphioparaomelitokatakechymenokichlepikossyphophattoperisteralektryonoptekephalliokigklopeleiolagoiosiraiobaphetraganopterygon';
|
||||
$wordLength = strlen($word);
|
||||
$maxLineLength = SymfonyStyle::MAX_LINE_LENGTH - 3;
|
||||
|
||||
$this->command->setCode(function (InputInterface $input, OutputInterface $output) use ($word) {
|
||||
$sfStyle = new SymfonyStyle($input, $output);
|
||||
$sfStyle->block($word, 'CUSTOM', 'fg=white;bg=blue', ' § ', false);
|
||||
});
|
||||
|
||||
$this->tester->execute(array(), array('interactive' => false, 'decorated' => false));
|
||||
$expectedCount = (int) ceil($wordLength / ($maxLineLength)) + (int) ($wordLength > $maxLineLength - 5);
|
||||
$this->assertSame($expectedCount, substr_count($this->tester->getDisplay(true), ' § '));
|
||||
}
|
||||
}
|
Reference in a new issue