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

Skip to content

Commit 1836270

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 28fe177 + dc5be00 commit 1836270

File tree

6 files changed

+16
-57
lines changed

6 files changed

+16
-57
lines changed

src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,12 @@ class WebProfilerExtensionTest extends TestCase
3333

3434
public static function assertSaneContainer(Container $container)
3535
{
36+
$removedIds = $container->getRemovedIds();
3637
$errors = [];
3738
foreach ($container->getServiceIds() as $id) {
39+
if (isset($removedIds[$id])) {
40+
continue;
41+
}
3842
try {
3943
$container->get($id);
4044
} catch (\Exception $e) {

src/Symfony/Component/Console/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
*/

src/Symfony/Component/Console/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;

src/Symfony/Component/Console/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
}

src/Symfony/Component/HttpKernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ public function testAutowireAttribute()
467467
$container = new ContainerBuilder();
468468
$resolver = $container->register('argument_resolver.service', 'stdClass')->addArgument([]);
469469

470-
$container->register('some.id', \stdClass::class);
470+
$container->register('some.id', \stdClass::class)->setPublic(true);
471471
$container->setParameter('some.parameter', 'foo');
472472

473473
$container->register('foo', WithAutowireAttribute::class)

src/Symfony/Component/HttpKernel/Tests/EventListener/SessionListenerTest.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -558,22 +558,27 @@ public function testUninitializedSessionWithoutInitializedSession()
558558
public function testResponseHeadersMaxAgeAndExpiresNotBeOverridenIfSessionStarted()
559559
{
560560
$session = $this->createMock(Session::class);
561-
$session->expects($this->exactly(2))->method('getUsageIndex')->will($this->onConsecutiveCalls(0, 1));
561+
$session->expects($this->once())->method('getUsageIndex')->willReturn(1);
562+
$session->expects($this->once())->method('getName')->willReturn('foo');
563+
$sessionFactory = $this->createMock(SessionFactory::class);
564+
$sessionFactory->expects($this->once())->method('createSession')->willReturn($session);
562565

563566
$container = new Container();
564-
$container->set('initialized_session', $session);
567+
$container->set('session_factory', $sessionFactory);
565568

566569
$listener = new SessionListener($container);
567570
$kernel = $this->createMock(HttpKernelInterface::class);
568571

569572
$request = new Request();
570573
$listener->onKernelRequest(new RequestEvent($kernel, $request, HttpKernelInterface::MAIN_REQUEST));
571574

575+
$request->getSession();
576+
572577
$response = new Response();
573578
$response->setPrivate();
574579
$expiresHeader = gmdate('D, d M Y H:i:s', time() + 600).' GMT';
575580
$response->setMaxAge(600);
576-
$listener->onKernelResponse(new ResponseEvent($kernel, new Request(), HttpKernelInterface::MAIN_REQUEST, $response));
581+
$listener->onKernelResponse(new ResponseEvent($kernel, $request, HttpKernelInterface::MAIN_REQUEST, $response));
577582

578583
$this->assertTrue($response->headers->has('expires'));
579584
$this->assertSame($expiresHeader, $response->headers->get('expires'));
@@ -588,20 +593,20 @@ public function testResponseHeadersMaxAgeAndExpiresNotBeOverridenIfSessionStarte
588593
public function testResponseHeadersMaxAgeAndExpiresDefaultValuesIfSessionStarted()
589594
{
590595
$session = $this->createMock(Session::class);
591-
$session->expects($this->exactly(2))->method('getUsageIndex')->will($this->onConsecutiveCalls(0, 1));
596+
$session->expects($this->once())->method('getUsageIndex')->willReturn(1);
592597

593598
$container = new Container();
594-
$container->set('initialized_session', $session);
595599

596600
$listener = new SessionListener($container);
597601
$kernel = $this->createMock(HttpKernelInterface::class);
598602

599603
$request = new Request();
604+
$request->setSession($session);
600605
$listener->onKernelRequest(new RequestEvent($kernel, $request, HttpKernelInterface::MAIN_REQUEST));
601606

602607
$response = new Response();
603608
$expiresHeader = gmdate('D, d M Y H:i:s', time()).' GMT';
604-
$listener->onKernelResponse(new ResponseEvent($kernel, new Request(), HttpKernelInterface::MAIN_REQUEST, $response));
609+
$listener->onKernelResponse(new ResponseEvent($kernel, $request, HttpKernelInterface::MAIN_REQUEST, $response));
605610

606611
$this->assertTrue($response->headers->has('expires'));
607612
$this->assertSame($expiresHeader, $response->headers->get('expires'));

0 commit comments

Comments
 (0)