Upgrade 1-11.38

This commit is contained in:
xesmyd
2026-03-30 14:10:30 +02:00
parent f2a7e6d1fc
commit ac648ef29d
24665 changed files with 69682 additions and 2205004 deletions
+30 -7
View File
@@ -59,12 +59,12 @@ class CommandTesterTest extends TestCase
public function testGetOutput()
{
rewind($this->tester->getOutput()->getStream());
$this->assertEquals('foo'.\PHP_EOL, stream_get_contents($this->tester->getOutput()->getStream()), '->getOutput() returns the current output instance');
$this->assertEquals('foo'.PHP_EOL, stream_get_contents($this->tester->getOutput()->getStream()), '->getOutput() returns the current output instance');
}
public function testGetDisplay()
{
$this->assertEquals('foo'.\PHP_EOL, $this->tester->getDisplay(), '->getDisplay() returns the display of the last execution');
$this->assertEquals('foo'.PHP_EOL, $this->tester->getDisplay(), '->getDisplay() returns the display of the last execution');
}
public function testGetStatusCode()
@@ -138,10 +138,12 @@ class CommandTesterTest extends TestCase
$this->assertEquals(implode('', $questions), $tester->getDisplay(true));
}
/**
* @expectedException \RuntimeException
* @expectedExceptionMessage Aborted.
*/
public function testCommandWithWrongInputsNumber()
{
$this->expectException('RuntimeException');
$this->expectExceptionMessage('Aborted.');
$questions = [
'What\'s your name?',
'How are you?',
@@ -163,10 +165,12 @@ class CommandTesterTest extends TestCase
$tester->execute([]);
}
/**
* @expectedException \RuntimeException
* @expectedExceptionMessage Aborted.
*/
public function testCommandWithQuestionsButNoInputs()
{
$this->expectException('RuntimeException');
$this->expectExceptionMessage('Aborted.');
$questions = [
'What\'s your name?',
'How are you?',
@@ -196,7 +200,7 @@ class CommandTesterTest extends TestCase
];
$command = new Command('foo');
$command->setCode(function ($input, $output) use ($questions) {
$command->setCode(function ($input, $output) use ($questions, $command) {
$io = new SymfonyStyle($input, $output);
$io->ask($questions[0]);
$io->ask($questions[1]);
@@ -209,4 +213,23 @@ class CommandTesterTest extends TestCase
$this->assertEquals(0, $tester->getStatusCode());
}
public function testErrorOutput()
{
$command = new Command('foo');
$command->addArgument('command');
$command->addArgument('foo');
$command->setCode(function ($input, $output) {
$output->getErrorOutput()->write('foo');
}
);
$tester = new CommandTester($command);
$tester->execute(
['foo' => 'bar'],
['capture_stderr_separately' => true]
);
$this->assertSame('foo', $tester->getErrorOutput());
}
}