Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5a9bd5c

Browse files
Merge branch '6.1' into 6.2
* 6.1: [HttpKernel] fix merge [HttpKernel] fix merge Revert "bug #48089 [Console] Fix clear line with question in section (maxbeckers)"
2 parents 0945e82 + c649f33 commit 5a9bd5c

File tree

3 files changed

+0
-50
lines changed

3 files changed

+0
-50
lines changed

Output/ConsoleSectionOutput.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,6 @@ public function getVisibleContent(): string
102102
return implode('', \array_slice($this->content, -$this->maxHeight));
103103
}
104104

105-
/**
106-
* @internal
107-
*/
108-
public function incrementLines()
109-
{
110-
++$this->lines;
111-
}
112-
113105
/**
114106
* @internal
115107
*/

Style/SymfonyStyle.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
use Symfony\Component\Console\Helper\TableSeparator;
2424
use Symfony\Component\Console\Input\InputInterface;
2525
use Symfony\Component\Console\Output\ConsoleOutputInterface;
26-
use Symfony\Component\Console\Output\ConsoleSectionOutput;
2726
use Symfony\Component\Console\Output\OutputInterface;
2827
use Symfony\Component\Console\Output\TrimmedBufferOutput;
2928
use Symfony\Component\Console\Question\ChoiceQuestion;
@@ -301,11 +300,6 @@ public function askQuestion(Question $question): mixed
301300
if ($this->input->isInteractive()) {
302301
$this->newLine();
303302
$this->bufferedOutput->write("\n");
304-
if ($this->output instanceof ConsoleSectionOutput) {
305-
// add one line more to the ConsoleSectionOutput because of the `return` to submit the input
306-
// this is relevant when a `ConsoleSectionOutput::clear` is called.
307-
$this->output->incrementLines();
308-
}
309303
}
310304

311305
return $answer;

Tests/Style/SymfonyStyleTest.php

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,11 @@
1616
use Symfony\Component\Console\Exception\RuntimeException;
1717
use Symfony\Component\Console\Formatter\OutputFormatter;
1818
use Symfony\Component\Console\Input\ArrayInput;
19-
use Symfony\Component\Console\Input\Input;
2019
use Symfony\Component\Console\Input\InputInterface;
2120
use Symfony\Component\Console\Output\ConsoleOutputInterface;
2221
use Symfony\Component\Console\Output\ConsoleSectionOutput;
2322
use Symfony\Component\Console\Output\NullOutput;
2423
use Symfony\Component\Console\Output\OutputInterface;
25-
use Symfony\Component\Console\Output\StreamOutput;
2624
use Symfony\Component\Console\Style\SymfonyStyle;
2725
use Symfony\Component\Console\Tester\CommandTester;
2826

@@ -183,38 +181,4 @@ public function testMemoryConsumption()
183181

184182
$this->assertSame(0, memory_get_usage() - $start);
185183
}
186-
187-
public function testAskAndClearExpectFullSectionCleared()
188-
{
189-
$answer = 'Answer';
190-
$inputStream = fopen('php://memory', 'r+');
191-
fwrite($inputStream, $answer.\PHP_EOL);
192-
rewind($inputStream);
193-
$input = $this->createMock(Input::class);
194-
$sections = [];
195-
$output = new ConsoleSectionOutput(fopen('php://memory', 'r+', false), $sections, StreamOutput::VERBOSITY_NORMAL, true, new OutputFormatter());
196-
$input
197-
->method('isInteractive')
198-
->willReturn(true);
199-
$input
200-
->method('getStream')
201-
->willReturn($inputStream);
202-
203-
$style = new SymfonyStyle($input, $output);
204-
205-
$style->write('foo');
206-
$givenAnswer = $style->ask('Dummy question?');
207-
$output->write('bar');
208-
$output->clear();
209-
210-
rewind($output->getStream());
211-
$this->assertEquals($answer, $givenAnswer);
212-
$this->assertEquals(
213-
'foo'.\PHP_EOL. // write foo
214-
\PHP_EOL.\PHP_EOL.\PHP_EOL." \033[32mDummy question?\033[39m:".\PHP_EOL.' > '.\PHP_EOL.\PHP_EOL.\PHP_EOL. // question
215-
'bar'.\PHP_EOL. // write bar
216-
"\033[10A\033[0J", // clear 10 lines (9 output lines and one from the answer input return)
217-
stream_get_contents($output->getStream())
218-
);
219-
}
220184
}

0 commit comments

Comments
 (0)