prefix
stringlengths
512
512
suffix
stringlengths
256
256
middle
stringlengths
14
229
meta
dict
buted with this source code. */ namespace Symfony\Component\Console\Tests\SignalRegistry; use PHPUnit\Framework\Attributes\RequiresPhpExtension; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\SignalRegistry\SignalRegistry; #[RequiresPhpExtension('pcntl')] class SignalRegistryTest extends TestCase { ...
gnalIsHandled() { $signalRegistry = new SignalRegistry(); $isHandled = false; $signalRegistry->register(\SIGUSR1, static function () use (&$isHandled) { $isHandled = true; }); posix_kill(posix_getpi
_DFL); pcntl_signal(\SIGTERM, \SIG_DFL); pcntl_signal(\SIGUSR1, \SIG_DFL); pcntl_signal(\SIGUSR2, \SIG_DFL); pcntl_signal(\SIGALRM, \SIG_DFL); } public function testOneCallbackForASignalSi
{ "filepath": "src/Symfony/Component/Console/Tests/SignalRegistry/SignalRegistryTest.php", "language": "php", "file_size": 7765, "cut_index": 716, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Console\Tests\Question; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Question\ChoiceQuestion; class ChoiceQuestionTest extends TestCase { #[DataProvider('selectUseCases')] public funct...
= $question->getValidator(); $actual = $validator($answer); $this->assertEquals($actual, $expected, $message); } } public static function selectUseCases() { return [ [ false
ond response', 'Third response', 'Fourth response', null, ], $default); $question->setMultiselect($multiSelect); foreach ($answers as $answer) { $validator
{ "filepath": "src/Symfony/Component/Console/Tests/Question/ChoiceQuestionTest.php", "language": "php", "file_size": 5598, "cut_index": 716, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Question; use PHPUnit\Framework\Attributes\DataProvider; use PHP...
r(); $actual = $normalizer($answer); $this->assertEquals($expected, $actual, \sprintf($message, $answer)); } } public static function normalizerUsecases() { return [ [ true,
nction testDefaultRegexUsecases($default, $answers, $expected, $message) { $sut = new ConfirmationQuestion('A question', $default); foreach ($answers as $answer) { $normalizer = $sut->getNormalize
{ "filepath": "src/Symfony/Component/Console/Tests/Question/ConfirmationQuestionTest.php", "language": "php", "file_size": 1864, "cut_index": 537, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Question; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Exception\InvalidA...
uestion('Provide a file:'); $this->assertTrue($question->isPasteAllowed()); $this->assertTrue($question->isPathAllowed()); $this->assertFalse($question->isTrimmable()); } public function testWithAllowPasteFalse() {
uestion() { $question = new FileQuestion('Provide a file:'); $this->assertSame('Provide a file:', $question->getQuestion()); } public function testDefaultOptions() { $question = new FileQ
{ "filepath": "src/Symfony/Component/Console/Tests/Question/FileQuestionTest.php", "language": "php", "file_size": 2271, "cut_index": 563, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Console\Tests\Question; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Question\Question; class QuestionTest extends TestCase { private Question $question; protected function setUp(): v...
sertSame('Default value', $question->getDefault()); } public function testGetDefaultDefault() { self::assertNull($this->question->getDefault()); } #[DataProvider('providerTrueFalse')] public function testIsSetHidden(bool $
GetQuestion() { self::assertSame('Test question', $this->question->getQuestion()); } public function testGetDefault() { $question = new Question('Test question', 'Default value'); self::as
{ "filepath": "src/Symfony/Component/Console/Tests/Question/QuestionTest.php", "language": "php", "file_size": 8651, "cut_index": 716, "middle_length": 229 }
ackage. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Helper; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Input\Streamable...
lass); $mock ->method('isInteractive') ->willReturn($interactive); if ($stream) { $mock ->method('getStream') ->willReturn($stream); } return $mock; }
mock = $this->createStub(StreamableInputInterface::c
{ "filepath": "src/Symfony/Component/Console/Tests/Helper/AbstractQuestionHelperTestCase.php", "language": "php", "file_size": 870, "cut_index": 559, "middle_length": 52 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Helper; use PHPUnit\Framework\Attributes\DataProvider; use PHPUn...
CliDumper::class => false, ]); } public static function tearDownAfterClass(): void { ClassExistsMock::withMockedClasses([]); } #[DataProvider('provideVariables')] public function testInvoke($variable, $primit
\Dumper\CliDumper; class DumperNativeFallbackTest extends TestCase { public static function setUpBeforeClass(): void { ClassExistsMock::register(Dumper::class); ClassExistsMock::withMockedClasses([
{ "filepath": "src/Symfony/Component/Console/Tests/Helper/DumperNativeFallbackTest.php", "language": "php", "file_size": 1543, "cut_index": 537, "middle_length": 229 }
This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Helper; use PHPUnit\Framework\Attributes\DataProvid...
ion tearDownAfterClass(): void { putenv('DUMP_LIGHT_ARRAY'); putenv('DUMP_COMMA_SEPARATOR'); } #[DataProvider('provideVariables')] public function testInvoke($variable) { $dumper = new Dumper(new NullOutput());
s DumperTest extends TestCase { use VarDumperTestTrait; public static function setUpBeforeClass(): void { putenv('DUMP_LIGHT_ARRAY=1'); putenv('DUMP_COMMA_SEPARATOR=1'); } public static funct
{ "filepath": "src/Symfony/Component/Console/Tests/Helper/DumperTest.php", "language": "php", "file_size": 1353, "cut_index": 524, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Helper; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Exception\InvalidFil...
= 'sf_console_<error>bad<error>_'.bin2hex(random_bytes(4)).'.txt'; $path = sys_get_temp_dir().\DIRECTORY_SEPARATOR.$name; if (false === @file_put_contents($path, 'x')) { $this->markTestSkipped('Filesystem does not allow "<" /
onent\Console\Output\BufferedOutput; use Symfony\Component\Console\Question\FileQuestion; class FileInputHelperTest extends TestCase { public function testDisplayFileEscapesFormatterMetaCharactersInPath() { $name
{ "filepath": "src/Symfony/Component/Console/Tests/Helper/FileInputHelperTest.php", "language": "php", "file_size": 2844, "cut_index": 563, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Helper; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Helper\FormatterHelper; class FormatterHelperTest extends TestCase { ...
$this->assertEquals( '<error> Some text to display </error>', $formatter->formatBlock('Some text to display', 'error'), '::formatBlock() formats a message in a block' ); $this->assertEquals(
tter->formatSection('cli', 'Some text to display'), '::formatSection() formats a message in a section' ); } public function testFormatBlock() { $formatter = new FormatterHelper();
{ "filepath": "src/Symfony/Component/Console/Tests/Helper/FormatterHelperTest.php", "language": "php", "file_size": 4413, "cut_index": 614, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Helper; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Exception\ExceptionInterface; use Symfony\Component\Console\Helper\Help...
$this->assertTrue($helperset->has('fake_helper_alias'), '__construct sets helper alias for given helper'); } public function testSet() { $helperset = new HelperSet(); $helperset->set($this->getGenericMockHelper('fake_helper', $
per('fake_helper'); $helperset = new HelperSet(['fake_helper_alias' => $mock_helper]); $this->assertEquals($mock_helper, $helperset->get('fake_helper_alias'), '__construct sets given helper to helpers');
{ "filepath": "src/Symfony/Component/Console/Tests/Helper/HelperSetTest.php", "language": "php", "file_size": 4758, "cut_index": 614, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Helper; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use...
[59.21, '59 s', 1], [59.21, '59 s, 210 ms', 5], [60, '1 min', 2], [61, '1 min, 1 s', 2], [119, '1 min, 59 s', 2], [120, '2 min', 2], [121, '2 min, 1 s', 2],
return [ [0, '< 1 ms', 1], [0.0004, '< 1 ms', 1], [0.95, '950 ms', 1], [1, '1 s', 1], [2, '2 s', 2], [59, '59 s', 1],
{ "filepath": "src/Symfony/Component/Console/Tests/Helper/HelperTest.php", "language": "php", "file_size": 2409, "cut_index": 563, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Helper; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use...
tProvider(): iterable { $baseTextWithUtf8AndUrl = 'ÁrvΓ­ztΕ±rΕ‘tΓΌkΓΆrfΓΊrΓ³gΓ©p https://github.com/symfony/symfony Lorem ipsum <comment>dolor</comment> sit amet, consectetur adipiscing elit. Praesent vestibulum nulla quis urna maximus porttitor. Donec
l $allowCutUrls, string $expected) { $wrapper = new OutputWrapper($allowCutUrls); $result = $wrapper->wrap($text, $width); $this->assertEquals($expected, $result); } public static function tex
{ "filepath": "src/Symfony/Component/Console/Tests/Helper/OutputWrapperTest.php", "language": "php", "file_size": 2367, "cut_index": 563, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Console\Tests\Helper; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Helper\DebugFormatterHelper; use Symfony\Component\Console\Helper\HelperSet; use Symfony\Component\Console\Helper\ProcessHelpe...
cmd); } $helper = new ProcessHelper(); $helper->setHelperSet(new HelperSet([new DebugFormatterHelper()])); $outputStream = $this->getOutputStream($verbosity); $helper->run($outputStream, $cmd, $error); $exp
lic function testVariousProcessRuns(array $expectedOutputLines, bool $successful, Process|string|array $cmd, int $verbosity, ?string $error) { if (\is_string($cmd)) { $cmd = Process::fromShellCommandline($
{ "filepath": "src/Symfony/Component/Console/Tests/Helper/ProcessHelperTest.php", "language": "php", "file_size": 5785, "cut_index": 716, "middle_length": 229 }
ic function testAdvance() { $bar = new ProgressBar($output = $this->getOutputStream(), 0, 0); $bar->start(); $bar->advance(); rewind($output->getStream()); $this->assertEquals( ' 0 [>---------------------------]'.$this->osc(3, 0). $this->generateOu...
c(3, 0). $this->generateOutput(' 16 [---------------->-----------]'), stream_get_contents($output->getStream()) ); } public function testResumeWithMax() { $bar = new ProgressBar($output = $this->getOut
($output = $this->getOutputStream(), 0, 0); $bar->start(null, 15); $bar->advance(); rewind($output->getStream()); $this->assertEquals( ' 15 [--------------->------------]'.$this->os
{ "filepath": "src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php", "language": "php", "file_size": 61650, "cut_index": 2151, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Console\Tests\Helper; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Formatter\OutputFormatter; use Symfony\Component\Console\Helper\ProgressIndicator; use...
$bar->advance(); usleep(101000); $bar->advance(); usleep(101000); $bar->advance(); usleep(101000); $bar->advance(); usleep(101000); $bar->setMessage('Advancing...'); $bar->advance();
function testDefaultIndicator() { $bar = new ProgressIndicator($output = $this->getOutputStream()); $bar->start('Starting...'); usleep(101000); $bar->advance(); usleep(101000);
{ "filepath": "src/Symfony/Component/Console/Tests/Helper/ProgressIndicatorTest.php", "language": "php", "file_size": 8961, "cut_index": 716, "middle_length": 229 }
lper(); $helperSet = new HelperSet([new FormatterHelper()]); $questionHelper->setHelperSet($helperSet); $heroes = ['Superman', 'Batman', 'Spiderman']; $inputStream = $this->getInputStream("\n1\n 1 \nFabien\n1\nFabien\n1\n0,2\n 0 , 2 \n\n\n"); $question = new ChoiceQuestion...
roes); $question->setMaxAttempts(1); $this->assertEquals('Batman', $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question)); $this->assertEquals('Batman', $questionHel
>assertEquals('Spiderman', $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question)); $question = new ChoiceQuestion('What is your favorite superhero?', $he
{ "filepath": "src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php", "language": "php", "file_size": 50735, "cut_index": 2151, "middle_length": 229 }
Console\Helper\FormatterHelper; use Symfony\Component\Console\Helper\HelperSet; use Symfony\Component\Console\Helper\SymfonyQuestionHelper; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\StreamOutput; use Symfony\Component\Console\Question\ChoiceQuestion; use Symfony\Component\...
tStream("\n1\n 1 \nFabien\n1\nFabien\n1\n0,2\n 0 , 2 \n\n\n"); $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '2'); $question->setMaxAttempts(1); // first answer is an empty answer, we're supposed to
fonyQuestionHelper(); $helperSet = new HelperSet([new FormatterHelper()]); $questionHelper->setHelperSet($helperSet); $heroes = ['Superman', 'Batman', 'Spiderman']; $inputStream = $this->getInpu
{ "filepath": "src/Symfony/Component/Console/Tests/Helper/SymfonyQuestionHelperTest.php", "language": "php", "file_size": 10340, "cut_index": 921, "middle_length": 229 }
/* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Helper; use PHPUnit\Framework\TestCase; use ...
{ $tableCellStyle = new TableCellStyle(['fg' => 'red']); $this->assertEquals('red', $tableCellStyle->getOptions()['fg']); $this->expectException(InvalidArgumentException::class); new TableCellStyle(['wrong_key' => nul
bleCellStyle()
{ "filepath": "src/Symfony/Component/Console/Tests/Helper/TableCellStyleTest.php", "language": "php", "file_size": 800, "cut_index": 517, "middle_length": 14 }
---+--------------------------+------------------+ | 99921-58-10-7 | Divine Comedy | Dante Alighieri | | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | | 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien | ...
|---------------|--------------------------|------------------| | 99921-58-10-7 | Divine Comedy | Dante Alighieri | | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens |
, [ ['ISBN', 'Title', 'Author'], $books, 'markdown', <<<'TABLE' | ISBN | Title | Author |
{ "filepath": "src/Symfony/Component/Console/Tests/Helper/TableTest.php", "language": "php", "file_size": 89442, "cut_index": 3790, "middle_length": 229 }
eeNode; use Symfony\Component\Console\Helper\TreeStyle; use Symfony\Component\Console\Output\BufferedOutput; class TreeHelperTest extends TestCase { public function testRenderWithoutNode() { $output = new BufferedOutput(); $tree = TreeHelper::createTree($output); $tree->render(); ...
$rootNode = new TreeNode('Root'); $child1 = new TreeNode('Child 1'); $child2 = new TreeNode('Child 2'); $rootNode->addChild($child1); $rootNode->addChild($child2); $output = new BufferedOutput(); $tree = T
$tree = TreeHelper::createTree($output, $rootNode); $tree->render(); $this->assertSame("Root\n", self::normalizeLineBreaks($output->fetch())); } public function testRenderTwoLevelTree() {
{ "filepath": "src/Symfony/Component/Console/Tests/Helper/TreeHelperTest.php", "language": "php", "file_size": 11056, "cut_index": 921, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Helper; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Helper\TreeNode; cl...
$this->assertSame(1, iterator_count($root->getChildren())); $this->assertSame($child, iterator_to_array($root->getChildren())[0]); } public function testAddingChildrenAsString() { $root = new TreeNode('Root'); $root->
->assertSame(0, iterator_count($node->getChildren())); } public function testAddingChildren() { $root = new TreeNode('Root'); $child = new TreeNode('Child'); $root->addChild($child);
{ "filepath": "src/Symfony/Component/Console/Tests/Helper/TreeNodeTest.php", "language": "php", "file_size": 2551, "cut_index": 563, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Console\Tests\Helper; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Helper\TreeHelper; use Symfony\Component\Console\Helper\TreeNode; use Symfony\Component\Console\Helper\TreeStyle; use Symfony\Component\Console\Output\BufferedOutput; use Sy...
β”‚ └── A2.1.2 β”œβ”€β”€ B β”‚ β”œβ”€β”€ B1 β”‚ β”‚ β”œβ”€β”€ B11 β”‚ β”‚ └── B12 β”‚ └── B2 └── C TREE, self::normalizeLineBreaks(trim($output->fetch()))
f::createTree($output); $tree->render(); $this->assertSame(<<<TREE root β”œβ”€β”€ A β”‚ β”œβ”€β”€ A1 β”‚ └── A2 β”‚ └── A2.1 β”‚ β”œβ”€β”€ A2.1.1
{ "filepath": "src/Symfony/Component/Console/Tests/Helper/TreeStyleTest.php", "language": "php", "file_size": 6672, "cut_index": 716, "middle_length": 229 }
erface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\StringInput; use Symfony\Component\Console\Output\NullOutput; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Tester\CommandTester; use Symfony\Component\Console\Tests\Fixtures\InvokableTestC...
construct() takes the command name as its first argument'); } public function testCommandNameCannotBeEmpty() { $this->expectException(\LogicException::class); $this->expectExceptionMessage('The command defined in "Symfony\Compo
ixtures/'; require_once self::$fixturesPath.'/TestCommand.php'; } public function testConstructor() { $command = new Command('foo:bar'); $this->assertEquals('foo:bar', $command->getName(), '__
{ "filepath": "src/Symfony/Component/Console/Tests/Command/CommandTest.php", "language": "php", "file_size": 21801, "cut_index": 1331, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Console\Tests\Command; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Application; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\CompleteCommand; use Symfon...
s TestCase { private CompleteCommand $command; private Application $application; private CommandTester $tester; protected function setUp(): void { $this->command = new CompleteCommand(); $this->application = new Applic
y\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Tester\CommandTester; class CompleteCommandTest extend
{ "filepath": "src/Symfony/Component/Console/Tests/Command/CompleteCommandTest.php", "language": "php", "file_size": 6876, "cut_index": 716, "middle_length": 229 }
?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Command; use PHPUnit\Framework\Attribute...
ommand()); $suggestions = $tester->complete($input); $this->assertSame($expectedSuggestions, $suggestions); } public static function provideCompletionSuggestions() { yield 'shell' => [ [''], ['b
CommandTest extends TestCase { #[DataProvider('provideCompletionSuggestions')] public function testComplete(array $input, array $expectedSuggestions) { $tester = new CommandCompletionTester(new DumpCompletionC
{ "filepath": "src/Symfony/Component/Console/Tests/Command/DumpCompletionCommandTest.php", "language": "php", "file_size": 1039, "cut_index": 513, "middle_length": 229 }
p use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class FooCommand extends Command { public InputInterface $input; public OutputInterface $output; protected function configure(): void { $t...
$output->writeln('interact called'); } protected function execute(InputInterface $input, OutputInterface $output): int { $this->input = $input; $this->output = $output; $output->writeln('called'); return 0;
input, OutputInterface $output): void {
{ "filepath": "src/Symfony/Component/Console/Tests/Fixtures/FooCommand.php", "language": "php", "file_size": 830, "cut_index": 516, "middle_length": 52 }
/* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Fixtures; use Symfony\Component\Console\Attr...
s InvokableWithAskCommand { public function __invoke( SymfonyStyle $io, #[Argument] #[Ask('What is your name?')] string $name, ): int { $io->writeln('Hello '.$name); return Command::SUCCESS; } }
le\SymfonyStyle; #[AsCommand('invokable:ask')] clas
{ "filepath": "src/Symfony/Component/Console/Tests/Fixtures/InvokableWithAskCommand.php", "language": "php", "file_size": 826, "cut_index": 517, "middle_length": 52 }
/* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Fixtures; use Symfony\Component\Console\Attri...
d { public function __invoke( OutputInterface $output, #[Argument] #[Ask('Provide an image file:', constraints: [new File(mimeTypes: ['image/png', 'image/jpeg'])])] InputFile $file, ): int { $output->writeln(
t\File\InputFile; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Validator\Constraints\File; #[AsCommand(name: 'app:input-file-with-constraints')] class InvokableWithInputFileAndConstraintsTestComman
{ "filepath": "src/Symfony/Component/Console/Tests/Fixtures/InvokableWithInputFileAndConstraintsTestCommand.php", "language": "php", "file_size": 1152, "cut_index": 518, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Fixtures; use Symfony\Component\Console\Attribute\Argument; use Symfony\Component\Console\...
Dto $user): void { $user->email ??= 'user.interactive@command.com'; } public function __invoke(SymfonyStyle $io, #[MapInput] UserDto $user): int { $io->writeln($user->name); $io->writeln($user->email); $io->
onsole\Command\Command; use Symfony\Component\Console\Style\SymfonyStyle; #[AsCommand('invokable:input:test')] class InvokableWithInputTestCommand { #[Interact] public function interact(SymfonyStyle $io, #[MapInput] User
{ "filepath": "src/Symfony/Component/Console/Tests/Fixtures/InvokableWithInputTestCommand.php", "language": "php", "file_size": 2196, "cut_index": 563, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Fixtures; use Symfony\Component\Console\Attribute\Argument; use ...
ment, AskChoice('Select a color', ['red', 'green', 'blue'])] string $color, #[MapInput] ChoiceDto $dto, ): int { $io->writeln('Color: '.$color); $io->writeln('Size: '.$dto->size); $io->writeln('Status: '
d; use Symfony\Component\Console\Style\SymfonyStyle; #[AsCommand('invokable:interactive:choice')] class InvokableWithInteractiveChoiceAttributeTestCommand { public function __invoke( SymfonyStyle $io, #[Argu
{ "filepath": "src/Symfony/Component/Console/Tests/Fixtures/InvokableWithInteractiveChoiceAttributeTestCommand.php", "language": "php", "file_size": 1611, "cut_index": 537, "middle_length": 229 }
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Fixtures; use Symfony\Component\Console...
erface $o, #[Argument] ?string $name = null): int { $o->write('cmd1'); return Command::SUCCESS; } #[AsCommand('app:cmd2')] public function cmd2(OutputInterface $o): int { $o->write('cmd2'); return Comm
md0')] class MethodBasedTestCommand { public function __invoke(OutputInterface $o): int { $o->write('cmd0'); return Command::SUCCESS; } #[AsCommand('app:cmd1')] public function cmd1(OutputInt
{ "filepath": "src/Symfony/Component/Console/Tests/Fixtures/MethodBasedTestCommand.php", "language": "php", "file_size": 1019, "cut_index": 512, "middle_length": 229 }
use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Question\ChoiceQuestion; use Symfony\Component\Console\Question\Question; use Sym...
)) ->setCode(function (InputInterface $input, OutputInterface $output) { if ($input->getOption('choice')) { $this->getHelper('question') ->ask($input, $output, new ChoiceQuestion('😊', ['n'])); } else {
lass extends SingleCommandApplication {}) ->setDefinition(new InputDefinition([ new InputOption('choice', null, InputOption::VALUE_NONE, ''), new InputOption('hidden', null, InputOption::VALUE_NONE, ''), ]
{ "filepath": "src/Symfony/Component/Console/Tests/Fixtures/application_sttyhelper.php", "language": "php", "file_size": 1231, "cut_index": 518, "middle_length": 229 }
\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; //Ensure that all lines are aligned to the begin of the first line in a very long line block return function (InputInterface $input, OutputInterface $output): int { $output = new SymfonyStyle($input, $output); $output-...
quat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum', 'CUSTOM', 'fg=white
ullamco laboris nisi ut aliquip ex ea commodo conse
{ "filepath": "src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/command_10.php", "language": "php", "file_size": 954, "cut_index": 582, "middle_length": 52 }
t\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; // ensure that nested tags have no effect on the color of the '//' prefix return function (InputInterface $input, OutputInterface $output): int { $output->setDecorated(true); $output = new SymfonyStyle($input, $output); $output->comment( ...
ip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</comment> Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum'
s nostrud exercitation ullamco laboris nisi ut aliqu
{ "filepath": "src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/command_13.php", "language": "php", "file_size": 950, "cut_index": 606, "middle_length": 52 }
tInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; // ensure that block() behaves properly with a type and without prefix return function (InputInterface $input, OutputInterface $output): int { $output = new SymfonyStyle($input, $output); $output...
equat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum', 'TEST' ); return
n ullamco laboris nisi ut aliquip ex ea commodo cons
{ "filepath": "src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/command_15.php", "language": "php", "file_size": 873, "cut_index": 559, "middle_length": 52 }
e\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; // ensure that block() output is properly formatted (even padding lines) return function (InputInterface $input, OutputInterface $output): int { $output->setDecorated(true); $output =...
llamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
Ut enim ad minim veniam, quis nostrud exercitation u
{ "filepath": "src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/command_16.php", "language": "php", "file_size": 910, "cut_index": 547, "middle_length": 52 }
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): int { $output = new SymfonyStyle($...
utput->write(new \ArrayIterator(['', '', ''])); $output->title('Fourth title'); //Ensure have manual control over number of blank lines: $output->writeln('Lorem ipsum dolor sit amet'); $output->writeln(new \ArrayIterator(['', ''])); //Shou
$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'); $o
{ "filepath": "src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/command_4_with_iterators.php", "language": "php", "file_size": 1235, "cut_index": 518, "middle_length": 229 }
Symfony\Component\Console\Helper\TableCell; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; //Ensure formatting tables when using multiple headers with TableCell return function (InputInterface $input, OutputIn...
'De Monarchia', new TableCell("Dante Alighieri\nspans multiple rows", ['rowspan' => 2]), ], ['978-0804169127', 'Divine Comedy'], ]; $output = new SymfonyStyle($input, $output); $output->table($headers, $row
21567817',
{ "filepath": "src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/command_8.php", "language": "php", "file_size": 814, "cut_index": 522, "middle_length": 14 }
buted with this source code. */ namespace Symfony\Component\Console\Tests\Logger; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Psr\Log\InvalidArgumentException; use Psr\Log\LoggerInterface; use Psr\Log\LogLevel; use Symfony\Component\Console\Logger\ConsoleLogger; use Symfony\Com...
put(OutputInterface::VERBOSITY_VERBOSE); return new ConsoleLogger($this->output, [ LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL, LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL, LogLevel::CRITIC
il.com> * @author Jordi Boggiano <j.boggiano@seld.be> */ class ConsoleLoggerTest extends TestCase { protected DummyOutput $output; public function getLogger(): LoggerInterface { $this->output = new DummyOut
{ "filepath": "src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php", "language": "php", "file_size": 7019, "cut_index": 716, "middle_length": 229 }
ony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Fixtures; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Con...
tHelp('command 2 help') ->addUsage('-o|--option_name <argument_name>') ->addUsage('<argument_name>') ->addArgument('argument_name', InputArgument::REQUIRED) ->addOption('option_name', 'o', InputOption::VALUE_
escription('command 2 description') ->se
{ "filepath": "src/Symfony/Component/Console/Tests/Fixtures/DescriptorCommand2.php", "language": "php", "file_size": 938, "cut_index": 606, "middle_length": 52 }
y\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class Foo3Command extends Command { protected function configure(): void { $this ->setName('foo3:bar') ->setDescription('The foo3:bar co...
(\Exception $e) { throw new \Exception('Second exception <comment>comment</comment>', 0, $e); } } catch (\Exception $e) { throw new \Exception('Third exception <fg=blue;bg=red>comment</>', 404, $e); }
xception <p>this is html</p>'); } catch
{ "filepath": "src/Symfony/Component/Console/Tests/Fixtures/Foo3Command.php", "language": "php", "file_size": 865, "cut_index": 529, "middle_length": 52 }
hp /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Fixtures; use Symfony\Component\Console\At...
validator: [self::class, 'validate'])] string $value, ): int { $output->writeln('Value: '.$value); return Command::SUCCESS; } public static function validate(string $value): string { if ('valid' !== $value
utput\OutputInterface; #[AsCommand(name: 'app:custom-validator')] class InvokableWithCustomValidatorTestCommand { public function __invoke( OutputInterface $output, #[Argument] #[Ask('Enter a value:',
{ "filepath": "src/Symfony/Component/Console/Tests/Fixtures/InvokableWithCustomValidatorTestCommand.php", "language": "php", "file_size": 1112, "cut_index": 515, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Fixtures; use Symfony\Component\Console\Attribute\Argument; use Symfony\Component\Console\...
$io, #[MapInput] DummyDto $dto): void { $dto->arg5 ??= $io->ask('Enter arg5'); } public function __invoke( SymfonyStyle $io, #[Argument, Ask('Enter arg1')] string $arg1, #[MapInput] DummyDto $d
ole\Command\Command; use Symfony\Component\Console\Style\SymfonyStyle; #[AsCommand('invokable:interactive:question')] class InvokableWithInteractiveAttributesTestCommand { #[Interact] public function prompt(SymfonyStyle
{ "filepath": "src/Symfony/Component/Console/Tests/Fixtures/InvokableWithInteractiveAttributesTestCommand.php", "language": "php", "file_size": 2494, "cut_index": 563, "middle_length": 229 }
onent\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Question\ChoiceQuestion; use Symfony\Component\Console\SingleCommandApplication; $vendor = __DIR__; while (!file_exists($vendor.'/vendor')) { $vendor = \dirname($vendor); } require $vendor.'/vend...
{ exit(254); } }) ->setCode(function(InputInterface $input, OutputInterface $output): int { $this->getHelper('question') ->ask($input, $output, new ChoiceQuestion('😊', ['y'])); return 0; }) ->run()
ignal, int|false $previousExitCode = 0): int|false
{ "filepath": "src/Symfony/Component/Console/Tests/Fixtures/application_signalable.php", "language": "php", "file_size": 848, "cut_index": 535, "middle_length": 52 }
ymfony\Component\Console\Command\Command; use Symfony\Component\Console\Helper\QuestionHelper; use Symfony\Component\Console\Input\ArgvInput; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\ConsoleOutput; use Symfony\Component\C...
$input, OutputInterface $output): int { $mode = $input->getArgument('mode'); $question = new Question('Enter text: '); $question->setMultiline($mode !== 'single'); $helper = new QuestionHelper(); pcntl_async_
.'/vendor/autoload.php'; (new class extends Command { protected function configure(): void { $this->addArgument('mode', InputArgument::OPTIONAL, '', 'single'); } protected function execute(InputInterface
{ "filepath": "src/Symfony/Component/Console/Tests/Fixtures/application_test_sigint.php", "language": "php", "file_size": 1340, "cut_index": 524, "middle_length": 229 }
hp use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; // ensure that nested tags have no effect on the color of the '//' prefix return function (InputInterface $input, OutputInterface $output): int { $output->...
sse cillum dolore eu fugiat nulla pariatur.</comment> Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum', 'β˜…', // UTF-8 star! null, '<fg=default;bg=default> β•‘ </>', // UTF-
o eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit e
{ "filepath": "src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/command_22.php", "language": "php", "file_size": 1082, "cut_index": 515, "middle_length": 229 }
hp use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; //Ensure has proper line ending before outputting a text block like with SymfonyStyle::listing() or SymfonyStyle::text() return function (InputInterface $input...
]); $output->write('Lorem ipsum dolor sit amet'); $output->text([ 'Lorem ipsum dolor sit amet', 'consectetur adipiscing elit', ]); $output->newLine(); $output->write('Lorem ipsum dolor sit amet'); $output->comme
et', 'consectetur adipiscing elit', ]); //Even using write: $output->write('Lorem ipsum dolor sit amet'); $output->listing([ 'Lorem ipsum dolor sit amet', 'consectetur adipiscing elit',
{ "filepath": "src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/command_5.php", "language": "php", "file_size": 1108, "cut_index": 515, "middle_length": 229 }
This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Descriptor; use PHPUnit\Framework\Attributes\DataPr...
foreach ($names as $name) { $application->addCommand(new Command($name)); } $this->assertSame($expected, array_keys((new ApplicationDescription($application))->getNamespaces())); } public static function getName
n; final class ApplicationDescriptionTest extends TestCase { #[DataProvider('getNamespacesProvider')] public function testGetNamespaces(array $expected, array $names) { $application = new TestApplication();
{ "filepath": "src/Symfony/Component/Console/Tests/Descriptor/ApplicationDescriptionTest.php", "language": "php", "file_size": 1391, "cut_index": 524, "middle_length": 229 }
<?php use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class FooOptCommand extends Command { public $input; public $output; protected function configure...
ction execute(InputInterface $input, OutputInterface $output): int { $this->input = $input; $this->output = $output; $output->writeln('called'); $output->writeln($this->input->getOption('fooopt')); return 0;
InputOption::VALUE_OPTIONAL, 'fooopt description') ; } protected function interact(InputInterface $input, OutputInterface $output): void { $output->writeln('interact called'); } protected fun
{ "filepath": "src/Symfony/Component/Console/Tests/Fixtures/FooOptCommand.php", "language": "php", "file_size": 1003, "cut_index": 512, "middle_length": 229 }
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Fixtures; use Symfony\Component\Console...
onyStyle $io, #[MapInput] DtoWithHiddenQuestionArg $dto, ): int { $io->writeln('Arg1: '.$dto->arg1); return Command::SUCCESS; } } class DtoWithHiddenQuestionArg { #[Argument] #[Ask('Enter arg1', hidden: true)]
sole\Command\Command; use Symfony\Component\Console\Style\SymfonyStyle; #[AsCommand('invokable:interactive:question')] class InvokableWithInteractiveHiddenQuestionAttributeTestCommand { public function __invoke( Symf
{ "filepath": "src/Symfony/Component/Console/Tests/Fixtures/InvokableWithInteractiveHiddenQuestionAttributeTestCommand.php", "language": "php", "file_size": 1020, "cut_index": 512, "middle_length": 229 }
e\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; // ensure that all lines are aligned to the begin of the first one and start with '//' in a very long line comment return function (InputInterface $input, OutputInterface $output): int { ...
itation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt molli
aliqua. Ut enim ad minim veniam, quis nostrud exerc
{ "filepath": "src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/command_12.php", "language": "php", "file_size": 903, "cut_index": 547, "middle_length": 52 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Descriptor; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Application; use Sym...
nt $argument, $expectedDescription) { $this->assertDescription($expectedDescription, $argument); } #[DataProvider('getDescribeInputOptionTestData')] public function testDescribeInputOption(InputOption $option, $expectedDescription)
use Symfony\Component\Console\Output\BufferedOutput; abstract class AbstractDescriptorTestCase extends TestCase { #[DataProvider('getDescribeInputArgumentTestData')] public function testDescribeInputArgument(InputArgume
{ "filepath": "src/Symfony/Component/Console/Tests/Descriptor/AbstractDescriptorTestCase.php", "language": "php", "file_size": 4012, "cut_index": 614, "middle_length": 229 }
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Fixtures; use Symfony\Component\Console...
#[Argument] #[Ask('Provide a file:')] InputFile $file, ): int { $output->writeln('Filename: '.$file->getFilename()); $output->writeln('Valid: '.($file->isValid() ? 'yes' : 'no')); return Command::SUCCESS; }
e\Input\File\InputFile; use Symfony\Component\Console\Output\OutputInterface; #[AsCommand(name: 'app:input-file')] class InvokableWithInputFileTestCommand { public function __invoke( OutputInterface $output,
{ "filepath": "src/Symfony/Component/Console/Tests/Fixtures/InvokableWithInputFileTestCommand.php", "language": "php", "file_size": 999, "cut_index": 512, "middle_length": 229 }
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): int { $output = new SymfonyStyle($...
utput->write(['', '', '']); $output->title('Fourth title'); //Ensure have manual control over number of blank lines: $output->writeln('Lorem ipsum dolor sit amet'); $output->writeln(['', '']); //Should append an extra blank line $outpu
$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'); $o
{ "filepath": "src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/command_4.php", "language": "php", "file_size": 1195, "cut_index": 518, "middle_length": 229 }
e\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; // ensure that block() behaves properly with a prefix and without type return function (InputInterface $input, OutputInterface $output): int { $output = new SymfonyStyle($input, $output);...
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum', null,
exercitation ullamco laboris nisi ut aliquip ex ea
{ "filepath": "src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/command_14.php", "language": "php", "file_size": 913, "cut_index": 547, "middle_length": 52 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Command; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Application; use Symfon...
w CommandTester($command); $commandTester->execute(['command_name' => 'li'], ['decorated' => false]); $this->assertStringContainsString('list [options] [--] [<namespace>]', $commandTester->getDisplay(), '->execute() returns a text help for
ommandTester; class HelpCommandTest extends TestCase { public function testExecuteForCommandAlias() { $command = new HelpCommand(); $command->setApplication(new Application()); $commandTester = ne
{ "filepath": "src/Symfony/Component/Console/Tests/Command/HelpCommandTest.php", "language": "php", "file_size": 4797, "cut_index": 614, "middle_length": 229 }
omponent\Console\Completion\CompletionInput; use Symfony\Component\Console\Completion\CompletionSuggestions; use Symfony\Component\Console\Completion\Suggestion; use Symfony\Component\Console\Cursor; use Symfony\Component\Console\Exception\InvalidArgumentException; use Symfony\Component\Console\Exception\InvalidOptionE...
ableTestCommand; use Symfony\Component\Console\Tests\Fixtures\InvokableWithCustomValidatorTestCommand; use Symfony\Component\Console\Tests\Fixtures\InvokableWithInputFileAndConstraintsTestCommand; class InvokableCommandTest extends TestCase { public f
ole\Output\NullOutput; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Console\Tester\CommandTester; use Symfony\Component\Console\Tests\Fixtures\Invok
{ "filepath": "src/Symfony/Component/Console/Tests/Command/InvokableCommandTest.php", "language": "php", "file_size": 25332, "cut_index": 1331, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\ArgumentResolver\ValueResolver; use PHPUnit\Framework\TestCase; use Symfony\Component\Cons...
unction testTimingsInResolve() { $stopwatch = new Stopwatch(); $resolver = new TraceableValueResolver(new ResolverStub(), $stopwatch); $input = new ArrayInput([]); $reflectionParam = new \ReflectionParameter([TestInvokab
on\ReflectionMember; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Stopwatch\Stopwatch; class TraceableValueResolverTest extends TestCase { public f
{ "filepath": "src/Symfony/Component/Console/Tests/ArgumentResolver/ValueResolver/TraceableValueResolverTest.php", "language": "php", "file_size": 2055, "cut_index": 563, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Console\Tests\ArgumentResolver\ValueResolver; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\ArgumentResolver\ValueResolver\UidValueResolver; use Symfony\Component\Console\Attribute\Argument; use Symfony\Component\Console\Attribute\Option; us...
id\Ulid; use Symfony\Component\Uid\Uuid; use Symfony\Component\Uid\UuidV4; class UidValueResolverTest extends TestCase { public function testResolveUuidArgument() { $resolver = new UidValueResolver(); $uuid = '550e8400-e29b-41d4-a7
ion; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\U
{ "filepath": "src/Symfony/Component/Console/Tests/ArgumentResolver/ValueResolver/UidValueResolverTest.php", "language": "php", "file_size": 8143, "cut_index": 716, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Console\Tests\ArgumentResolver\ValueResolver; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\ArgumentResolver\ValueResolver\VariadicValueResolver; use Symfony\Component\Console\Attribute\Argument; use Symfony\Component\Console\Attribute\Optio...
olver(); $input = new ArrayInput(['files' => ['file1.txt', 'file2.txt', 'file3.txt']], new InputDefinition([ new InputArgument('files', InputArgument::IS_ARRAY), ])); $command = new class { public function
\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputOption; class VariadicValueResolverTest extends TestCase { public function testResolveVariadicArgument() { $resolver = new VariadicValueRes
{ "filepath": "src/Symfony/Component/Console/Tests/ArgumentResolver/ValueResolver/VariadicValueResolverTest.php", "language": "php", "file_size": 6301, "cut_index": 716, "middle_length": 229 }
This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Formatter; use PHPUnit\Framework\TestCase; use Symf...
$style->setForeground('black'); $this->assertSame('foo', $style->apply('foo')); } public function testSetBackground() { $style = new NullOutputFormatterStyle(); $style->setBackground('blue'); $this->assertSam
stApply() { $style = new NullOutputFormatterStyle(); $this->assertSame('foo', $style->apply('foo')); } public function testSetForeground() { $style = new NullOutputFormatterStyle();
{ "filepath": "src/Symfony/Component/Console/Tests/Formatter/NullOutputFormatterStyleTest.php", "language": "php", "file_size": 1443, "cut_index": 524, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Formatter; use PHPUnit\Framework\TestCase; use Symfony\Component...
will be destroyed')); } public function testGetStyle() { $formatter = new NullOutputFormatter(); $this->assertInstanceof(NullOutputFormatterStyle::class, $style = $formatter->getStyle('null')); $this->assertSame($style
n Vo <tien.xuan.vo@gmail.com> */ class NullOutputFormatterTest extends TestCase { public function testFormat() { $formatter = new NullOutputFormatter(); $this->assertNull($formatter->format('this message
{ "filepath": "src/Symfony/Component/Console/Tests/Formatter/NullOutputFormatterTest.php", "language": "php", "file_size": 1821, "cut_index": 537, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Formatter; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Formatter\OutputF...
()); $stack->push($s3 = new OutputFormatterStyle('green', 'red')); $this->assertEquals($s3, $stack->getCurrent()); } public function testPop() { $stack = new OutputFormatterStyleStack(); $stack->push($s1 = new
new OutputFormatterStyleStack(); $stack->push($s1 = new OutputFormatterStyle('white', 'black')); $stack->push($s2 = new OutputFormatterStyle('yellow', 'blue')); $this->assertEquals($s2, $stack->getCurrent
{ "filepath": "src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleStackTest.php", "language": "php", "file_size": 2180, "cut_index": 563, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Formatter; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Formatter\OutputFormatterStyle; class OutputFormatterStyleTest exte...
le(null, 'white'); $this->assertEquals("\033[47mfoo\033[49m", $style->apply('foo')); } public function testForeground() { $style = new OutputFormatterStyle(); $style->setForeground('black'); $this->assertEquals
033[39;49;22;24m", $style->apply('foo')); $style = new OutputFormatterStyle('red', null, ['blink']); $this->assertEquals("\033[31;5mfoo\033[39;25m", $style->apply('foo')); $style = new OutputFormatterSty
{ "filepath": "src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php", "language": "php", "file_size": 3914, "cut_index": 614, "middle_length": 229 }
ertEquals('foo<bar', $formatter->format('foo\\<bar')); $this->assertEquals('foo << bar', $formatter->format('foo << bar')); $this->assertEquals('foo << bar \\', $formatter->format('foo << bar \\')); $this->assertEquals("foo << \033[32mbar \\ baz\033[39m \\", $formatter->format('foo << <info>bar ...
hes escaping non-special characters $this->assertEquals('foo \\< bar \\< baz \\\\< foo \\> bar \\> baz \\\\> \\x', OutputFormatter::escape('foo < bar \\< baz \\\\< foo > bar \\> baz \\\\> \\x')); $this->assertEquals( "\033[33mS
utFormatter::escape('<info>some info</info>')); // every < and > gets escaped if not already escaped, but already escaped ones do not get escaped again // and escaped backslashes remain as such, same with backslas
{ "filepath": "src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php", "language": "php", "file_size": 19348, "cut_index": 1331, "middle_length": 229 }
Tests\Fixtures\MethodBasedTestCommand; use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; use Symfony\Component\DependencyInjection\ChildDefinition; use Symfony\Component\DependencyInjection\Compiler\PassConfig; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\De...
ING); $container->setParameter('my-command.class', 'Symfony\Component\Console\Tests\DependencyInjection\MyCommand'); $id = 'my-command'; $definition = new Definition('%my-command.class%'); $definition->setPublic($public);
#[DataProvider('visibilityProvider')] public function testProcess($public) { $container = new ContainerBuilder(); $container->addCompilerPass(new AddConsoleCommandPass(), PassConfig::TYPE_BEFORE_REMOV
{ "filepath": "src/Symfony/Component/Console/Tests/DependencyInjection/AddConsoleCommandPassTest.php", "language": "php", "file_size": 18655, "cut_index": 1331, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\DependencyInjection; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\ArgumentResolver\ArgumentResolver; use Symfony\Component\C...
= [ 'n3' => [[]], 'n1' => [['priority' => 200]], 'n2' => [['priority' => 100]], ]; $expected = [ new Reference('n1'), new Reference('n2'), new Reference('n3'),
nent\DependencyInjection\Reference; use Symfony\Component\Stopwatch\Stopwatch; class ConsoleArgumentValueResolverPassTest extends TestCase { public function testServicesAreOrderedAccordingToPriority() { $services
{ "filepath": "src/Symfony/Component/Console/Tests/DependencyInjection/ConsoleArgumentValueResolverPassTest.php", "language": "php", "file_size": 3454, "cut_index": 614, "middle_length": 229 }
erInterface; use Symfony\Component\Console\DependencyInjection\RegisterCommandArgumentLocatorsPass; use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Ex...
$this->assertTrue(true); } public function testProcessWithServiceArguments() { $container = new ContainerBuilder(); $container->register('logger', LoggerInterface::class); $container->register('console.argument_resolv
extends TestCase { public function testProcessWithoutServiceResolver() { $container = new ContainerBuilder(); $pass = new RegisterCommandArgumentLocatorsPass(); $pass->process($container);
{ "filepath": "src/Symfony/Component/Console/Tests/DependencyInjection/RegisterCommandArgumentLocatorsPassTest.php", "language": "php", "file_size": 10264, "cut_index": 921, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Console\Tests\DependencyInjection; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\DependencyInjection\RemoveEmptyCommandArgumentLocatorsPass; use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; use Symfony\Component\Dep...
tLocatorsPass(); $pass->process($container); $this->assertTrue(true); } public function testProcessWithNullArgument() { $container = new ContainerBuilder(); $container->register('console.argument_resolver.serv
ocator; class RemoveEmptyCommandArgumentLocatorsPassTest extends TestCase { public function testProcessWithoutServiceResolver() { $container = new ContainerBuilder(); $pass = new RemoveEmptyCommandArgumen
{ "filepath": "src/Symfony/Component/Console/Tests/DependencyInjection/RemoveEmptyCommandArgumentLocatorsPassTest.php", "language": "php", "file_size": 5329, "cut_index": 716, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\CommandLoader; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Command\Comma...
'bar-service' => static fn () => new Command('bar'), ]), ['foo' => 'foo-service', 'bar' => 'bar-service']); $this->assertTrue($loader->has('foo')); $this->assertTrue($loader->has('bar')); $this->assertFalse($loader->
or; class ContainerCommandLoaderTest extends TestCase { public function testHas() { $loader = new ContainerCommandLoader(new ServiceLocator([ 'foo-service' => static fn () => new Command('foo'),
{ "filepath": "src/Symfony/Component/Console/Tests/CommandLoader/ContainerCommandLoaderTest.php", "language": "php", "file_size": 2101, "cut_index": 563, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\CommandLoader; use PHPUnit\Framework\TestCase; use Symfony\Compo...
$this->assertTrue($loader->has('foo')); $this->assertTrue($loader->has('bar')); $this->assertFalse($loader->has('baz')); } public function testGet() { $loader = new FactoryCommandLoader([ 'foo' => st
t extends TestCase { public function testHas() { $loader = new FactoryCommandLoader([ 'foo' => static fn () => new Command('foo'), 'bar' => static fn () => new Command('bar'), ]);
{ "filepath": "src/Symfony/Component/Console/Tests/CommandLoader/FactoryCommandLoaderTest.php", "language": "php", "file_size": 1749, "cut_index": 537, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Output; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use...
($corlorHex)); } #[DataProvider('provideColorsConversion')] public function testColorsConversionToAnsi8(string $corlorHex, array $expected) { $this->assertSame('8;5;'.$expected[AnsiColorMode::Ansi8->name], AnsiColorMode::Ansi8->con
Conversion')] public function testColorsConversionToAnsi4(string $corlorHex, array $expected) { $this->assertSame((string) $expected[AnsiColorMode::Ansi4->name], AnsiColorMode::Ansi4->convertFromHexToAnsiColorCode
{ "filepath": "src/Symfony/Component/Console/Tests/Output/AnsiColorModeTest.php", "language": "php", "file_size": 2834, "cut_index": 563, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Output; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Formatter\OutputForm...
$this->assertNotSame($output->getFormatter(), $output->getErrorOutput()->getFormatter(), 'ErrorOutput should use it own formatter'); } public function testConstructorWithFormatter() { $output = new ConsoleOutput(Output::VERBOSITY_QUIE
rmatter() { $output = new ConsoleOutput(Output::VERBOSITY_QUIET, true); $this->assertEquals(Output::VERBOSITY_QUIET, $output->getVerbosity(), '__construct() takes the verbosity as its first argument');
{ "filepath": "src/Symfony/Component/Console/Tests/Output/ConsoleOutputTest.php", "language": "php", "file_size": 2027, "cut_index": 563, "middle_length": 229 }
elper\QuestionHelper; use Symfony\Component\Console\Input\StreamableInputInterface; use Symfony\Component\Console\Output\ConsoleSectionOutput; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\StreamOutput; use Symfony\Component\Console\Question\Question; class ConsoleSectionOu...
RBOSITY_NORMAL, true, new OutputFormatter()); $output->writeln('Foo'.\PHP_EOL.'Bar'); $output->clear(); rewind($output->getStream()); $this->assertEquals('Foo'.\PHP_EOL.'Bar'.\PHP_EOL.\sprintf("\x1b[%dA", 2)."\x1b[0J", str
tected function tearDown(): void { unset($this->stream); } public function testClearAll() { $sections = []; $output = new ConsoleSectionOutput($this->stream, $sections, OutputInterface::VE
{ "filepath": "src/Symfony/Component/Console/Tests/Output/ConsoleSectionOutputTest.php", "language": "php", "file_size": 13215, "cut_index": 921, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Output; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Formatter\NullOutput...
; $this->assertSame('', $buffer, '->write() does nothing (at least nothing is printed)'); $this->assertFalse($output->isDecorated(), '->isDecorated() returns false'); } public function testVerbosity() { $output = new N
Output\OutputInterface; class NullOutputTest extends TestCase { public function testConstructor() { $output = new NullOutput(); ob_start(); $output->write('foo'); $buffer = ob_get_clean()
{ "filepath": "src/Symfony/Component/Console/Tests/Output/NullOutputTest.php", "language": "php", "file_size": 3033, "cut_index": 563, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Console\Tests\Output; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Formatter\OutputFormatterStyle; use Symfony\Component\Console\Output\Output; class OutputTest extends TestCase { public f...
= new TestOutput(); $output->setDecorated(true); $this->assertTrue($output->isDecorated(), 'setDecorated() sets the decorated flag'); } public function testSetGetVerbosity() { $output = new TestOutput(); $output
kes the verbosity as its first argument'); $this->assertTrue($output->isDecorated(), '__construct() takes the decorated flag as its second argument'); } public function testSetIsDecorated() { $output
{ "filepath": "src/Symfony/Component/Console/Tests/Output/OutputTest.php", "language": "php", "file_size": 6959, "cut_index": 716, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Output; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Output\Output; use S...
$output = new StreamOutput($this->stream, Output::VERBOSITY_QUIET, true); $this->assertEquals(Output::VERBOSITY_QUIET, $output->getVerbosity(), '__construct() takes the verbosity as its first argument'); $this->assertTrue($output->isDecorat
unction setUp(): void { $this->stream = fopen('php://memory', 'a', false); } protected function tearDown(): void { unset($this->stream); } public function testConstructor() {
{ "filepath": "src/Symfony/Component/Console/Tests/Output/StreamOutputTest.php", "language": "php", "file_size": 2494, "cut_index": 563, "middle_length": 229 }
/* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Event; use Symfony\Component\Console\Command\Comman...
ExitCode(int $exitCode): void { if ($exitCode < 0 || $exitCode > 255) { throw new \InvalidArgumentException('Exit code must be between 0 and 255.'); } $this->exitCode = $exitCode; } public function abortExi
ct( Command $command, InputInterface $input, OutputInterface $output, private int|false $exitCode = 0, ) { parent::__construct($command, $input, $output); } public function set
{ "filepath": "src/Symfony/Component/Console/Event/ConsoleAlarmEvent.php", "language": "php", "file_size": 1150, "cut_index": 518, "middle_length": 229 }
This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Event; /** * Allows to do things before the command is e...
3; /** * Indicates if the command should be run or skipped. */ private bool $commandShouldRun = true; /** * Disables the command, so it won't be run. */ public function disableCommand(): bool { return $this
en@symfony.com> */ final class ConsoleCommandEvent extends ConsoleEvent { /** * The return code for skipped commands, this will also be passed into the terminate event. */ public const RETURN_CODE_DISABLED = 11
{ "filepath": "src/Symfony/Component/Console/Event/ConsoleCommandEvent.php", "language": "php", "file_size": 1326, "cut_index": 524, "middle_length": 229 }
This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Event; use Symfony\Component\Console\Command\Command; use...
rowable $error, ?Command $command = null, ) { parent::__construct($command, $input, $output); } public function getError(): \Throwable { return $this->error; } public function setError(\Throwable $error): v
de Jong <wouter@wouterj.nl> */ final class ConsoleErrorEvent extends ConsoleEvent { private int $exitCode; public function __construct( InputInterface $input, OutputInterface $output, private \Th
{ "filepath": "src/Symfony/Component/Console/Event/ConsoleErrorEvent.php", "language": "php", "file_size": 1460, "cut_index": 524, "middle_length": 229 }
/* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Event; use Symfony\Component\Console\Command\Comman...
vate OutputInterface $output, ) { } /** * Gets the command that is executed. */ public function getCommand(): ?Command { return $this->command; } /** * Gets the input instance. */ public functio
tput of a command. * * @author Francesco Levorato <git@flevour.net> */ class ConsoleEvent extends Event { public function __construct( protected ?Command $command, private InputInterface $input, pri
{ "filepath": "src/Symfony/Component/Console/Event/ConsoleEvent.php", "language": "php", "file_size": 1216, "cut_index": 518, "middle_length": 229 }
This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Event; use Symfony\Component\Console\Command\Command; use...
) { parent::__construct($command, $input, $output); } public function getHandlingSignal(): int { return $this->handlingSignal; } public function setExitCode(int $exitCode): void { if ($exitCode < 0 || $exit
extends ConsoleEvent { public function __construct( Command $command, InputInterface $input, OutputInterface $output, private int $handlingSignal, private int|false $exitCode = 0,
{ "filepath": "src/Symfony/Component/Console/Event/ConsoleSignalEvent.php", "language": "php", "file_size": 1342, "cut_index": 524, "middle_length": 229 }
/* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Event; use Symfony\Component\Console\Command\Comman...
ace $input, OutputInterface $output, private int $exitCode, private readonly ?int $interruptingSignal = null, ) { parent::__construct($command, $input, $output); } public function setExitCode(int $exitCode): voi
@author Francesco Levorato <git@flevour.net> * @author Jules Pietri <jules@heahprod.com> */ final class ConsoleTerminateEvent extends ConsoleEvent { public function __construct( Command $command, InputInterf
{ "filepath": "src/Symfony/Component/Console/Event/ConsoleTerminateEvent.php", "language": "php", "file_size": 1245, "cut_index": 518, "middle_length": 229 }
n Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Event; use Symfony\Contracts\EventDispatcher\Event; /** * Event dispatched when constraint validation is needed f...
ly array $constraints, ) { } public function addViolation(string $message): void { $this->violations[] = $message; } public function getViolations(): array { return $this->violations; } public function
public readonly mixed $value, public readon
{ "filepath": "src/Symfony/Component/Console/Event/QuestionAnsweredEvent.php", "language": "php", "file_size": 968, "cut_index": 582, "middle_length": 52 }
* * Usage: * * $input = new ArgvInput(); * * By default, the `$_SERVER['argv']` array is used for the input values. * * This can be overridden by explicitly passing the input values in the constructor: * * $input = new ArgvInput($_SERVER['argv']); * * If you pass it yourself, don't forget that the f...
://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap12.html#tag_12_02 */ class ArgvInput extends Input { /** @var list<string> */ private array $tokens; private array $parsed; /** @param list<string>|null $argv */ public functi
always better to use the * `StringInput` when you want to provide your own input. * * @author Fabien Potencier <fabien@symfony.com> * * @see http://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html * @see http
{ "filepath": "src/Symfony/Component/Console/Input/ArgvInput.php", "language": "php", "file_size": 13469, "cut_index": 921, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Console\Input; use Symfony\Component\Console\Exception\InvalidArgumentException; use Symfony\Component\Console\Exception\InvalidOptionException; /** * ArrayInput represents an input provided as an array. * * Usage: * * $input = new ArrayInput(['co...
$value) { if ($param && \is_string($param) && '-' === $param[0]) { continue; } return $value; } return null; } public function hasParameterOption(string|array $values, bool $onl
ivate array $parameters, ?InputDefinition $definition = null, ) { parent::__construct($definition); } public function getFirstArgument(): ?string { foreach ($this->parameters as $param =>
{ "filepath": "src/Symfony/Component/Console/Input/ArrayInput.php", "language": "php", "file_size": 5585, "cut_index": 716, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Console\Input; use Symfony\Component\Console\Exception\InvalidArgumentException; use Symfony\Component\Console\Exception\RuntimeException; /** * Input is the base class for all concrete Input classes. * * Three concrete classes are provided by default: ...
$options = []; protected array $arguments = []; protected bool $interactive = true; public function __construct(?InputDefinition $definition = null) { if (null === $definition) { $this->definition = new InputDefinition
abien Potencier <fabien@symfony.com> */ abstract class Input implements RawInputInterface, StreamableInputInterface { protected InputDefinition $definition; /** @var resource */ protected $stream; protected array
{ "filepath": "src/Symfony/Component/Console/Input/Input.php", "language": "php", "file_size": 6186, "cut_index": 716, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Console\Input; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Completion\CompletionInput; use Symfony\Component\Console\Completion\CompletionSuggestions; use Symfony\Component\Console\Completion\Suggestion; use Symfony\Componen...
app:foo bar' are both allowed). This is the default behavior of arguments. */ public const OPTIONAL = 2; /** * The argument accepts multiple values and turn them into an array (e.g. 'app:foo bar baz' will result in value ['bar', 'baz']).
.com> */ class InputArgument { /** * Providing an argument is required (e.g. just 'app:foo' is not allowed). */ public const REQUIRED = 1; /** * Providing an argument is optional (e.g. 'app:foo' and '
{ "filepath": "src/Symfony/Component/Console/Input/InputArgument.php", "language": "php", "file_size": 5376, "cut_index": 716, "middle_length": 229 }
* A InputDefinition represents a set of valid command line arguments and options. * * Usage: * * $definition = new InputDefinition([ * new InputArgument('name', InputArgument::REQUIRED), * new InputOption('foo', 'f', InputOption::VALUE_REQUIRED), * ]); * * @author Fabien Potencier <fab...
*/ public function __construct(array $definition = []) { $this->setDefinition($definition); } /** * Sets the definition of the input. */ public function setDefinition(array $definition): void { $argu
ment $lastOptionalArgument = null; private array $options = []; private array $negations = []; private array $shortcuts = []; /** * @param array $definition An array of InputArgument and InputOption instance
{ "filepath": "src/Symfony/Component/Console/Input/InputDefinition.php", "language": "php", "file_size": 11804, "cut_index": 921, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Command; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Tester\CommandTester; u...
h.'/FooLockCommand.php'; require_once self::$fixturesPath.'/FooLock2Command.php'; require_once self::$fixturesPath.'/FooLock3Command.php'; require_once self::$fixturesPath.'/FooLock4InvokableCommand.php'; } public function
ableTraitTest extends TestCase { protected static string $fixturesPath; public static function setUpBeforeClass(): void { self::$fixturesPath = __DIR__.'/../Fixtures/'; require_once self::$fixturesPat
{ "filepath": "src/Symfony/Component/Console/Tests/Command/LockableTraitTest.php", "language": "php", "file_size": 3274, "cut_index": 614, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Command; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Application; use Symfony\Component\Console\Command\TraceableCommand; u...
{ $this->application = new Application(); $this->application->addCommand(new LoopExampleCommand()); $this->application->addCommand(new InvokableTestCommand()); } public function testRunIsOverriddenWithoutProfile() {
Symfony\Component\Console\Tests\Fixtures\LoopExampleCommand; use Symfony\Component\Stopwatch\Stopwatch; class TraceableCommandTest extends TestCase { private Application $application; protected function setUp(): void
{ "filepath": "src/Symfony/Component/Console/Tests/Command/TraceableCommandTest.php", "language": "php", "file_size": 4254, "cut_index": 614, "middle_length": 229 }
$this->assertSame($expectedOptions, $input->getOptions(), $message); } #[DataProvider('provideNegatableOptions')] public function testParseOptionsNegatable($input, $options, $expectedOptions, $message) { $input = new ArgvInput($input); $input->bind(new InputDefinition($options)); ...
[new InputOption('foo', 'f', InputOption::VALUE_REQUIRED)], ['foo' => 'bar'], '->parse() parses long options with a required value (with a = separator)', ], [ ['cli.php', '--foo'
-foo'], [new InputOption('foo')], ['foo' => true], '->parse() parses long options without a value', ], [ ['cli.php', '--foo=bar'],
{ "filepath": "src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php", "language": "php", "file_size": 38074, "cut_index": 2151, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Console\Tests\Input; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\Attributes\IgnoreDeprecations; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Completion\CompletionInput; use Symfony\Component\Console\Completion\CompletionSu...
public function testModes() { $argument = new InputArgument('foo'); $this->assertFalse($argument->isRequired(), '__construct() gives a "InputArgument::OPTIONAL" mode by default'); $argument = new InputArgument('foo', null);
est extends TestCase { public function testConstructor() { $argument = new InputArgument('foo'); $this->assertSame('foo', $argument->getName(), '__construct() takes a name as its first argument'); }
{ "filepath": "src/Symfony/Component/Console/Tests/Input/InputArgumentTest.php", "language": "php", "file_size": 7131, "cut_index": 716, "middle_length": 229 }
gnoreDeprecations; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Completion\CompletionInput; use Symfony\Component\Console\Completion\CompletionSuggestions; use Symfony\Component\Console\Completion\Suggestion; use Symfony\Component\Console\Exception\LogicException; use Symfony\Component\Console\Input\In...
unction testArrayModeWithoutValue() { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('Impossible to have an option mode VALUE_IS_ARRAY if the option does not accept a value.'); new InputO
'__construct() takes a name as its first argument'); $option = new InputOption('--foo'); $this->assertSame('foo', $option->getName(), '__construct() removes the leading -- of the option name'); } public f
{ "filepath": "src/Symfony/Component/Console/Tests/Input/InputOptionTest.php", "language": "php", "file_size": 15121, "cut_index": 921, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Console\Tests\Input; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputOption; cl...
new InputOption('name')])); $this->assertSame('foo', $input->getOption('name'), '->getOption() returns the value for the given option'); $input->setOption('name', 'bar'); $this->assertSame('bar', $input->getOption('name'), '->setOp
->assertSame('foo', $input->getArgument('name'), '->__construct() takes a InputDefinition as an argument'); } public function testOptions() { $input = new ArrayInput(['--name' => 'foo'], new InputDefinition([
{ "filepath": "src/Symfony/Component/Console/Tests/Input/InputTest.php", "language": "php", "file_size": 8327, "cut_index": 716, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\CI; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Sym...
; self::assertTrue(GithubActionReporter::isGithubActionEnvironment()); } finally { putenv('GITHUB_ACTIONS'.($prev ? "=$prev" : '')); } } #[DataProvider('annotationsFormatProvider')] public function testA
vironment() { $prev = getenv('GITHUB_ACTIONS'); putenv('GITHUB_ACTIONS'); try { self::assertFalse(GithubActionReporter::isGithubActionEnvironment()); putenv('GITHUB_ACTIONS=1')
{ "filepath": "src/Symfony/Component/Console/Tests/CI/GithubActionReporterTest.php", "language": "php", "file_size": 2606, "cut_index": 563, "middle_length": 229 }
he Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Completion\Output; use Symfony\Component\Console\Completion\Output\BashCom...
rn new BashCompletionOutput(); } public function getExpectedOptionsOutput(): string { return "--option1\n--negatable\n--no-negatable".\PHP_EOL; } public function getExpectedValuesOutput(): string { return "Green\nR
tput(): CompletionOutputInterface { retu
{ "filepath": "src/Symfony/Component/Console/Tests/Completion/Output/BashCompletionOutputTest.php", "language": "php", "file_size": 885, "cut_index": 547, "middle_length": 52 }
n Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Completion\Output; use Symfony\Component\Console\Completion\Output\CompletionOutputInterface; use Symfony\Com...
} public function getExpectedOptionsOutput(): string { return "--option1\tFirst Option\n--negatable\tCan be negative\n--no-negatable\tCan be negative"; } public function getExpectedValuesOutput(): string { return "Gree
{ return new FishCompletionOutput();
{ "filepath": "src/Symfony/Component/Console/Tests/Completion/Output/FishCompletionOutputTest.php", "language": "php", "file_size": 967, "cut_index": 582, "middle_length": 52 }
n Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Completion\Output; use Symfony\Component\Console\Completion\Output\CompletionOutputInterface; use Symfony\Com...
public function getExpectedOptionsOutput(): string { return "--option1\tFirst Option\n--negatable\tCan be negative\n--no-negatable\tCan be negative\n"; } public function getExpectedValuesOutput(): string { return "Green
{ return new ZshCompletionOutput(); }
{ "filepath": "src/Symfony/Component/Console/Tests/Completion/Output/ZshCompletionOutputTest.php", "language": "php", "file_size": 968, "cut_index": 582, "middle_length": 52 }