ÿØÿà JFIF    ÿÛ „ ( %!1!%*+...983,7(-.- PKǼ ]0AC5C5 Getopt.phpnu[ * @license http://opensource.org/licenses/bsd-license.php BSD-2-Clause * @version CVS: $Id$ * @link http://pear.php.net/package/Console_Getopt */ require_once 'PEAR.php'; /** * Command-line options parsing class. * * @category Console * @package Console_Getopt * @author Andrei Zmievski * @license http://opensource.org/licenses/bsd-license.php BSD-2-Clause * @link http://pear.php.net/package/Console_Getopt */ class Console_Getopt { /** * Parses the command-line options. * * The first parameter to this function should be the list of command-line * arguments without the leading reference to the running program. * * The second parameter is a string of allowed short options. Each of the * option letters can be followed by a colon ':' to specify that the option * requires an argument, or a double colon '::' to specify that the option * takes an optional argument. * * The third argument is an optional array of allowed long options. The * leading '--' should not be included in the option name. Options that * require an argument should be followed by '=', and options that take an * option argument should be followed by '=='. * * The return value is an array of two elements: the list of parsed * options and the list of non-option command-line arguments. Each entry in * the list of parsed options is a pair of elements - the first one * specifies the option, and the second one specifies the option argument, * if there was one. * * Long and short options can be mixed. * * Most of the semantics of this function are based on GNU getopt_long(). * * @param array $args an array of command-line arguments * @param string $short_options specifies the list of allowed short options * @param array $long_options specifies the list of allowed long options * @param boolean $skip_unknown suppresses Console_Getopt: unrecognized option * * @return array two-element array containing the list of parsed options and * the non-option arguments */ public static function getopt2($args, $short_options, $long_options = null, $skip_unknown = false) { return Console_Getopt::doGetopt(2, $args, $short_options, $long_options, $skip_unknown); } /** * This function expects $args to start with the script name (POSIX-style). * Preserved for backwards compatibility. * * @param array $args an array of command-line arguments * @param string $short_options specifies the list of allowed short options * @param array $long_options specifies the list of allowed long options * * @see getopt2() * @return array two-element array containing the list of parsed options and * the non-option arguments */ public static function getopt($args, $short_options, $long_options = null, $skip_unknown = false) { return Console_Getopt::doGetopt(1, $args, $short_options, $long_options, $skip_unknown); } /** * The actual implementation of the argument parsing code. * * @param int $version Version to use * @param array $args an array of command-line arguments * @param string $short_options specifies the list of allowed short options * @param array $long_options specifies the list of allowed long options * @param boolean $skip_unknown suppresses Console_Getopt: unrecognized option * * @return array */ public static function doGetopt($version, $args, $short_options, $long_options = null, $skip_unknown = false) { // in case you pass directly readPHPArgv() as the first arg if (PEAR::isError($args)) { return $args; } if (empty($args)) { return array(array(), array()); } $non_opts = $opts = array(); settype($args, 'array'); if ($long_options) { sort($long_options); } /* * Preserve backwards compatibility with callers that relied on * erroneous POSIX fix. */ if ($version < 2) { if (isset($args[0][0]) && $args[0][0] != '-') { array_shift($args); } } for ($i = 0; $i < count($args); $i++) { $arg = $args[$i]; /* The special element '--' means explicit end of options. Treat the rest of the arguments as non-options and end the loop. */ if ($arg == '--') { $non_opts = array_merge($non_opts, array_slice($args, $i + 1)); break; } if ($arg[0] != '-' || (strlen($arg) > 1 && $arg[1] == '-' && !$long_options)) { $non_opts = array_merge($non_opts, array_slice($args, $i)); break; } elseif (strlen($arg) > 1 && $arg[1] == '-') { $error = Console_Getopt::_parseLongOption(substr($arg, 2), $long_options, $opts, $i, $args, $skip_unknown); if (PEAR::isError($error)) { return $error; } } elseif ($arg == '-') { // - is stdin $non_opts = array_merge($non_opts, array_slice($args, $i)); break; } else { $error = Console_Getopt::_parseShortOption(substr($arg, 1), $short_options, $opts, $i, $args, $skip_unknown); if (PEAR::isError($error)) { return $error; } } } return array($opts, $non_opts); } /** * Parse short option * * @param string $arg Argument * @param string[] $short_options Available short options * @param string[][] &$opts * @param int &$argIdx * @param string[] $args * @param boolean $skip_unknown suppresses Console_Getopt: unrecognized option * * @return void */ protected static function _parseShortOption($arg, $short_options, &$opts, &$argIdx, $args, $skip_unknown) { for ($i = 0; $i < strlen($arg); $i++) { $opt = $arg[$i]; $opt_arg = null; /* Try to find the short option in the specifier string. */ if (($spec = strstr($short_options, $opt)) === false || $arg[$i] == ':') { if ($skip_unknown === true) { break; } $msg = "Console_Getopt: unrecognized option -- $opt"; return PEAR::raiseError($msg); } if (strlen($spec) > 1 && $spec[1] == ':') { if (strlen($spec) > 2 && $spec[2] == ':') { if ($i + 1 < strlen($arg)) { /* Option takes an optional argument. Use the remainder of the arg string if there is anything left. */ $opts[] = array($opt, substr($arg, $i + 1)); break; } } else { /* Option requires an argument. Use the remainder of the arg string if there is anything left. */ if ($i + 1 < strlen($arg)) { $opts[] = array($opt, substr($arg, $i + 1)); break; } else if (isset($args[++$argIdx])) { $opt_arg = $args[$argIdx]; /* Else use the next argument. */; if (Console_Getopt::_isShortOpt($opt_arg) || Console_Getopt::_isLongOpt($opt_arg)) { $msg = "option requires an argument --$opt"; return PEAR::raiseError("Console_Getopt: " . $msg); } } else { $msg = "option requires an argument --$opt"; return PEAR::raiseError("Console_Getopt: " . $msg); } } } $opts[] = array($opt, $opt_arg); } } /** * Checks if an argument is a short option * * @param string $arg Argument to check * * @return bool */ protected static function _isShortOpt($arg) { return strlen($arg) == 2 && $arg[0] == '-' && preg_match('/[a-zA-Z]/', $arg[1]); } /** * Checks if an argument is a long option * * @param string $arg Argument to check * * @return bool */ protected static function _isLongOpt($arg) { return strlen($arg) > 2 && $arg[0] == '-' && $arg[1] == '-' && preg_match('/[a-zA-Z]+$/', substr($arg, 2)); } /** * Parse long option * * @param string $arg Argument * @param string[] $long_options Available long options * @param string[][] &$opts * @param int &$argIdx * @param string[] $args * * @return void|PEAR_Error */ protected static function _parseLongOption($arg, $long_options, &$opts, &$argIdx, $args, $skip_unknown) { @list($opt, $opt_arg) = explode('=', $arg, 2); $opt_len = strlen($opt); for ($i = 0; $i < count($long_options); $i++) { $long_opt = $long_options[$i]; $opt_start = substr($long_opt, 0, $opt_len); $long_opt_name = str_replace('=', '', $long_opt); /* Option doesn't match. Go on to the next one. */ if ($long_opt_name != $opt) { continue; } $opt_rest = substr($long_opt, $opt_len); /* Check that the options uniquely matches one of the allowed options. */ if ($i + 1 < count($long_options)) { $next_option_rest = substr($long_options[$i + 1], $opt_len); } else { $next_option_rest = ''; } if ($opt_rest != '' && $opt[0] != '=' && $i + 1 < count($long_options) && $opt == substr($long_options[$i+1], 0, $opt_len) && $next_option_rest != '' && $next_option_rest[0] != '=') { $msg = "Console_Getopt: option --$opt is ambiguous"; return PEAR::raiseError($msg); } if (substr($long_opt, -1) == '=') { if (substr($long_opt, -2) != '==') { /* Long option requires an argument. Take the next argument if one wasn't specified. */; if (!strlen($opt_arg)) { if (!isset($args[++$argIdx])) { $msg = "Console_Getopt: option requires an argument --$opt"; return PEAR::raiseError($msg); } $opt_arg = $args[$argIdx]; } if (Console_Getopt::_isShortOpt($opt_arg) || Console_Getopt::_isLongOpt($opt_arg)) { $msg = "Console_Getopt: option requires an argument --$opt"; return PEAR::raiseError($msg); } } } else if ($opt_arg) { $msg = "Console_Getopt: option --$opt doesn't allow an argument"; return PEAR::raiseError($msg); } $opts[] = array('--' . $opt, $opt_arg); return; } if ($skip_unknown === true) { return; } return PEAR::raiseError("Console_Getopt: unrecognized option --$opt"); } /** * Safely read the $argv PHP array across different PHP configurations. * Will take care on register_globals and register_argc_argv ini directives * * @return mixed the $argv PHP array or PEAR error if not registered */ public static function readPHPArgv() { global $argv; if (!is_array($argv)) { if (!@is_array($_SERVER['argv'])) { if (!@is_array($GLOBALS['HTTP_SERVER_VARS']['argv'])) { $msg = "Could not read cmd args (register_argc_argv=Off?)"; return PEAR::raiseError("Console_Getopt: " . $msg); } return $GLOBALS['HTTP_SERVER_VARS']['argv']; } return $_SERVER['argv']; } return $argv; } } PK.j]1HDDDESymfony/Component/Console/Tests/Descriptor/MarkdownDescriptorTest.phpnu[ * * 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 Symfony\Component\Console\Descriptor\MarkdownDescriptor; class MarkdownDescriptorTest extends AbstractDescriptorTest { protected function getDescriptor() { return new MarkdownDescriptor(); } protected function getFormat() { return 'md'; } } PK.j]ž_J J >Symfony/Component/Console/Tests/Descriptor/ObjectsProvider.phpnu[ * * 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 Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Tests\Fixtures\DescriptorApplication1; use Symfony\Component\Console\Tests\Fixtures\DescriptorApplication2; use Symfony\Component\Console\Tests\Fixtures\DescriptorCommand1; use Symfony\Component\Console\Tests\Fixtures\DescriptorCommand2; /** * @author Jean-François Simon */ class ObjectsProvider { public static function getInputArguments() { return array( 'input_argument_1' => new InputArgument('argument_name', InputArgument::REQUIRED), 'input_argument_2' => new InputArgument('argument_name', InputArgument::IS_ARRAY, 'argument description'), 'input_argument_3' => new InputArgument('argument_name', InputArgument::OPTIONAL, 'argument description', 'default_value'), ); } public static function getInputOptions() { return array( 'input_option_1' => new InputOption('option_name', 'o', InputOption::VALUE_NONE), 'input_option_2' => new InputOption('option_name', 'o', InputOption::VALUE_OPTIONAL, 'option description', 'default_value'), 'input_option_3' => new InputOption('option_name', 'o', InputOption::VALUE_REQUIRED, 'option description'), 'input_option_4' => new InputOption('option_name', 'o', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, 'option description', array()), ); } public static function getInputDefinitions() { return array( 'input_definition_1' => new InputDefinition(), 'input_definition_2' => new InputDefinition(array(new InputArgument('argument_name', InputArgument::REQUIRED))), 'input_definition_3' => new InputDefinition(array(new InputOption('option_name', 'o', InputOption::VALUE_NONE))), 'input_definition_4' => new InputDefinition(array( new InputArgument('argument_name', InputArgument::REQUIRED), new InputOption('option_name', 'o', InputOption::VALUE_NONE), )), ); } public static function getCommands() { return array( 'command_1' => new DescriptorCommand1(), 'command_2' => new DescriptorCommand2(), ); } public static function getApplications() { return array( 'application_1' => new DescriptorApplication1(), 'application_2' => new DescriptorApplication2(), ); } } PK.j]} ESymfony/Component/Console/Tests/Descriptor/AbstractDescriptorTest.phpnu[ * * 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 Symfony\Component\Console\Application; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\BufferedOutput; abstract class AbstractDescriptorTest extends \PHPUnit_Framework_TestCase { /** @dataProvider getDescribeInputArgumentTestData */ public function testDescribeInputArgument(InputArgument $argument, $expectedDescription) { $this->assertDescription($expectedDescription, $argument); } /** @dataProvider getDescribeInputOptionTestData */ public function testDescribeInputOption(InputOption $option, $expectedDescription) { $this->assertDescription($expectedDescription, $option); } /** @dataProvider getDescribeInputDefinitionTestData */ public function testDescribeInputDefinition(InputDefinition $definition, $expectedDescription) { $this->assertDescription($expectedDescription, $definition); } /** @dataProvider getDescribeCommandTestData */ public function testDescribeCommand(Command $command, $expectedDescription) { $this->assertDescription($expectedDescription, $command); } /** @dataProvider getDescribeApplicationTestData */ public function testDescribeApplication(Application $application, $expectedDescription) { // Replaces the dynamic placeholders of the command help text with a static version. // The placeholder %command.full_name% includes the script path that is not predictable // and can not be tested against. foreach ($application->all() as $command) { $command->setHelp(str_replace('%command.full_name%', 'app/console %command.name%', $command->getHelp())); } $this->assertDescription($expectedDescription, $application); } public function getDescribeInputArgumentTestData() { return $this->getDescriptionTestData(ObjectsProvider::getInputArguments()); } public function getDescribeInputOptionTestData() { return $this->getDescriptionTestData(ObjectsProvider::getInputOptions()); } public function getDescribeInputDefinitionTestData() { return $this->getDescriptionTestData(ObjectsProvider::getInputDefinitions()); } public function getDescribeCommandTestData() { return $this->getDescriptionTestData(ObjectsProvider::getCommands()); } public function getDescribeApplicationTestData() { return $this->getDescriptionTestData(ObjectsProvider::getApplications()); } abstract protected function getDescriptor(); abstract protected function getFormat(); private function getDescriptionTestData(array $objects) { $data = array(); foreach ($objects as $name => $object) { $description = file_get_contents(sprintf('%s/../Fixtures/%s.%s', __DIR__, $name, $this->getFormat())); $data[] = array($object, $description); } return $data; } private function assertDescription($expectedDescription, $describedObject) { $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true); $this->getDescriptor()->describe($output, $describedObject, array('raw_output' => true)); $this->assertEquals(trim($expectedDescription), trim(str_replace(PHP_EOL, "\n", $output->fetch()))); } } PK.j]K 99ASymfony/Component/Console/Tests/Descriptor/TextDescriptorTest.phpnu[ * * 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 Symfony\Component\Console\Descriptor\TextDescriptor; class TextDescriptorTest extends AbstractDescriptorTest { protected function getDescriptor() { return new TextDescriptor(); } protected function getFormat() { return 'txt'; } } PK.j]66@Symfony/Component/Console/Tests/Descriptor/XmlDescriptorTest.phpnu[ * * 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 Symfony\Component\Console\Descriptor\XmlDescriptor; class XmlDescriptorTest extends AbstractDescriptorTest { protected function getDescriptor() { return new XmlDescriptor(); } protected function getFormat() { return 'xml'; } } PK.j]oW::ASymfony/Component/Console/Tests/Descriptor/JsonDescriptorTest.phpnu[ * * 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 Symfony\Component\Console\Descriptor\JsonDescriptor; class JsonDescriptorTest extends AbstractDescriptorTest { protected function getDescriptor() { return new JsonDescriptor(); } protected function getFormat() { return 'json'; } } PK.j]gO >Symfony/Component/Console/Tests/Helper/FormatterHelperTest.phpnu[ * * 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 Symfony\Component\Console\Helper\FormatterHelper; class FormatterHelperTest extends \PHPUnit_Framework_TestCase { public function testFormatSection() { $formatter = new FormatterHelper(); $this->assertEquals( '[cli] Some text to display', $formatter->formatSection('cli', 'Some text to display'), '::formatSection() formats a message in a section' ); } public function testFormatBlock() { $formatter = new FormatterHelper(); $this->assertEquals( ' Some text to display ', $formatter->formatBlock('Some text to display', 'error'), '::formatBlock() formats a message in a block' ); $this->assertEquals( ' Some text to display '."\n" . ' foo bar ', $formatter->formatBlock(array('Some text to display', 'foo bar'), 'error'), '::formatBlock() formats a message in a block' ); $this->assertEquals( ' '."\n" . ' Some text to display '."\n" . ' ', $formatter->formatBlock('Some text to display', 'error', true), '::formatBlock() formats a message in a block' ); } public function testFormatBlockWithDiacriticLetters() { if (!extension_loaded('mbstring')) { $this->markTestSkipped('This test requires mbstring to work.'); } $formatter = new FormatterHelper(); $this->assertEquals( ' '."\n" . ' Du texte à afficher '."\n" . ' ', $formatter->formatBlock('Du texte à afficher', 'error', true), '::formatBlock() formats a message in a block' ); } public function testFormatBlockLGEscaping() { $formatter = new FormatterHelper(); $this->assertEquals( ' '."\n" . ' \some info\ '."\n" . ' ', $formatter->formatBlock('some info', 'error', true), '::formatBlock() escapes \'<\' chars' ); } } PK.j]L"";Symfony/Component/Console/Tests/Helper/DialogHelperTest.phpnu[ * * 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 Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Helper\DialogHelper; use Symfony\Component\Console\Helper\HelperSet; use Symfony\Component\Console\Helper\FormatterHelper; use Symfony\Component\Console\Output\StreamOutput; class DialogHelperTest extends \PHPUnit_Framework_TestCase { public function testSelect() { $dialog = new DialogHelper(); $helperSet = new HelperSet(array(new FormatterHelper())); $dialog->setHelperSet($helperSet); $heroes = array('Superman', 'Batman', 'Spiderman'); $dialog->setInputStream($this->getInputStream("\n1\n 1 \nFabien\n1\nFabien\n1\n0,2\n 0 , 2 \n\n\n")); $this->assertEquals('2', $dialog->select($this->getOutputStream(), 'What is your favorite superhero?', $heroes, '2')); $this->assertEquals('1', $dialog->select($this->getOutputStream(), 'What is your favorite superhero?', $heroes)); $this->assertEquals('1', $dialog->select($this->getOutputStream(), 'What is your favorite superhero?', $heroes)); $this->assertEquals('1', $dialog->select($output = $this->getOutputStream(), 'What is your favorite superhero?', $heroes, null, false, 'Input "%s" is not a superhero!', false)); rewind($output->getStream()); $this->assertContains('Input "Fabien" is not a superhero!', stream_get_contents($output->getStream())); try { $this->assertEquals('1', $dialog->select($output = $this->getOutputStream(), 'What is your favorite superhero?', $heroes, null, 1)); $this->fail(); } catch (\InvalidArgumentException $e) { $this->assertEquals('Value "Fabien" is invalid', $e->getMessage()); } $this->assertEquals(array('1'), $dialog->select($this->getOutputStream(), 'What is your favorite superhero?', $heroes, null, false, 'Input "%s" is not a superhero!', true)); $this->assertEquals(array('0', '2'), $dialog->select($this->getOutputStream(), 'What is your favorite superhero?', $heroes, null, false, 'Input "%s" is not a superhero!', true)); $this->assertEquals(array('0', '2'), $dialog->select($this->getOutputStream(), 'What is your favorite superhero?', $heroes, null, false, 'Input "%s" is not a superhero!', true)); $this->assertEquals(array('0', '1'), $dialog->select($this->getOutputStream(), 'What is your favorite superhero?', $heroes, '0,1', false, 'Input "%s" is not a superhero!', true)); $this->assertEquals(array('0', '1'), $dialog->select($this->getOutputStream(), 'What is your favorite superhero?', $heroes, ' 0 , 1 ', false, 'Input "%s" is not a superhero!', true)); } public function testAsk() { $dialog = new DialogHelper(); $dialog->setInputStream($this->getInputStream("\n8AM\n")); $this->assertEquals('2PM', $dialog->ask($this->getOutputStream(), 'What time is it?', '2PM')); $this->assertEquals('8AM', $dialog->ask($output = $this->getOutputStream(), 'What time is it?', '2PM')); rewind($output->getStream()); $this->assertEquals('What time is it?', stream_get_contents($output->getStream())); } public function testAskWithAutocomplete() { if (!$this->hasSttyAvailable()) { $this->markTestSkipped('`stty` is required to test autocomplete functionality'); } // Acm // AcsTest // // // Test // // S // F00oo $inputStream = $this->getInputStream("Acm\nAc\177\177s\tTest\n\n\033[A\033[A\n\033[A\033[A\033[A\033[A\033[A\tTest\n\033[B\nS\177\177\033[B\033[B\nF00\177\177oo\t\n"); $dialog = new DialogHelper(); $dialog->setInputStream($inputStream); $bundles = array('AcmeDemoBundle', 'AsseticBundle', 'SecurityBundle', 'FooBundle'); $this->assertEquals('AcmeDemoBundle', $dialog->ask($this->getOutputStream(), 'Please select a bundle', 'FrameworkBundle', $bundles)); $this->assertEquals('AsseticBundleTest', $dialog->ask($this->getOutputStream(), 'Please select a bundle', 'FrameworkBundle', $bundles)); $this->assertEquals('FrameworkBundle', $dialog->ask($this->getOutputStream(), 'Please select a bundle', 'FrameworkBundle', $bundles)); $this->assertEquals('SecurityBundle', $dialog->ask($this->getOutputStream(), 'Please select a bundle', 'FrameworkBundle', $bundles)); $this->assertEquals('FooBundleTest', $dialog->ask($this->getOutputStream(), 'Please select a bundle', 'FrameworkBundle', $bundles)); $this->assertEquals('AcmeDemoBundle', $dialog->ask($this->getOutputStream(), 'Please select a bundle', 'FrameworkBundle', $bundles)); $this->assertEquals('AsseticBundle', $dialog->ask($this->getOutputStream(), 'Please select a bundle', 'FrameworkBundle', $bundles)); $this->assertEquals('FooBundle', $dialog->ask($this->getOutputStream(), 'Please select a bundle', 'FrameworkBundle', $bundles)); } /** * @group tty */ public function testAskHiddenResponse() { if (defined('PHP_WINDOWS_VERSION_BUILD')) { $this->markTestSkipped('This test is not supported on Windows'); } $dialog = new DialogHelper(); $dialog->setInputStream($this->getInputStream("8AM\n")); $this->assertEquals('8AM', $dialog->askHiddenResponse($this->getOutputStream(), 'What time is it?')); } public function testAskConfirmation() { $dialog = new DialogHelper(); $dialog->setInputStream($this->getInputStream("\n\n")); $this->assertTrue($dialog->askConfirmation($this->getOutputStream(), 'Do you like French fries?')); $this->assertFalse($dialog->askConfirmation($this->getOutputStream(), 'Do you like French fries?', false)); $dialog->setInputStream($this->getInputStream("y\nyes\n")); $this->assertTrue($dialog->askConfirmation($this->getOutputStream(), 'Do you like French fries?', false)); $this->assertTrue($dialog->askConfirmation($this->getOutputStream(), 'Do you like French fries?', false)); $dialog->setInputStream($this->getInputStream("n\nno\n")); $this->assertFalse($dialog->askConfirmation($this->getOutputStream(), 'Do you like French fries?', true)); $this->assertFalse($dialog->askConfirmation($this->getOutputStream(), 'Do you like French fries?', true)); } public function testAskAndValidate() { $dialog = new DialogHelper(); $helperSet = new HelperSet(array(new FormatterHelper())); $dialog->setHelperSet($helperSet); $question ='What color was the white horse of Henry IV?'; $error = 'This is not a color!'; $validator = function ($color) use ($error) { if (!in_array($color, array('white', 'black'))) { throw new \InvalidArgumentException($error); } return $color; }; $dialog->setInputStream($this->getInputStream("\nblack\n")); $this->assertEquals('white', $dialog->askAndValidate($this->getOutputStream(), $question, $validator, 2, 'white')); $this->assertEquals('black', $dialog->askAndValidate($this->getOutputStream(), $question, $validator, 2, 'white')); $dialog->setInputStream($this->getInputStream("green\nyellow\norange\n")); try { $this->assertEquals('white', $dialog->askAndValidate($this->getOutputStream(), $question, $validator, 2, 'white')); $this->fail(); } catch (\InvalidArgumentException $e) { $this->assertEquals($error, $e->getMessage()); } } public function testNoInteraction() { $dialog = new DialogHelper(); $input = new ArrayInput(array()); $input->setInteractive(false); $dialog->setInput($input); $this->assertEquals('not yet', $dialog->ask($this->getOutputStream(), 'Do you have a job?', 'not yet')); } protected function getInputStream($input) { $stream = fopen('php://memory', 'r+', false); fputs($stream, $input); rewind($stream); return $stream; } protected function getOutputStream() { return new StreamOutput(fopen('php://memory', 'r+', false)); } private function hasSttyAvailable() { exec('stty 2>&1', $output, $exitcode); return $exitcode === 0; } } PK.j]+vv8Symfony/Component/Console/Tests/Helper/HelperSetTest.phpnu[ * * 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 Symfony\Component\Console\Helper\HelperSet; use Symfony\Component\Console\Command\Command; class HelperSetTest extends \PHPUnit_Framework_TestCase { /** * @covers \Symfony\Component\Console\Helper\HelperSet::__construct */ public function testConstructor() { $mock_helper = $this->getGenericMockHelper('fake_helper'); $helperset = new HelperSet(array('fake_helper_alias' => $mock_helper)); $this->assertEquals($mock_helper, $helperset->get('fake_helper_alias'), '__construct sets given helper to helpers'); $this->assertTrue($helperset->has('fake_helper_alias'), '__construct sets helper alias for given helper'); } /** * @covers \Symfony\Component\Console\Helper\HelperSet::set */ public function testSet() { $helperset = new HelperSet(); $helperset->set($this->getGenericMockHelper('fake_helper', $helperset)); $this->assertTrue($helperset->has('fake_helper'), '->set() adds helper to helpers'); $helperset = new HelperSet(); $helperset->set($this->getGenericMockHelper('fake_helper_01', $helperset)); $helperset->set($this->getGenericMockHelper('fake_helper_02', $helperset)); $this->assertTrue($helperset->has('fake_helper_01'), '->set() will set multiple helpers on consecutive calls'); $this->assertTrue($helperset->has('fake_helper_02'), '->set() will set multiple helpers on consecutive calls'); $helperset = new HelperSet(); $helperset->set($this->getGenericMockHelper('fake_helper', $helperset), 'fake_helper_alias'); $this->assertTrue($helperset->has('fake_helper'), '->set() adds helper alias when set'); $this->assertTrue($helperset->has('fake_helper_alias'), '->set() adds helper alias when set'); } /** * @covers \Symfony\Component\Console\Helper\HelperSet::has */ public function testHas() { $helperset = new HelperSet(array('fake_helper_alias' => $this->getGenericMockHelper('fake_helper'))); $this->assertTrue($helperset->has('fake_helper'), '->has() finds set helper'); $this->assertTrue($helperset->has('fake_helper_alias'), '->has() finds set helper by alias'); } /** * @covers \Symfony\Component\Console\Helper\HelperSet::get */ public function testGet() { $helper_01 = $this->getGenericMockHelper('fake_helper_01'); $helper_02 = $this->getGenericMockHelper('fake_helper_02'); $helperset = new HelperSet(array('fake_helper_01_alias' => $helper_01, 'fake_helper_02_alias' => $helper_02)); $this->assertEquals($helper_01, $helperset->get('fake_helper_01'), '->get() returns correct helper by name'); $this->assertEquals($helper_01, $helperset->get('fake_helper_01_alias'), '->get() returns correct helper by alias'); $this->assertEquals($helper_02, $helperset->get('fake_helper_02'), '->get() returns correct helper by name'); $this->assertEquals($helper_02, $helperset->get('fake_helper_02_alias'), '->get() returns correct helper by alias'); $helperset = new HelperSet(); try { $helperset->get('foo'); $this->fail('->get() throws \InvalidArgumentException when helper not found'); } catch (\Exception $e) { $this->assertInstanceOf('\InvalidArgumentException', $e, '->get() throws \InvalidArgumentException when helper not found'); $this->assertContains('The helper "foo" is not defined.', $e->getMessage(), '->get() throws \InvalidArgumentException when helper not found'); } } /** * @covers \Symfony\Component\Console\Helper\HelperSet::setCommand */ public function testSetCommand() { $cmd_01 = new Command('foo'); $cmd_02 = new Command('bar'); $helperset = new HelperSet(); $helperset->setCommand($cmd_01); $this->assertEquals($cmd_01, $helperset->getCommand(), '->setCommand() stores given command'); $helperset = new HelperSet(); $helperset->setCommand($cmd_01); $helperset->setCommand($cmd_02); $this->assertEquals($cmd_02, $helperset->getCommand(), '->setCommand() overwrites stored command with consecutive calls'); } /** * @covers \Symfony\Component\Console\Helper\HelperSet::getCommand */ public function testGetCommand() { $cmd = new Command('foo'); $helperset = new HelperSet(); $helperset->setCommand($cmd); $this->assertEquals($cmd, $helperset->getCommand(), '->getCommand() retrieves stored command'); } /** * @covers \Symfony\Component\Console\Helper\HelperSet::getIterator */ public function testIteration() { $helperset = new HelperSet(); $helperset->set($this->getGenericMockHelper('fake_helper_01', $helperset)); $helperset->set($this->getGenericMockHelper('fake_helper_02', $helperset)); $helpers = array('fake_helper_01', 'fake_helper_02'); $i = 0; foreach ($helperset as $helper) { $this->assertEquals($helpers[$i++], $helper->getName()); } } /** * Create a generic mock for the helper interface. Optionally check for a call to setHelperSet with a specific * helperset instance. * * @param string $name * @param HelperSet $helperset allows a mock to verify a particular helperset set is being added to the Helper */ private function getGenericMockHelper($name, HelperSet $helperset = null) { $mock_helper = $this->getMock('\Symfony\Component\Console\Helper\HelperInterface'); $mock_helper->expects($this->any()) ->method('getName') ->will($this->returnValue($name)); if ($helperset) { $mock_helper->expects($this->any()) ->method('setHelperSet') ->with($this->equalTo($helperset)); } return $mock_helper; } } PK.j]" U=Symfony/Component/Console/Tests/Helper/ProgressHelperTest.phpnu[ * * 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 Symfony\Component\Console\Helper\ProgressHelper; use Symfony\Component\Console\Output\StreamOutput; class ProgressHelperTest extends \PHPUnit_Framework_TestCase { public function testAdvance() { $progress = new ProgressHelper(); $progress->start($output = $this->getOutputStream()); $progress->advance(); rewind($output->getStream()); $this->assertEquals($this->generateOutput(' 1 [->--------------------------]'), stream_get_contents($output->getStream())); } public function testAdvanceWithStep() { $progress = new ProgressHelper(); $progress->start($output = $this->getOutputStream()); $progress->advance(5); rewind($output->getStream()); $this->assertEquals($this->generateOutput(' 5 [----->----------------------]'), stream_get_contents($output->getStream())); } public function testAdvanceMultipleTimes() { $progress = new ProgressHelper(); $progress->start($output = $this->getOutputStream()); $progress->advance(3); $progress->advance(2); rewind($output->getStream()); $this->assertEquals($this->generateOutput(' 3 [--->------------------------]').$this->generateOutput(' 5 [----->----------------------]'), stream_get_contents($output->getStream())); } public function testCustomizations() { $progress = new ProgressHelper(); $progress->setBarWidth(10); $progress->setBarCharacter('_'); $progress->setEmptyBarCharacter(' '); $progress->setProgressCharacter('/'); $progress->setFormat(' %current%/%max% [%bar%] %percent%%'); $progress->start($output = $this->getOutputStream(), 10); $progress->advance(); rewind($output->getStream()); $this->assertEquals($this->generateOutput(' 1/10 [_/ ] 10%'), stream_get_contents($output->getStream())); } public function testPercent() { $progress = new ProgressHelper(); $progress->start($output = $this->getOutputStream(), 50); $progress->display(); $progress->advance(); $progress->advance(); rewind($output->getStream()); $this->assertEquals($this->generateOutput(' 0/50 [>---------------------------] 0%').$this->generateOutput(' 1/50 [>---------------------------] 2%').$this->generateOutput(' 2/50 [=>--------------------------] 4%'), stream_get_contents($output->getStream())); } public function testOverwriteWithShorterLine() { $progress = new ProgressHelper(); $progress->setFormat(' %current%/%max% [%bar%] %percent%%'); $progress->start($output = $this->getOutputStream(), 50); $progress->display(); $progress->advance(); // set shorter format $progress->setFormat(' %current%/%max% [%bar%]'); $progress->advance(); rewind($output->getStream()); $this->assertEquals( $this->generateOutput(' 0/50 [>---------------------------] 0%') . $this->generateOutput(' 1/50 [>---------------------------] 2%') . $this->generateOutput(' 2/50 [=>--------------------------] '), stream_get_contents($output->getStream()) ); } public function testSetCurrentProgress() { $progress = new ProgressHelper(); $progress->start($output = $this->getOutputStream(), 50); $progress->display(); $progress->advance(); $progress->setCurrent(15); $progress->setCurrent(25); rewind($output->getStream()); $this->assertEquals( $this->generateOutput(' 0/50 [>---------------------------] 0%') . $this->generateOutput(' 1/50 [>---------------------------] 2%') . $this->generateOutput(' 15/50 [========>-------------------] 30%') . $this->generateOutput(' 25/50 [==============>-------------] 50%'), stream_get_contents($output->getStream()) ); } /** * @expectedException \LogicException * @expectedExceptionMessage You must start the progress bar */ public function testSetCurrentBeforeStarting() { $progress = new ProgressHelper(); $progress->setCurrent(15); } /** * @expectedException \LogicException * @expectedExceptionMessage You can't regress the progress bar */ public function testRegressProgress() { $progress = new ProgressHelper(); $progress->start($output = $this->getOutputStream(), 50); $progress->setCurrent(15); $progress->setCurrent(10); } public function testRedrawFrequency() { $progress = $this->getMock('Symfony\Component\Console\Helper\ProgressHelper', array('display')); $progress->expects($this->exactly(4)) ->method('display'); $progress->setRedrawFrequency(2); $progress->start($output = $this->getOutputStream(), 6); $progress->setCurrent(1); $progress->advance(2); $progress->advance(2); $progress->advance(1); } public function testMultiByteSupport() { if (!function_exists('mb_strlen') || (false === $encoding = mb_detect_encoding('■'))) { $this->markTestSkipped('The mbstring extension is needed for multi-byte support'); } $progress = new ProgressHelper(); $progress->start($output = $this->getOutputStream()); $progress->setBarCharacter('■'); $progress->advance(3); rewind($output->getStream()); $this->assertEquals($this->generateOutput(' 3 [■■■>------------------------]'), stream_get_contents($output->getStream())); } public function testClear() { $progress = new ProgressHelper(); $progress->start($output = $this->getOutputStream(), 50); $progress->setCurrent(25); $progress->clear(); rewind($output->getStream()); $this->assertEquals( $this->generateOutput(' 25/50 [==============>-------------] 50%') . $this->generateOutput(''), stream_get_contents($output->getStream()) ); } public function testPercentNotHundredBeforeComplete() { $progress = new ProgressHelper(); $progress->start($output = $this->getOutputStream(), 200); $progress->display(); $progress->advance(199); $progress->advance(); rewind($output->getStream()); $this->assertEquals($this->generateOutput(' 0/200 [>---------------------------] 0%').$this->generateOutput(' 199/200 [===========================>] 99%').$this->generateOutput(' 200/200 [============================] 100%'), stream_get_contents($output->getStream())); } protected function getOutputStream() { return new StreamOutput(fopen('php://memory', 'r+', false)); } protected $lastMessagesLength; protected function generateOutput($expected) { $expectedout = $expected; if ($this->lastMessagesLength !== null) { $expectedout = str_pad($expected, $this->lastMessagesLength, "\x20", STR_PAD_RIGHT); } $this->lastMessagesLength = strlen($expectedout); return "\x0D".$expectedout; } } PK.j]]_Դ3)3):Symfony/Component/Console/Tests/Helper/TableHelperTest.phpnu[ * * 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 Symfony\Component\Console\Helper\TableHelper; use Symfony\Component\Console\Output\StreamOutput; class TableHelperTest extends \PHPUnit_Framework_TestCase { protected $stream; protected function setUp() { $this->stream = fopen('php://memory', 'r+'); } protected function tearDown() { fclose($this->stream); $this->stream = null; } /** * @dataProvider testRenderProvider */ public function testRender($headers, $rows, $layout, $expected) { $table = new TableHelper(); $table ->setHeaders($headers) ->setRows($rows) ->setLayout($layout) ; $table->render($output = $this->getOutputStream()); $this->assertEquals($expected, $this->getOutputContent($output)); } /** * @dataProvider testRenderProvider */ public function testRenderAddRows($headers, $rows, $layout, $expected) { $table = new TableHelper(); $table ->setHeaders($headers) ->addRows($rows) ->setLayout($layout) ; $table->render($output = $this->getOutputStream()); $this->assertEquals($expected, $this->getOutputContent($output)); } /** * @dataProvider testRenderProvider */ public function testRenderAddRowsOneByOne($headers, $rows, $layout, $expected) { $table = new TableHelper(); $table ->setHeaders($headers) ->setLayout($layout) ; foreach ($rows as $row) { $table->addRow($row); } $table->render($output = $this->getOutputStream()); $this->assertEquals($expected, $this->getOutputContent($output)); } public function testRenderProvider() { $books = array( array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'), array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'), array('960-425-059-0', 'The Lord of the Rings', 'J. R. R. Tolkien'), array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'), ); return array( array( array('ISBN', 'Title', 'Author'), $books, TableHelper::LAYOUT_DEFAULT, << array( array('ISBN', 'Title', 'Author'), array( array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'), array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'), ), TableHelper::LAYOUT_DEFAULT, <<
array( array('ISBN', 'Title', 'Author'), array( array('99921-58-10-700', 'Divine Com', 'Dante Alighieri'), array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'), ), TableHelper::LAYOUT_DEFAULT, <<
99921-58-10-700 | Divine Com | Dante Alighieri | | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | +----------------------------------+----------------------+-----------------+ TABLE ), ); } public function testRenderMultiByte() { if (!function_exists('mb_strlen')) { $this->markTestSkipped('The "mbstring" extension is not available'); } $table = new TableHelper(); $table ->setHeaders(array('■■')) ->setRows(array(array(1234))) ->setLayout(TableHelper::LAYOUT_DEFAULT) ; $table->render($output = $this->getOutputStream()); $expected = <<
assertEquals($expected, $this->getOutputContent($output)); } protected function getOutputStream() { return new StreamOutput($this->stream, StreamOutput::VERBOSITY_NORMAL, false); } protected function getOutputContent(StreamOutput $output) { rewind($output->getStream()); return str_replace(PHP_EOL, "\n", stream_get_contents($output->getStream())); } } PK.j]]6\ASymfony/Component/Console/Tests/Formatter/OutputFormatterTest.phpnu[ * * 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 Symfony\Component\Console\Formatter\OutputFormatter; use Symfony\Component\Console\Formatter\OutputFormatterStyle; class OutputFormatterTest extends \PHPUnit_Framework_TestCase { public function testEmptyTag() { $formatter = new OutputFormatter(true); $this->assertEquals("foo<>bar", $formatter->format('foo<>bar')); } public function testLGCharEscaping() { $formatter = new OutputFormatter(true); $this->assertEquals("fooformat('foo\\assertEquals("some info", $formatter->format('\\some info\\')); $this->assertEquals("\\some info\\", OutputFormatter::escape('some info')); $this->assertEquals( "\033[33mSymfony\\Component\\Console does work very well!\033[0m", $formatter->format('Symfony\Component\Console does work very well!') ); } public function testBundledStyles() { $formatter = new OutputFormatter(true); $this->assertTrue($formatter->hasStyle('error')); $this->assertTrue($formatter->hasStyle('info')); $this->assertTrue($formatter->hasStyle('comment')); $this->assertTrue($formatter->hasStyle('question')); $this->assertEquals( "\033[37;41msome error\033[0m", $formatter->format('some error') ); $this->assertEquals( "\033[32msome info\033[0m", $formatter->format('some info') ); $this->assertEquals( "\033[33msome comment\033[0m", $formatter->format('some comment') ); $this->assertEquals( "\033[30;46msome question\033[0m", $formatter->format('some question') ); } public function testNestedStyles() { $formatter = new OutputFormatter(true); $this->assertEquals( "\033[37;41msome \033[0m\033[32msome info\033[0m\033[37;41m error\033[0m", $formatter->format('some some info error') ); } public function testAdjacentStyles() { $formatter = new OutputFormatter(true); $this->assertEquals( "\033[37;41msome error\033[0m\033[32msome info\033[0m", $formatter->format('some errorsome info') ); } public function testStyleMatchingNotGreedy() { $formatter = new OutputFormatter(true); $this->assertEquals( "(\033[32m>=2.0,<2.3\033[0m)", $formatter->format('(>=2.0,<2.3)') ); } public function testStyleEscaping() { $formatter = new OutputFormatter(true); $this->assertEquals( "(\033[32mz>=2.0,format('('.$formatter->escape('z>=2.0,)') ); } public function testDeepNestedStyles() { $formatter = new OutputFormatter(true); $this->assertEquals( "\033[37;41merror\033[0m\033[32minfo\033[0m\033[33mcomment\033[0m\033[37;41merror\033[0m", $formatter->format('errorinfocommenterror') ); } public function testNewStyle() { $formatter = new OutputFormatter(true); $style = new OutputFormatterStyle('blue', 'white'); $formatter->setStyle('test', $style); $this->assertEquals($style, $formatter->getStyle('test')); $this->assertNotEquals($style, $formatter->getStyle('info')); $style = new OutputFormatterStyle('blue', 'white'); $formatter->setStyle('b', $style); $this->assertEquals("\033[34;47msome \033[0m\033[34;47mcustom\033[0m\033[34;47m msg\033[0m", $formatter->format('some custom msg')); } public function testRedefineStyle() { $formatter = new OutputFormatter(true); $style = new OutputFormatterStyle('blue', 'white'); $formatter->setStyle('info', $style); $this->assertEquals("\033[34;47msome custom msg\033[0m", $formatter->format('some custom msg')); } public function testInlineStyle() { $formatter = new OutputFormatter(true); $this->assertEquals("\033[34;41msome text\033[0m", $formatter->format('some text')); $this->assertEquals("\033[34;41msome text\033[0m", $formatter->format('some text')); } public function testNonStyleTag() { $formatter = new OutputFormatter(true); $this->assertEquals("\033[32msome \033[0m\033[32m\033[0m\033[32m styled \033[0m\033[32m

\033[0m\033[32msingle-char tag\033[0m\033[32m

\033[0m", $formatter->format('some styled

single-char tag

')); } public function testFormatLongString() { $formatter = new OutputFormatter(true); $long = str_repeat("\\", 14000); $this->assertEquals("\033[37;41msome error\033[0m".$long, $formatter->format('some error'.$long)); } public function testNotDecoratedFormatter() { $formatter = new OutputFormatter(false); $this->assertTrue($formatter->hasStyle('error')); $this->assertTrue($formatter->hasStyle('info')); $this->assertTrue($formatter->hasStyle('comment')); $this->assertTrue($formatter->hasStyle('question')); $this->assertEquals( "some error", $formatter->format('some error') ); $this->assertEquals( "some info", $formatter->format('some info') ); $this->assertEquals( "some comment", $formatter->format('some comment') ); $this->assertEquals( "some question", $formatter->format('some question') ); $formatter->setDecorated(true); $this->assertEquals( "\033[37;41msome error\033[0m", $formatter->format('some error') ); $this->assertEquals( "\033[32msome info\033[0m", $formatter->format('some info') ); $this->assertEquals( "\033[33msome comment\033[0m", $formatter->format('some comment') ); $this->assertEquals( "\033[30;46msome question\033[0m", $formatter->format('some question') ); } public function testContentWithLineBreaks() { $formatter = new OutputFormatter(true); $this->assertEquals(<<format(<< some text
EOF )); $this->assertEquals(<<format(<<some text EOF )); $this->assertEquals(<<format(<< some text EOF )); $this->assertEquals(<<format(<< some text more text EOF )); } } PK.j] RwwKSymfony/Component/Console/Tests/Formatter/OutputFormatterStyleStackTest.phpnu[ * * 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 Symfony\Component\Console\Formatter\OutputFormatterStyleStack; use Symfony\Component\Console\Formatter\OutputFormatterStyle; class OutputFormatterStyleStackTest extends \PHPUnit_Framework_TestCase { public function testPush() { $stack = new OutputFormatterStyleStack(); $stack->push($s1 = new OutputFormatterStyle('white', 'black')); $stack->push($s2 = new OutputFormatterStyle('yellow', 'blue')); $this->assertEquals($s2, $stack->getCurrent()); $stack->push($s3 = new OutputFormatterStyle('green', 'red')); $this->assertEquals($s3, $stack->getCurrent()); } public function testPop() { $stack = new OutputFormatterStyleStack(); $stack->push($s1 = new OutputFormatterStyle('white', 'black')); $stack->push($s2 = new OutputFormatterStyle('yellow', 'blue')); $this->assertEquals($s2, $stack->pop()); $this->assertEquals($s1, $stack->pop()); } public function testPopEmpty() { $stack = new OutputFormatterStyleStack(); $style = new OutputFormatterStyle(); $this->assertEquals($style, $stack->pop()); } public function testPopNotLast() { $stack = new OutputFormatterStyleStack(); $stack->push($s1 = new OutputFormatterStyle('white', 'black')); $stack->push($s2 = new OutputFormatterStyle('yellow', 'blue')); $stack->push($s3 = new OutputFormatterStyle('green', 'red')); $this->assertEquals($s2, $stack->pop($s2)); $this->assertEquals($s1, $stack->pop()); } /** * @expectedException \InvalidArgumentException */ public function testInvalidPop() { $stack = new OutputFormatterStyleStack(); $stack->push(new OutputFormatterStyle('white', 'black')); $stack->pop(new OutputFormatterStyle('yellow', 'blue')); } } PK.j]rHwwFSymfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.phpnu[ * * 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 Symfony\Component\Console\Formatter\OutputFormatterStyle; class OutputFormatterStyleTest extends \PHPUnit_Framework_TestCase { public function testConstructor() { $style = new OutputFormatterStyle('green', 'black', array('bold', 'underscore')); $this->assertEquals("\033[32;40;1;4mfoo\033[0m", $style->apply('foo')); $style = new OutputFormatterStyle('red', null, array('blink')); $this->assertEquals("\033[31;5mfoo\033[0m", $style->apply('foo')); $style = new OutputFormatterStyle(null, 'white'); $this->assertEquals("\033[47mfoo\033[0m", $style->apply('foo')); } public function testForeground() { $style = new OutputFormatterStyle(); $style->setForeground('black'); $this->assertEquals("\033[30mfoo\033[0m", $style->apply('foo')); $style->setForeground('blue'); $this->assertEquals("\033[34mfoo\033[0m", $style->apply('foo')); $this->setExpectedException('InvalidArgumentException'); $style->setForeground('undefined-color'); } public function testBackground() { $style = new OutputFormatterStyle(); $style->setBackground('black'); $this->assertEquals("\033[40mfoo\033[0m", $style->apply('foo')); $style->setBackground('yellow'); $this->assertEquals("\033[43mfoo\033[0m", $style->apply('foo')); $this->setExpectedException('InvalidArgumentException'); $style->setBackground('undefined-color'); } public function testOptions() { $style = new OutputFormatterStyle(); $style->setOptions(array('reverse', 'conceal')); $this->assertEquals("\033[7;8mfoo\033[0m", $style->apply('foo')); $style->setOption('bold'); $this->assertEquals("\033[7;8;1mfoo\033[0m", $style->apply('foo')); $style->unsetOption('reverse'); $this->assertEquals("\033[8;1mfoo\033[0m", $style->apply('foo')); $style->setOption('bold'); $this->assertEquals("\033[8;1mfoo\033[0m", $style->apply('foo')); $style->setOptions(array('bold')); $this->assertEquals("\033[1mfoo\033[0m", $style->apply('foo')); try { $style->setOption('foo'); $this->fail('->setOption() throws an \InvalidArgumentException when the option does not exist in the available options'); } catch (\Exception $e) { $this->assertInstanceOf('\InvalidArgumentException', $e, '->setOption() throws an \InvalidArgumentException when the option does not exist in the available options'); $this->assertContains('Invalid option specified: "foo"', $e->getMessage(), '->setOption() throws an \InvalidArgumentException when the option does not exist in the available options'); } try { $style->unsetOption('foo'); $this->fail('->unsetOption() throws an \InvalidArgumentException when the option does not exist in the available options'); } catch (\Exception $e) { $this->assertInstanceOf('\InvalidArgumentException', $e, '->unsetOption() throws an \InvalidArgumentException when the option does not exist in the available options'); $this->assertContains('Invalid option specified: "foo"', $e->getMessage(), '->unsetOption() throws an \InvalidArgumentException when the option does not exist in the available options'); } } } PK.j];! 9Symfony/Component/Console/Tests/Output/NullOutputTest.phpnu[ * * 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 Symfony\Component\Console\Output\NullOutput; use Symfony\Component\Console\Output\OutputInterface; class NullOutputTest extends \PHPUnit_Framework_TestCase { public function testConstructor() { $output = new NullOutput(); ob_start(); $output->write('foo'); $buffer = ob_get_clean(); $this->assertSame('', $buffer, '->write() does nothing (at least nothing is printed)'); $this->assertFalse($output->isDecorated(), '->isDecorated() returns false'); } public function testVerbosity() { $output = new NullOutput(); $this->assertSame(OutputInterface::VERBOSITY_QUIET, $output->getVerbosity(), '->getVerbosity() returns VERBOSITY_QUIET for NullOutput by default'); $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE); $this->assertSame(OutputInterface::VERBOSITY_QUIET, $output->getVerbosity(), '->getVerbosity() always returns VERBOSITY_QUIET for NullOutput'); } } PK.j];Symfony/Component/Console/Tests/Output/StreamOutputTest.phpnu[ * * 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 Symfony\Component\Console\Output\Output; use Symfony\Component\Console\Output\StreamOutput; class StreamOutputTest extends \PHPUnit_Framework_TestCase { protected $stream; protected function setUp() { $this->stream = fopen('php://memory', 'a', false); } protected function tearDown() { $this->stream = null; } public function testConstructor() { $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->isDecorated(), '__construct() takes the decorated flag as its second argument'); } /** * @expectedException \InvalidArgumentException * @expectedExceptionMessage The StreamOutput class needs a stream as its first argument. */ public function testStreamIsRequired() { new StreamOutput('foo'); } public function testGetStream() { $output = new StreamOutput($this->stream); $this->assertEquals($this->stream, $output->getStream(), '->getStream() returns the current stream'); } public function testDoWrite() { $output = new StreamOutput($this->stream); $output->writeln('foo'); rewind($output->getStream()); $this->assertEquals('foo'.PHP_EOL, stream_get_contents($output->getStream()), '->doWrite() writes to the stream'); } } PK.j]}R<Symfony/Component/Console/Tests/Output/ConsoleOutputTest.phpnu[ * * 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 Symfony\Component\Console\Output\ConsoleOutput; use Symfony\Component\Console\Output\Output; class ConsoleOutputTest extends \PHPUnit_Framework_TestCase { public function testConstructor() { $output = new ConsoleOutput(Output::VERBOSITY_QUIET, true); $this->assertEquals(Output::VERBOSITY_QUIET, $output->getVerbosity(), '__construct() takes the verbosity as its first argument'); } } PK.j]5Symfony/Component/Console/Tests/Output/OutputTest.phpnu[ * * 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 Symfony\Component\Console\Output\Output; use Symfony\Component\Console\Formatter\OutputFormatterStyle; class OutputTest extends \PHPUnit_Framework_TestCase { public function testConstructor() { $output = new TestOutput(Output::VERBOSITY_QUIET, true); $this->assertEquals(Output::VERBOSITY_QUIET, $output->getVerbosity(), '__construct() takes the verbosity as its first argument'); $this->assertTrue($output->isDecorated(), '__construct() takes the decorated flag as its second argument'); } public function testSetIsDecorated() { $output = new TestOutput(); $output->setDecorated(true); $this->assertTrue($output->isDecorated(), 'setDecorated() sets the decorated flag'); } public function testSetGetVerbosity() { $output = new TestOutput(); $output->setVerbosity(Output::VERBOSITY_QUIET); $this->assertEquals(Output::VERBOSITY_QUIET, $output->getVerbosity(), '->setVerbosity() sets the verbosity'); $this->assertTrue($output->isQuiet()); $this->assertFalse($output->isVerbose()); $this->assertFalse($output->isVeryVerbose()); $this->assertFalse($output->isDebug()); $output->setVerbosity(Output::VERBOSITY_NORMAL); $this->assertFalse($output->isQuiet()); $this->assertFalse($output->isVerbose()); $this->assertFalse($output->isVeryVerbose()); $this->assertFalse($output->isDebug()); $output->setVerbosity(Output::VERBOSITY_VERBOSE); $this->assertFalse($output->isQuiet()); $this->assertTrue($output->isVerbose()); $this->assertFalse($output->isVeryVerbose()); $this->assertFalse($output->isDebug()); $output->setVerbosity(Output::VERBOSITY_VERY_VERBOSE); $this->assertFalse($output->isQuiet()); $this->assertTrue($output->isVerbose()); $this->assertTrue($output->isVeryVerbose()); $this->assertFalse($output->isDebug()); $output->setVerbosity(Output::VERBOSITY_DEBUG); $this->assertFalse($output->isQuiet()); $this->assertTrue($output->isVerbose()); $this->assertTrue($output->isVeryVerbose()); $this->assertTrue($output->isDebug()); } public function testWriteWithVerbosityQuiet() { $output = new TestOutput(Output::VERBOSITY_QUIET); $output->writeln('foo'); $this->assertEquals('', $output->output, '->writeln() outputs nothing if verbosity is set to VERBOSITY_QUIET'); } public function testWriteAnArrayOfMessages() { $output = new TestOutput(); $output->writeln(array('foo', 'bar')); $this->assertEquals("foo\nbar\n", $output->output, '->writeln() can take an array of messages to output'); } /** * @dataProvider provideWriteArguments */ public function testWriteRawMessage($message, $type, $expectedOutput) { $output = new TestOutput(); $output->writeln($message, $type); $this->assertEquals($expectedOutput, $output->output); } public function provideWriteArguments() { return array( array('foo', Output::OUTPUT_RAW, "foo\n"), array('foo', Output::OUTPUT_PLAIN, "foo\n"), ); } public function testWriteWithDecorationTurnedOff() { $output = new TestOutput(); $output->setDecorated(false); $output->writeln('foo'); $this->assertEquals("foo\n", $output->output, '->writeln() strips decoration tags if decoration is set to false'); } public function testWriteDecoratedMessage() { $fooStyle = new OutputFormatterStyle('yellow', 'red', array('blink')); $output = new TestOutput(); $output->getFormatter()->setStyle('FOO', $fooStyle); $output->setDecorated(true); $output->writeln('foo'); $this->assertEquals("\033[33;41;5mfoo\033[0m\n", $output->output, '->writeln() decorates the output'); } /** * @expectedException \InvalidArgumentException * @expectedExceptionMessage Unknown output type given (24) */ public function testWriteWithInvalidOutputType() { $output = new TestOutput(); $output->writeln('foo', 24); } public function testWriteWithInvalidStyle() { $output = new TestOutput(); $output->clear(); $output->write('foo'); $this->assertEquals('foo', $output->output, '->write() do nothing when a style does not exist'); $output->clear(); $output->writeln('foo'); $this->assertEquals("foo\n", $output->output, '->writeln() do nothing when a style does not exist'); } } class TestOutput extends Output { public $output = ''; public function clear() { $this->output = ''; } protected function doWrite($message, $newline) { $this->output .= $message.($newline ? "\n" : ''); } } PK.j]3P?Symfony/Component/Console/Tests/Fixtures/input_definition_2.xmlnu[ PK.j]9*A8Symfony/Component/Console/Tests/Fixtures/TestCommand.phpnu[setName('namespace:name') ->setAliases(array('name')) ->setDescription('description') ->setHelp('help') ; } protected function execute(InputInterface $input, OutputInterface $output) { $output->writeln('execute called'); } protected function interact(InputInterface $input, OutputInterface $output) { $output->writeln('interact called'); } } PK.j]<|4UU8Symfony/Component/Console/Tests/Fixtures/Foo1Command.phpnu[setName('foo:bar1') ->setDescription('The foo:bar1 command') ->setAliases(array('afoobar1')) ; } protected function execute(InputInterface $input, OutputInterface $output) { $this->input = $input; $this->output = $output; } } PK.j]-RSymfony/Component/Console/Tests/Fixtures/application_renderexception3decorated.txtnu[    [Exception]   Third exception comment       [Exception]   Second exception comment       [Exception]   First exception 

this is html

    foo3:bar PK.j]Y-͡:Symfony/Component/Console/Tests/Fixtures/input_option_1.mdnu[**option_name:** * Name: `--option_name` * Shortcut: `-o` * Accept value: no * Is value required: no * Is multiple: no * Description: * Default: `false` PK.j]$$@Symfony/Component/Console/Tests/Fixtures/application_astext2.txtnu[Console Tool Usage: [options] command [arguments] Options: --help -h Display this help message. --quiet -q Do not output any message. --verbose -v|vv|vvv Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug --version -V Display this application version. --ansi Force ANSI output. --no-ansi Disable ANSI output. --no-interaction -n Do not ask any interactive question. Available commands for the "foo" namespace: foo:bar The foo:bar command PK.j]u$´!!;Symfony/Component/Console/Tests/Fixtures/input_option_1.txtnu[ --option_name (-o) PK.j]G;Symfony/Component/Console/Tests/Fixtures/input_option_1.xmlnu[ PK.j]#9Symfony/Component/Console/Tests/Fixtures/application_2.mdnu[My Symfony application ====================== * alias1 * alias2 * help * list **descriptor:** * descriptor:command1 * descriptor:command2 help ---- * Description: Displays help for a command * Usage: `help [--xml] [--format="..."] [--raw] [command_name]` * Aliases: The help command displays help for a given command: php app/console help list You can also output the help in other formats by using the --format option: php app/console help --format=xml list To display the list of available commands, please use the list command. ### Arguments: **command_name:** * Name: command_name * Is required: no * Is array: no * Description: The command name * Default: `'help'` ### Options: **xml:** * Name: `--xml` * Shortcut: * Accept value: no * Is value required: no * Is multiple: no * Description: To output help as XML * Default: `false` **format:** * Name: `--format` * Shortcut: * Accept value: yes * Is value required: yes * Is multiple: no * Description: To output help in other formats * Default: `'txt'` **raw:** * Name: `--raw` * Shortcut: * Accept value: no * Is value required: no * Is multiple: no * Description: To output raw command help * Default: `false` **help:** * Name: `--help` * Shortcut: `-h` * Accept value: no * Is value required: no * Is multiple: no * Description: Display this help message. * Default: `false` **quiet:** * Name: `--quiet` * Shortcut: `-q` * Accept value: no * Is value required: no * Is multiple: no * Description: Do not output any message. * Default: `false` **verbose:** * Name: `--verbose` * Shortcut: `-v|-vv|-vvv` * Accept value: no * Is value required: no * Is multiple: no * Description: Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug * Default: `false` **version:** * Name: `--version` * Shortcut: `-V` * Accept value: no * Is value required: no * Is multiple: no * Description: Display this application version. * Default: `false` **ansi:** * Name: `--ansi` * Shortcut: * Accept value: no * Is value required: no * Is multiple: no * Description: Force ANSI output. * Default: `false` **no-ansi:** * Name: `--no-ansi` * Shortcut: * Accept value: no * Is value required: no * Is multiple: no * Description: Disable ANSI output. * Default: `false` **no-interaction:** * Name: `--no-interaction` * Shortcut: `-n` * Accept value: no * Is value required: no * Is multiple: no * Description: Do not ask any interactive question. * Default: `false` list ---- * Description: Lists commands * Usage: `list [--xml] [--raw] [--format="..."] [namespace]` * Aliases: The list command lists all commands: php app/console list You can also display the commands for a specific namespace: php app/console list test You can also output the information in other formats by using the --format option: php app/console list --format=xml It's also possible to get raw list of commands (useful for embedding command runner): php app/console list --raw ### Arguments: **namespace:** * Name: namespace * Is required: no * Is array: no * Description: The namespace name * Default: `NULL` ### Options: **xml:** * Name: `--xml` * Shortcut: * Accept value: no * Is value required: no * Is multiple: no * Description: To output list as XML * Default: `false` **raw:** * Name: `--raw` * Shortcut: * Accept value: no * Is value required: no * Is multiple: no * Description: To output raw command list * Default: `false` **format:** * Name: `--format` * Shortcut: * Accept value: yes * Is value required: yes * Is multiple: no * Description: To output list in other formats * Default: `'txt'` descriptor:command1 ------------------- * Description: command 1 description * Usage: `descriptor:command1` * Aliases: `alias1`, `alias2` command 1 help ### Options: **help:** * Name: `--help` * Shortcut: `-h` * Accept value: no * Is value required: no * Is multiple: no * Description: Display this help message. * Default: `false` **quiet:** * Name: `--quiet` * Shortcut: `-q` * Accept value: no * Is value required: no * Is multiple: no * Description: Do not output any message. * Default: `false` **verbose:** * Name: `--verbose` * Shortcut: `-v|-vv|-vvv` * Accept value: no * Is value required: no * Is multiple: no * Description: Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug * Default: `false` **version:** * Name: `--version` * Shortcut: `-V` * Accept value: no * Is value required: no * Is multiple: no * Description: Display this application version. * Default: `false` **ansi:** * Name: `--ansi` * Shortcut: * Accept value: no * Is value required: no * Is multiple: no * Description: Force ANSI output. * Default: `false` **no-ansi:** * Name: `--no-ansi` * Shortcut: * Accept value: no * Is value required: no * Is multiple: no * Description: Disable ANSI output. * Default: `false` **no-interaction:** * Name: `--no-interaction` * Shortcut: `-n` * Accept value: no * Is value required: no * Is multiple: no * Description: Do not ask any interactive question. * Default: `false` descriptor:command2 ------------------- * Description: command 2 description * Usage: `descriptor:command2 [-o|--option_name] argument_name` * Aliases: command 2 help ### Arguments: **argument_name:** * Name: argument_name * Is required: yes * Is array: no * Description: * Default: `NULL` ### Options: **option_name:** * Name: `--option_name` * Shortcut: `-o` * Accept value: no * Is value required: no * Is multiple: no * Description: * Default: `false` **help:** * Name: `--help` * Shortcut: `-h` * Accept value: no * Is value required: no * Is multiple: no * Description: Display this help message. * Default: `false` **quiet:** * Name: `--quiet` * Shortcut: `-q` * Accept value: no * Is value required: no * Is multiple: no * Description: Do not output any message. * Default: `false` **verbose:** * Name: `--verbose` * Shortcut: `-v|-vv|-vvv` * Accept value: no * Is value required: no * Is multiple: no * Description: Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug * Default: `false` **version:** * Name: `--version` * Shortcut: `-V` * Accept value: no * Is value required: no * Is multiple: no * Description: Display this application version. * Default: `false` **ansi:** * Name: `--ansi` * Shortcut: * Accept value: no * Is value required: no * Is multiple: no * Description: Force ANSI output. * Default: `false` **no-ansi:** * Name: `--no-ansi` * Shortcut: * Accept value: no * Is value required: no * Is multiple: no * Description: Disable ANSI output. * Default: `false` **no-interaction:** * Name: `--no-interaction` * Shortcut: `-n` * Accept value: no * Is value required: no * Is multiple: no * Description: Do not ask any interactive question. * Default: `false` PK.j]NY__=Symfony/Component/Console/Tests/Fixtures/input_argument_3.txtnu[ argument_name argument description (default: "default_value") PK.j]'̒6Symfony/Component/Console/Tests/Fixtures/command_1.txtnu[Usage: descriptor:command1 Aliases: alias1, alias2 Help: command 1 help PK.j] a<Symfony/Component/Console/Tests/Fixtures/input_option_4.jsonnu[{"name":"--option_name","shortcut":"-o","accept_value":true,"is_value_required":false,"is_multiple":true,"description":"option description","default":[]} PK.j]g/11=Symfony/Component/Console/Tests/Fixtures/input_argument_2.txtnu[ argument_name argument description PK.j]1G~"//:Symfony/Component/Console/Tests/Fixtures/FoobarCommand.phpnu[setName('foobar:foo') ->setDescription('The foobar:foo command') ; } protected function execute(InputInterface $input, OutputInterface $output) { $this->input = $input; $this->output = $output; } } PK.j][%7Symfony/Component/Console/Tests/Fixtures/command_1.jsonnu[{"name":"descriptor:command1","usage":"descriptor:command1","description":"command 1 description","help":"command 1 help","aliases":["alias1","alias2"],"definition":{"arguments":[],"options":[]}} PK.j]q+CSymfony/Component/Console/Tests/Fixtures/DescriptorApplication1.phpnu[ * * 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\Application; class DescriptorApplication1 extends Application { } PK.j]X<Symfony/Component/Console/Tests/Fixtures/input_option_1.jsonnu[{"name":"--option_name","shortcut":"-o","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"","default":false} PK.j]e::=Symfony/Component/Console/Tests/Fixtures/application_run1.txtnu[Console Tool Usage: [options] command [arguments] Options: --help -h Display this help message. --quiet -q Do not output any message. --verbose -v|vv|vvv Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug --version -V Display this application version. --ansi Force ANSI output. --no-ansi Disable ANSI output. --no-interaction -n Do not ask any interactive question. Available commands: help Displays help for a command list Lists commands PK.j]t;aa;Symfony/Component/Console/Tests/Fixtures/input_option_4.txtnu[ --option_name (-o) option description (multiple values allowed) PK.j]!"=Symfony/Component/Console/Tests/Fixtures/application_run3.txtnu[Usage: list [--xml] [--raw] [--format="..."] [namespace] Arguments: namespace The namespace name Options: --xml To output list as XML --raw To output raw command list --format To output list in other formats (default: "txt") Help: The list command lists all commands: php app/console list You can also display the commands for a specific namespace: php app/console list test You can also output the information in other formats by using the --format option: php app/console list --format=xml It's also possible to get raw list of commands (useful for embedding command runner): php app/console list --raw PK.j]>Symfony/Component/Console/Tests/Fixtures/input_definition_1.mdnu[PK.j]c:Symfony/Component/Console/Tests/Fixtures/input_option_3.mdnu[**option_name:** * Name: `--option_name` * Shortcut: `-o` * Accept value: yes * Is value required: yes * Is multiple: no * Description: option description * Default: `NULL` PK.j]X ,,=Symfony/Component/Console/Tests/Fixtures/application_run2.txtnu[Usage: help [--xml] [--format="..."] [--raw] [command_name] Arguments: command The command to execute command_name The command name (default: "help") Options: --xml To output help as XML --format To output help in other formats (default: "txt") --raw To output raw command help --help (-h) Display this help message. --quiet (-q) Do not output any message. --verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug --version (-V) Display this application version. --ansi Force ANSI output. --no-ansi Disable ANSI output. --no-interaction (-n) Do not ask any interactive question. Help: The help command displays help for a given command: php app/console help list You can also output the help in other formats by using the --format option: php app/console help --format=xml list To display the list of available commands, please use the list command. PK.j] 8Symfony/Component/Console/Tests/Fixtures/Foo2Command.phpnu[setName('foo1:bar') ->setDescription('The foo1:bar command') ->setAliases(array('afoobar2')) ; } protected function execute(InputInterface $input, OutputInterface $output) { } } PK.j]_n=Symfony/Component/Console/Tests/Fixtures/input_argument_1.xmlnu[ PK.j]*[Ǿ44>Symfony/Component/Console/Tests/Fixtures/input_definition_4.mdnu[### Arguments: **argument_name:** * Name: argument_name * Is required: yes * Is array: no * Description: * Default: `NULL` ### Options: **option_name:** * Name: `--option_name` * Shortcut: `-o` * Accept value: no * Is value required: no * Is multiple: no * Description: * Default: `false` PK.j]#"7Symfony/Component/Console/Tests/Fixtures/command_2.jsonnu[{"name":"descriptor:command2","usage":"descriptor:command2 [-o|--option_name] argument_name","description":"command 2 description","help":"command 2 help","aliases":[],"definition":{"arguments":{"argument_name":{"name":"argument_name","is_required":true,"is_array":false,"description":"","default":null}},"options":{"option_name":{"name":"--option_name","shortcut":"-o","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"","default":false}}}} PK.j]p>Symfony/Component/Console/Tests/Fixtures/input_definition_3.mdnu[### Options: **option_name:** * Name: `--option_name` * Shortcut: `-o` * Accept value: no * Is value required: no * Is multiple: no * Description: * Default: `false` PK.j] Ӹ:Symfony/Component/Console/Tests/Fixtures/input_option_2.mdnu[**option_name:** * Name: `--option_name` * Shortcut: `-o` * Accept value: yes * Is value required: no * Is multiple: no * Description: option description * Default: `'default_value'` PK.j](:Symfony/Component/Console/Tests/Fixtures/application_2.txtnu[My Symfony application version v1.0 Usage: [options] command [arguments] Options: --help -h Display this help message. --quiet -q Do not output any message. --verbose -v|vv|vvv Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug --version -V Display this application version. --ansi Force ANSI output. --no-ansi Disable ANSI output. --no-interaction -n Do not ask any interactive question. Available commands: alias1 command 1 description alias2 command 1 description help Displays help for a command list Lists commands descriptor descriptor:command1 command 1 description descriptor:command2 command 2 description PK.j]:Symfony/Component/Console/Tests/Fixtures/BarBucCommand.phpnu[setName('bar:buc'); } } PK.j]#ɤb@Symfony/Component/Console/Tests/Fixtures/application_gethelp.txtnu[Console Tool Usage: [options] command [arguments] Options: --help -h Display this help message. --quiet -q Do not output any message. --verbose -v|vv|vvv Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug --version -V Display this application version. --ansi Force ANSI output. --no-ansi Disable ANSI output. --no-interaction -n Do not ask any interactive question.PK.j]W،<Symfony/Component/Console/Tests/Fixtures/input_argument_3.mdnu[**argument_name:** * Name: argument_name * Is required: no * Is array: no * Description: argument description * Default: `'default_value'` PK.j]CQu?Symfony/Component/Console/Tests/Fixtures/input_definition_4.xmlnu[ PK.j]Zo9Symfony/Component/Console/Tests/Fixtures/application_1.mdnu[UNKNOWN ======= * help * list help ---- * Description: Displays help for a command * Usage: `help [--xml] [--format="..."] [--raw] [command_name]` * Aliases: The help command displays help for a given command: php app/console help list You can also output the help in other formats by using the --format option: php app/console help --format=xml list To display the list of available commands, please use the list command. ### Arguments: **command_name:** * Name: command_name * Is required: no * Is array: no * Description: The command name * Default: `'help'` ### Options: **xml:** * Name: `--xml` * Shortcut: * Accept value: no * Is value required: no * Is multiple: no * Description: To output help as XML * Default: `false` **format:** * Name: `--format` * Shortcut: * Accept value: yes * Is value required: yes * Is multiple: no * Description: To output help in other formats * Default: `'txt'` **raw:** * Name: `--raw` * Shortcut: * Accept value: no * Is value required: no * Is multiple: no * Description: To output raw command help * Default: `false` **help:** * Name: `--help` * Shortcut: `-h` * Accept value: no * Is value required: no * Is multiple: no * Description: Display this help message. * Default: `false` **quiet:** * Name: `--quiet` * Shortcut: `-q` * Accept value: no * Is value required: no * Is multiple: no * Description: Do not output any message. * Default: `false` **verbose:** * Name: `--verbose` * Shortcut: `-v|-vv|-vvv` * Accept value: no * Is value required: no * Is multiple: no * Description: Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug * Default: `false` **version:** * Name: `--version` * Shortcut: `-V` * Accept value: no * Is value required: no * Is multiple: no * Description: Display this application version. * Default: `false` **ansi:** * Name: `--ansi` * Shortcut: * Accept value: no * Is value required: no * Is multiple: no * Description: Force ANSI output. * Default: `false` **no-ansi:** * Name: `--no-ansi` * Shortcut: * Accept value: no * Is value required: no * Is multiple: no * Description: Disable ANSI output. * Default: `false` **no-interaction:** * Name: `--no-interaction` * Shortcut: `-n` * Accept value: no * Is value required: no * Is multiple: no * Description: Do not ask any interactive question. * Default: `false` list ---- * Description: Lists commands * Usage: `list [--xml] [--raw] [--format="..."] [namespace]` * Aliases: The list command lists all commands: php app/console list You can also display the commands for a specific namespace: php app/console list test You can also output the information in other formats by using the --format option: php app/console list --format=xml It's also possible to get raw list of commands (useful for embedding command runner): php app/console list --raw ### Arguments: **namespace:** * Name: namespace * Is required: no * Is array: no * Description: The namespace name * Default: `NULL` ### Options: **xml:** * Name: `--xml` * Shortcut: * Accept value: no * Is value required: no * Is multiple: no * Description: To output list as XML * Default: `false` **raw:** * Name: `--raw` * Shortcut: * Accept value: no * Is value required: no * Is multiple: no * Description: To output raw command list * Default: `false` **format:** * Name: `--format` * Shortcut: * Accept value: yes * Is value required: yes * Is multiple: no * Description: To output list in other formats * Default: `'txt'` PK.j]<]]>Symfony/Component/Console/Tests/Fixtures/input_argument_1.jsonnu[{"name":"argument_name","is_required":true,"is_array":false,"description":"","default":null} PK.j]󚲱}}>Symfony/Component/Console/Tests/Fixtures/input_argument_3.jsonnu[{"name":"argument_name","is_required":false,"is_array":false,"description":"argument description","default":"default_value"} PK.j]I;Symfony/Component/Console/Tests/Fixtures/input_option_4.xmlnu[ PK.j] c7Symfony/Component/Console/Tests/Fixtures/FooCommand.phpnu[setName('foo:bar') ->setDescription('The foo:bar command') ->setAliases(array('afoobar')) ; } protected function interact(InputInterface $input, OutputInterface $output) { $output->writeln('interact called'); } protected function execute(InputInterface $input, OutputInterface $output) { $this->input = $input; $this->output = $output; $output->writeln('called'); } } PK.j]@Symfony/Component/Console/Tests/Fixtures/input_definition_1.jsonnu[{"arguments":[],"options":[]} PK.j]I<Symfony/Component/Console/Tests/Fixtures/input_option_3.jsonnu[{"name":"--option_name","shortcut":"-o","accept_value":true,"is_value_required":true,"is_multiple":false,"description":"option description","default":null} PK.j]a66:Symfony/Component/Console/Tests/Fixtures/application_1.txtnu[Console Tool Usage: [options] command [arguments] Options: --help -h Display this help message. --quiet -q Do not output any message. --verbose -v|vv|vvv Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug --version -V Display this application version. --ansi Force ANSI output. --no-ansi Disable ANSI output. --no-interaction -n Do not ask any interactive question. Available commands: help Displays help for a command list Lists commands PK.j]EOO6Symfony/Component/Console/Tests/Fixtures/command_1.xmlnu[ descriptor:command1 command 1 description command 1 help alias1 alias2 PK.j]$$@Symfony/Component/Console/Tests/Fixtures/input_definition_4.jsonnu[{"arguments":{"argument_name":{"name":"argument_name","is_required":true,"is_array":false,"description":"","default":null}},"options":{"option_name":{"name":"--option_name","shortcut":"-o","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"","default":false}}} PK.j]XX;Symfony/Component/Console/Tests/Fixtures/input_option_3.xmlnu[ PK.j]x44;Symfony/Component/Console/Tests/Fixtures/input_option_3.txtnu[ --option_name (-o) option description PK.j]A(ff6Symfony/Component/Console/Tests/Fixtures/command_2.xmlnu[ descriptor:command2 [-o|--option_name] argument_name command 2 description command 2 help PK.j]?Symfony/Component/Console/Tests/Fixtures/input_definition_1.txtnu[PK.j]lT:Symfony/Component/Console/Tests/Fixtures/application_1.xmlnu[ help [--xml] [--format="..."] [--raw] [command_name] Displays help for a command The <info>help</info> command displays help for a given command: <info>php app/console help list</info> You can also output the help in other formats by using the <comment>--format</comment> option: <info>php app/console help --format=xml list</info> To display the list of available commands, please use the <info>list</info> command. The command name help list [--xml] [--raw] [--format="..."] [namespace] Lists commands The <info>list</info> command lists all commands: <info>php app/console list</info> You can also display the commands for a specific namespace: <info>php app/console list test</info> You can also output the information in other formats by using the <comment>--format</comment> option: <info>php app/console list --format=xml</info> It's also possible to get raw list of commands (useful for embedding command runner): <info>php app/console list --raw</info> The namespace name help list PK.j];`M?Symfony/Component/Console/Tests/Fixtures/application_asxml1.txtnu[ help [--xml] [--format="..."] [--raw] [command_name] Displays help for a command The <info>help</info> command displays help for a given command: <info>php app/console help list</info> You can also output the help in other formats by using the <comment>--format</comment> option: <info>php app/console help --format=xml list</info> To display the list of available commands, please use the <info>list</info> command. The command name help list [--xml] [--raw] [--format="..."] [namespace] Lists commands The <info>list</info> command lists all commands: <info>php app/console list</info> You can also display the commands for a specific namespace: <info>php app/console list test</info> You can also output the information in other formats by using the <comment>--format</comment> option: <info>php app/console list --format=xml</info> It's also possible to get raw list of commands (useful for embedding command runner): <info>php app/console list --raw</info> The namespace name foo:bar The foo:bar command afoobar afoobar help list foo:bar PK.j]==?Symfony/Component/Console/Tests/Fixtures/input_definition_3.txtnu[Options: --option_name (-o) PK.j];Symfony/Component/Console/Tests/Fixtures/command_astext.txtnu[Usage: namespace:name Aliases: name Arguments: command The command to execute Options: --help (-h) Display this help message. --quiet (-q) Do not output any message. --verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug --version (-V) Display this application version. --ansi Force ANSI output. --no-ansi Disable ANSI output. --no-interaction (-n) Do not ask any interactive question. Help: help PK.j]6 _AA8Symfony/Component/Console/Tests/Fixtures/Foo3Command.phpnu[setName('foo3:bar') ->setDescription('The foo3:bar command') ; } protected function execute(InputInterface $input, OutputInterface $output) { try { try { throw new \Exception("First exception

this is html

"); } catch (\Exception $e) { throw new \Exception("Second exception comment", 0, $e); } } catch (\Exception $e) { throw new \Exception("Third exception comment", 0, $e); } } } PK.j]zՌ<Symfony/Component/Console/Tests/Fixtures/input_argument_2.mdnu[**argument_name:** * Name: argument_name * Is required: no * Is array: yes * Description: argument description * Default: `array ()` PK.j]U5Symfony/Component/Console/Tests/Fixtures/command_2.mdnu[descriptor:command2 ------------------- * Description: command 2 description * Usage: `descriptor:command2 [-o|--option_name] argument_name` * Aliases: command 2 help ### Arguments: **argument_name:** * Name: argument_name * Is required: yes * Is array: no * Description: * Default: `NULL` ### Options: **option_name:** * Name: `--option_name` * Shortcut: `-o` * Accept value: no * Is value required: no * Is multiple: no * Description: * Default: `false` PK.j]K@bb;Symfony/Component/Console/Tests/Fixtures/input_option_2.txtnu[ --option_name (-o) option description (default: "default_value") PK.j][>Symfony/Component/Console/Tests/Fixtures/input_definition_2.mdnu[### Arguments: **argument_name:** * Name: argument_name * Is required: yes * Is array: no * Description: * Default: `NULL` PK.j]J2;Symfony/Component/Console/Tests/Fixtures/input_option_2.xmlnu[ PK.j]oo>Symfony/Component/Console/Tests/Fixtures/input_argument_2.jsonnu[{"name":"argument_name","is_required":false,"is_array":true,"description":"argument description","default":[]} PK.j].p~~?Symfony/Component/Console/Tests/Fixtures/input_definition_4.txtnu[Arguments: argument_name Options: --option_name (-o) PK.j]/""8Symfony/Component/Console/Tests/Fixtures/Foo5Command.phpnu[ foo:bar The foo:bar command afoobar PK.j]9yX5Symfony/Component/Console/Tests/Fixtures/command_1.mdnu[descriptor:command1 ------------------- * Description: command 1 description * Usage: `descriptor:command1` * Aliases: `alias1`, `alias2` command 1 help PK.j]tt<Symfony/Component/Console/Tests/Fixtures/input_argument_1.mdnu[**argument_name:** * Name: argument_name * Is required: yes * Is array: no * Description: * Default: `NULL` PK.j]1"8MMCSymfony/Component/Console/Tests/Fixtures/DescriptorApplication2.phpnu[ * * 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\Application; class DescriptorApplication2 extends Application { public function __construct() { parent::__construct('My Symfony application', 'v1.0'); $this->add(new DescriptorCommand1()); $this->add(new DescriptorCommand2()); } } PK.j]Ѹ;;?Symfony/Component/Console/Tests/Fixtures/input_definition_2.txtnu[Arguments: argument_name PK.j]*q@Symfony/Component/Console/Tests/Fixtures/input_definition_3.jsonnu[{"arguments":[],"options":{"option_name":{"name":"--option_name","shortcut":"-o","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"","default":false}}} PK.j]ed8Symfony/Component/Console/Tests/Fixtures/Foo4Command.phpnu[setName('foo3:bar:toh'); } } PK.j]f=Symfony/Component/Console/Tests/Fixtures/input_argument_2.xmlnu[ argument description PK.j]S:Symfony/Component/Console/Tests/Fixtures/command_asxml.txtnu[ namespace:name description help name The command to execute PK.j]oY;Symfony/Component/Console/Tests/Fixtures/application_1.jsonnu[{"commands":[{"name":"help","usage":"help [--xml] [--format=\"...\"] [--raw] [command_name]","description":"Displays help for a command","help":"The help<\/info> command displays help for a given command:\n\n php app\/console help list<\/info>\n\nYou can also output the help in other formats by using the --format<\/comment> option:\n\n php app\/console help --format=xml list<\/info>\n\nTo display the list of available commands, please use the list<\/info> command.","aliases":[],"definition":{"arguments":{"command_name":{"name":"command_name","is_required":false,"is_array":false,"description":"The command name","default":"help"}},"options":{"xml":{"name":"--xml","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"To output help as XML","default":false},"format":{"name":"--format","shortcut":"","accept_value":true,"is_value_required":true,"is_multiple":false,"description":"To output help in other formats","default":"txt"},"raw":{"name":"--raw","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"To output raw command help","default":false},"help":{"name":"--help","shortcut":"-h","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Display this help message.","default":false},"quiet":{"name":"--quiet","shortcut":"-q","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Do not output any message.","default":false},"verbose":{"name":"--verbose","shortcut":"-v|-vv|-vvv","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug","default":false},"version":{"name":"--version","shortcut":"-V","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Display this application version.","default":false},"ansi":{"name":"--ansi","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Force ANSI output.","default":false},"no-ansi":{"name":"--no-ansi","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Disable ANSI output.","default":false},"no-interaction":{"name":"--no-interaction","shortcut":"-n","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Do not ask any interactive question.","default":false}}}},{"name":"list","usage":"list [--xml] [--raw] [--format=\"...\"] [namespace]","description":"Lists commands","help":"The list<\/info> command lists all commands:\n\n php app\/console list<\/info>\n\nYou can also display the commands for a specific namespace:\n\n php app\/console list test<\/info>\n\nYou can also output the information in other formats by using the --format<\/comment> option:\n\n php app\/console list --format=xml<\/info>\n\nIt's also possible to get raw list of commands (useful for embedding command runner):\n\n php app\/console list --raw<\/info>","aliases":[],"definition":{"arguments":{"namespace":{"name":"namespace","is_required":false,"is_array":false,"description":"The namespace name","default":null}},"options":{"xml":{"name":"--xml","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"To output list as XML","default":false},"raw":{"name":"--raw","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"To output raw command list","default":false},"format":{"name":"--format","shortcut":"","accept_value":true,"is_value_required":true,"is_multiple":false,"description":"To output list in other formats","default":"txt"}}}}],"namespaces":[{"id":"_global","commands":["help","list"]}]} PK.j]XlISymfony/Component/Console/Tests/Fixtures/application_renderexception4.txtnu[ [InvalidArgumentException] Command "foo" is not define d. PK.j](?h=Symfony/Component/Console/Tests/Fixtures/input_argument_1.txtnu[ argument_name PK.j]ud@Symfony/Component/Console/Tests/Fixtures/application_astext1.txtnu[Console Tool Usage: [options] command [arguments] Options: --help -h Display this help message. --quiet -q Do not output any message. --verbose -v|vv|vvv Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug --version -V Display this application version. --ansi Force ANSI output. --no-ansi Disable ANSI output. --no-interaction -n Do not ask any interactive question. Available commands: afoobar The foo:bar command help Displays help for a command list Lists commands foo foo:bar The foo:bar command PK.j]ia=Symfony/Component/Console/Tests/Fixtures/definition_asxml.txtnu[ The foo argument The baz argument true The bar argument bar PK.j]P:Symfony/Component/Console/Tests/Fixtures/input_option_4.mdnu[**option_name:** * Name: `--option_name` * Shortcut: `-o` * Accept value: yes * Is value required: no * Is multiple: yes * Description: option description * Default: `array ()` PK.j],>Symfony/Component/Console/Tests/Fixtures/definition_astext.txtnu[Arguments: foo The foo argument baz The baz argument (default: true) bar The bar argument (default: ["http://foo.com/"]) Options: --foo (-f) The foo option --baz The baz option (default: false) --bar (-b) The bar option (default: "bar") --qux The qux option (default: ["http://foo.com/","bar"]) (multiple values allowed) --qux2 The qux2 option (default: {"foo":"bar"}) (multiple values allowed) PK.j]&ISymfony/Component/Console/Tests/Fixtures/application_renderexception1.txtnu[ [InvalidArgumentException] Command "foo" is not defined. PK.j]@]"]":Symfony/Component/Console/Tests/Fixtures/application_2.xmlnu[ help [--xml] [--format="..."] [--raw] [command_name] Displays help for a command The <info>help</info> command displays help for a given command: <info>php app/console help list</info> You can also output the help in other formats by using the <comment>--format</comment> option: <info>php app/console help --format=xml list</info> To display the list of available commands, please use the <info>list</info> command. The command name help list [--xml] [--raw] [--format="..."] [namespace] Lists commands The <info>list</info> command lists all commands: <info>php app/console list</info> You can also display the commands for a specific namespace: <info>php app/console list test</info> You can also output the information in other formats by using the <comment>--format</comment> option: <info>php app/console list --format=xml</info> It's also possible to get raw list of commands (useful for embedding command runner): <info>php app/console list --raw</info> The namespace name descriptor:command1 command 1 description command 1 help alias1 alias2 descriptor:command2 [-o|--option_name] argument_name command 2 description command 2 help alias1 alias2 help list descriptor:command1 descriptor:command2 PK.j]G u=ISymfony/Component/Console/Tests/Fixtures/application_renderexception3.txtnu[ [Exception] Third exception comment [Exception] Second exception comment [Exception] First exception

this is html

foo3:bar PK.j]M;Symfony/Component/Console/Tests/Fixtures/application_2.jsonnu[{"commands":[{"name":"help","usage":"help [--xml] [--format=\"...\"] [--raw] [command_name]","description":"Displays help for a command","help":"The help<\/info> command displays help for a given command:\n\n php app\/console help list<\/info>\n\nYou can also output the help in other formats by using the --format<\/comment> option:\n\n php app\/console help --format=xml list<\/info>\n\nTo display the list of available commands, please use the list<\/info> command.","aliases":[],"definition":{"arguments":{"command_name":{"name":"command_name","is_required":false,"is_array":false,"description":"The command name","default":"help"}},"options":{"xml":{"name":"--xml","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"To output help as XML","default":false},"format":{"name":"--format","shortcut":"","accept_value":true,"is_value_required":true,"is_multiple":false,"description":"To output help in other formats","default":"txt"},"raw":{"name":"--raw","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"To output raw command help","default":false},"help":{"name":"--help","shortcut":"-h","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Display this help message.","default":false},"quiet":{"name":"--quiet","shortcut":"-q","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Do not output any message.","default":false},"verbose":{"name":"--verbose","shortcut":"-v|-vv|-vvv","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug","default":false},"version":{"name":"--version","shortcut":"-V","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Display this application version.","default":false},"ansi":{"name":"--ansi","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Force ANSI output.","default":false},"no-ansi":{"name":"--no-ansi","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Disable ANSI output.","default":false},"no-interaction":{"name":"--no-interaction","shortcut":"-n","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Do not ask any interactive question.","default":false}}}},{"name":"list","usage":"list [--xml] [--raw] [--format=\"...\"] [namespace]","description":"Lists commands","help":"The list<\/info> command lists all commands:\n\n php app\/console list<\/info>\n\nYou can also display the commands for a specific namespace:\n\n php app\/console list test<\/info>\n\nYou can also output the information in other formats by using the --format<\/comment> option:\n\n php app\/console list --format=xml<\/info>\n\nIt's also possible to get raw list of commands (useful for embedding command runner):\n\n php app\/console list --raw<\/info>","aliases":[],"definition":{"arguments":{"namespace":{"name":"namespace","is_required":false,"is_array":false,"description":"The namespace name","default":null}},"options":{"xml":{"name":"--xml","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"To output list as XML","default":false},"raw":{"name":"--raw","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"To output raw command list","default":false},"format":{"name":"--format","shortcut":"","accept_value":true,"is_value_required":true,"is_multiple":false,"description":"To output list in other formats","default":"txt"}}}},{"name":"descriptor:command1","usage":"descriptor:command1","description":"command 1 description","help":"command 1 help","aliases":["alias1","alias2"],"definition":{"arguments":[],"options":{"help":{"name":"--help","shortcut":"-h","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Display this help message.","default":false},"quiet":{"name":"--quiet","shortcut":"-q","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Do not output any message.","default":false},"verbose":{"name":"--verbose","shortcut":"-v|-vv|-vvv","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug","default":false},"version":{"name":"--version","shortcut":"-V","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Display this application version.","default":false},"ansi":{"name":"--ansi","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Force ANSI output.","default":false},"no-ansi":{"name":"--no-ansi","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Disable ANSI output.","default":false},"no-interaction":{"name":"--no-interaction","shortcut":"-n","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Do not ask any interactive question.","default":false}}}},{"name":"descriptor:command2","usage":"descriptor:command2 [-o|--option_name] argument_name","description":"command 2 description","help":"command 2 help","aliases":[],"definition":{"arguments":{"argument_name":{"name":"argument_name","is_required":true,"is_array":false,"description":"","default":null}},"options":{"option_name":{"name":"--option_name","shortcut":"-o","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"","default":false},"help":{"name":"--help","shortcut":"-h","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Display this help message.","default":false},"quiet":{"name":"--quiet","shortcut":"-q","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Do not output any message.","default":false},"verbose":{"name":"--verbose","shortcut":"-v|-vv|-vvv","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug","default":false},"version":{"name":"--version","shortcut":"-V","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Display this application version.","default":false},"ansi":{"name":"--ansi","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Force ANSI output.","default":false},"no-ansi":{"name":"--no-ansi","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Disable ANSI output.","default":false},"no-interaction":{"name":"--no-interaction","shortcut":"-n","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Do not ask any interactive question.","default":false}}}}],"namespaces":[{"id":"_global","commands":["alias1","alias2","help","list"]},{"id":"descriptor","commands":["descriptor:command1","descriptor:command2"]}]} PK.j]^t^^?Symfony/Component/Console/Tests/Fixtures/input_definition_1.xmlnu[ PK.j]8UT =Symfony/Component/Console/Tests/Fixtures/application_run4.txtnu[Console Tool PK.j]h6Symfony/Component/Console/Tests/Fixtures/command_2.txtnu[Usage: descriptor:command2 [-o|--option_name] argument_name Arguments: argument_name Options: --option_name (-o) Help: command 2 help PK.j]۴2<Symfony/Component/Console/Tests/Fixtures/input_option_2.jsonnu[{"name":"--option_name","shortcut":"-o","accept_value":true,"is_value_required":false,"is_multiple":false,"description":"option description","default":"default_value"} PK.j]F:c?Symfony/Component/Console/Tests/Fixtures/input_definition_3.xmlnu[ PK.j]@Symfony/Component/Console/Tests/Fixtures/input_definition_2.jsonnu[{"arguments":{"argument_name":{"name":"argument_name","is_required":true,"is_array":false,"description":"","default":null}},"options":[]} PK.j]Y'A?Symfony/Component/Console/Tests/Fixtures/DescriptorCommand1.phpnu[ * * 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; class DescriptorCommand1 extends Command { protected function configure() { $this ->setName('descriptor:command1') ->setAliases(array('alias1', 'alias2')) ->setDescription('command 1 description') ->setHelp('command 1 help') ; } } PK.j],DŽISymfony/Component/Console/Tests/Fixtures/application_renderexception2.txtnu[ [InvalidArgumentException] The "--foo" option does not exist. list [--xml] [--raw] [--format="..."] [namespace] PK.j]Xz???Symfony/Component/Console/Tests/Fixtures/DescriptorCommand2.phpnu[ * * 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\Console\Input\InputOption; class DescriptorCommand2 extends Command { protected function configure() { $this ->setName('descriptor:command2') ->setDescription('command 2 description') ->setHelp('command 2 help') ->addArgument('argument_name', InputArgument::REQUIRED) ->addOption('option_name', 'o', InputOption::VALUE_NONE) ; } } PK.j]: 8=Symfony/Component/Console/Tests/Fixtures/input_argument_3.xmlnu[ argument description default_value PK.j]Ĕ3Symfony/Component/Console/Tests/ApplicationTest.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests; use Symfony\Component\Console\Application; use Symfony\Component\Console\Helper\HelperSet; use Symfony\Component\Console\Helper\FormatterHelper; use Symfony\Component\Console\Input\ArgvInput; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\NullOutput; use Symfony\Component\Console\Output\Output; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\StreamOutput; use Symfony\Component\Console\Tester\ApplicationTester; use Symfony\Component\Console\Event\ConsoleCommandEvent; use Symfony\Component\Console\Event\ConsoleExceptionEvent; use Symfony\Component\Console\Event\ConsoleTerminateEvent; use Symfony\Component\EventDispatcher\EventDispatcher; class ApplicationTest extends \PHPUnit_Framework_TestCase { protected static $fixturesPath; public static function setUpBeforeClass() { self::$fixturesPath = realpath(__DIR__.'/Fixtures/'); require_once self::$fixturesPath.'/FooCommand.php'; require_once self::$fixturesPath.'/Foo1Command.php'; require_once self::$fixturesPath.'/Foo2Command.php'; require_once self::$fixturesPath.'/Foo3Command.php'; require_once self::$fixturesPath.'/Foo4Command.php'; require_once self::$fixturesPath.'/Foo5Command.php'; require_once self::$fixturesPath.'/FoobarCommand.php'; require_once self::$fixturesPath.'/BarBucCommand.php'; } protected function normalizeLineBreaks($text) { return str_replace(PHP_EOL, "\n", $text); } /** * Replaces the dynamic placeholders of the command help text with a static version. * The placeholder %command.full_name% includes the script path that is not predictable * and can not be tested against. */ protected function ensureStaticCommandHelp(Application $application) { foreach ($application->all() as $command) { $command->setHelp(str_replace('%command.full_name%', 'app/console %command.name%', $command->getHelp())); } } public function testConstructor() { $application = new Application('foo', 'bar'); $this->assertEquals('foo', $application->getName(), '__construct() takes the application name as its first argument'); $this->assertEquals('bar', $application->getVersion(), '__construct() takes the application version as its second argument'); $this->assertEquals(array('help', 'list'), array_keys($application->all()), '__construct() registered the help and list commands by default'); } public function testSetGetName() { $application = new Application(); $application->setName('foo'); $this->assertEquals('foo', $application->getName(), '->setName() sets the name of the application'); } public function testSetGetVersion() { $application = new Application(); $application->setVersion('bar'); $this->assertEquals('bar', $application->getVersion(), '->setVersion() sets the version of the application'); } public function testGetLongVersion() { $application = new Application('foo', 'bar'); $this->assertEquals('foo version bar', $application->getLongVersion(), '->getLongVersion() returns the long version of the application'); } public function testHelp() { $application = new Application(); $this->assertStringEqualsFile(self::$fixturesPath.'/application_gethelp.txt', $this->normalizeLineBreaks($application->getHelp()), '->setHelp() returns a help message'); } public function testAll() { $application = new Application(); $commands = $application->all(); $this->assertInstanceOf('Symfony\\Component\\Console\\Command\\HelpCommand', $commands['help'], '->all() returns the registered commands'); $application->add(new \FooCommand()); $commands = $application->all('foo'); $this->assertCount(1, $commands, '->all() takes a namespace as its first argument'); } public function testRegister() { $application = new Application(); $command = $application->register('foo'); $this->assertEquals('foo', $command->getName(), '->register() registers a new command'); } public function testAdd() { $application = new Application(); $application->add($foo = new \FooCommand()); $commands = $application->all(); $this->assertEquals($foo, $commands['foo:bar'], '->add() registers a command'); $application = new Application(); $application->addCommands(array($foo = new \FooCommand(), $foo1 = new \Foo1Command())); $commands = $application->all(); $this->assertEquals(array($foo, $foo1), array($commands['foo:bar'], $commands['foo:bar1']), '->addCommands() registers an array of commands'); } /** * @expectedException \LogicException * @expectedExceptionMessage Command class "Foo5Command" is not correctly initialized. You probably forgot to call the parent constructor. */ public function testAddCommandWithEmptyConstructor() { $application = new Application(); $application->add(new \Foo5Command()); } public function testHasGet() { $application = new Application(); $this->assertTrue($application->has('list'), '->has() returns true if a named command is registered'); $this->assertFalse($application->has('afoobar'), '->has() returns false if a named command is not registered'); $application->add($foo = new \FooCommand()); $this->assertTrue($application->has('afoobar'), '->has() returns true if an alias is registered'); $this->assertEquals($foo, $application->get('foo:bar'), '->get() returns a command by name'); $this->assertEquals($foo, $application->get('afoobar'), '->get() returns a command by alias'); $application = new Application(); $application->add($foo = new \FooCommand()); // simulate --help $r = new \ReflectionObject($application); $p = $r->getProperty('wantHelps'); $p->setAccessible(true); $p->setValue($application, true); $command = $application->get('foo:bar'); $this->assertInstanceOf('Symfony\Component\Console\Command\HelpCommand', $command, '->get() returns the help command if --help is provided as the input'); } public function testSilentHelp() { $application = new Application(); $application->setAutoExit(false); $application->setCatchExceptions(false); $tester = new ApplicationTester($application); $tester->run(array('-h' => true, '-q' => true), array('decorated' => false)); $this->assertEmpty($tester->getDisplay(true)); } /** * @expectedException \InvalidArgumentException * @expectedExceptionMessage The command "foofoo" does not exist. */ public function testGetInvalidCommand() { $application = new Application(); $application->get('foofoo'); } public function testGetNamespaces() { $application = new Application(); $application->add(new \FooCommand()); $application->add(new \Foo1Command()); $this->assertEquals(array('foo'), $application->getNamespaces(), '->getNamespaces() returns an array of unique used namespaces'); } public function testFindNamespace() { $application = new Application(); $application->add(new \FooCommand()); $this->assertEquals('foo', $application->findNamespace('foo'), '->findNamespace() returns the given namespace if it exists'); $this->assertEquals('foo', $application->findNamespace('f'), '->findNamespace() finds a namespace given an abbreviation'); $application->add(new \Foo2Command()); $this->assertEquals('foo', $application->findNamespace('foo'), '->findNamespace() returns the given namespace if it exists'); } /** * @expectedException \InvalidArgumentException * @expectedExceptionMessage The namespace "f" is ambiguous (foo, foo1). */ public function testFindAmbiguousNamespace() { $application = new Application(); $application->add(new \BarBucCommand()); $application->add(new \FooCommand()); $application->add(new \Foo2Command()); $application->findNamespace('f'); } /** * @expectedException \InvalidArgumentException * @expectedExceptionMessage There are no commands defined in the "bar" namespace. */ public function testFindInvalidNamespace() { $application = new Application(); $application->findNamespace('bar'); } /** * @expectedException \InvalidArgumentException * @expectedExceptionMessage Command "foo1" is not defined */ public function testFindUniqueNameButNamespaceName() { $application = new Application(); $application->add(new \FooCommand()); $application->add(new \Foo1Command()); $application->add(new \Foo2Command()); $application->find($commandName = 'foo1'); } public function testFind() { $application = new Application(); $application->add(new \FooCommand()); $this->assertInstanceOf('FooCommand', $application->find('foo:bar'), '->find() returns a command if its name exists'); $this->assertInstanceOf('Symfony\Component\Console\Command\HelpCommand', $application->find('h'), '->find() returns a command if its name exists'); $this->assertInstanceOf('FooCommand', $application->find('f:bar'), '->find() returns a command if the abbreviation for the namespace exists'); $this->assertInstanceOf('FooCommand', $application->find('f:b'), '->find() returns a command if the abbreviation for the namespace and the command name exist'); $this->assertInstanceOf('FooCommand', $application->find('a'), '->find() returns a command if the abbreviation exists for an alias'); } /** * @dataProvider provideAmbiguousAbbreviations */ public function testFindWithAmbiguousAbbreviations($abbreviation, $expectedExceptionMessage) { $this->setExpectedException('InvalidArgumentException', $expectedExceptionMessage); $application = new Application(); $application->add(new \FooCommand()); $application->add(new \Foo1Command()); $application->add(new \Foo2Command()); $application->find($abbreviation); } public function provideAmbiguousAbbreviations() { return array( array('f', 'Command "f" is not defined.'), array('a', 'Command "a" is ambiguous (afoobar, afoobar1 and 1 more).'), array('foo:b', 'Command "foo:b" is ambiguous (foo:bar, foo:bar1 and 1 more).') ); } public function testFindCommandEqualNamespace() { $application = new Application(); $application->add(new \Foo3Command()); $application->add(new \Foo4Command()); $this->assertInstanceOf('Foo3Command', $application->find('foo3:bar'), '->find() returns the good command even if a namespace has same name'); $this->assertInstanceOf('Foo4Command', $application->find('foo3:bar:toh'), '->find() returns a command even if its namespace equals another command name'); } public function testFindCommandWithAmbiguousNamespacesButUniqueName() { $application = new Application(); $application->add(new \FooCommand()); $application->add(new \FoobarCommand()); $this->assertInstanceOf('FoobarCommand', $application->find('f:f')); } public function testFindCommandWithMissingNamespace() { $application = new Application(); $application->add(new \Foo4Command()); $this->assertInstanceOf('Foo4Command', $application->find('f::t')); } /** * @dataProvider provideInvalidCommandNamesSingle * @expectedException \InvalidArgumentException * @expectedExceptionMessage Did you mean this */ public function testFindAlternativeExceptionMessageSingle($name) { $application = new Application(); $application->add(new \Foo3Command()); $application->find($name); } public function provideInvalidCommandNamesSingle() { return array( array('foo3:baR'), array('foO3:bar') ); } public function testFindAlternativeExceptionMessageMultiple() { $application = new Application(); $application->add(new \FooCommand()); $application->add(new \Foo1Command()); $application->add(new \Foo2Command()); // Command + plural try { $application->find('foo:baR'); $this->fail('->find() throws an \InvalidArgumentException if command does not exist, with alternatives'); } catch (\Exception $e) { $this->assertInstanceOf('\InvalidArgumentException', $e, '->find() throws an \InvalidArgumentException if command does not exist, with alternatives'); $this->assertRegExp('/Did you mean one of these/', $e->getMessage(), '->find() throws an \InvalidArgumentException if command does not exist, with alternatives'); $this->assertRegExp('/foo1:bar/', $e->getMessage()); $this->assertRegExp('/foo:bar/', $e->getMessage()); } // Namespace + plural try { $application->find('foo2:bar'); $this->fail('->find() throws an \InvalidArgumentException if command does not exist, with alternatives'); } catch (\Exception $e) { $this->assertInstanceOf('\InvalidArgumentException', $e, '->find() throws an \InvalidArgumentException if command does not exist, with alternatives'); $this->assertRegExp('/Did you mean one of these/', $e->getMessage(), '->find() throws an \InvalidArgumentException if command does not exist, with alternatives'); $this->assertRegExp('/foo1/', $e->getMessage()); } $application->add(new \Foo3Command()); $application->add(new \Foo4Command()); // Subnamespace + plural try { $a = $application->find('foo3:'); $this->fail('->find() should throw an \InvalidArgumentException if a command is ambiguous because of a subnamespace, with alternatives'); } catch (\Exception $e) { $this->assertInstanceOf('\InvalidArgumentException', $e); $this->assertRegExp('/foo3:bar/', $e->getMessage()); $this->assertRegExp('/foo3:bar:toh/', $e->getMessage()); } } public function testFindAlternativeCommands() { $application = new Application(); $application->add(new \FooCommand()); $application->add(new \Foo1Command()); $application->add(new \Foo2Command()); try { $application->find($commandName = 'Unknown command'); $this->fail('->find() throws an \InvalidArgumentException if command does not exist'); } catch (\Exception $e) { $this->assertInstanceOf('\InvalidArgumentException', $e, '->find() throws an \InvalidArgumentException if command does not exist'); $this->assertEquals(sprintf('Command "%s" is not defined.', $commandName), $e->getMessage(), '->find() throws an \InvalidArgumentException if command does not exist, without alternatives'); } // Test if "bar1" command throw an "\InvalidArgumentException" and does not contain // "foo:bar" as alternative because "bar1" is too far from "foo:bar" try { $application->find($commandName = 'bar1'); $this->fail('->find() throws an \InvalidArgumentException if command does not exist'); } catch (\Exception $e) { $this->assertInstanceOf('\InvalidArgumentException', $e, '->find() throws an \InvalidArgumentException if command does not exist'); $this->assertRegExp(sprintf('/Command "%s" is not defined./', $commandName), $e->getMessage(), '->find() throws an \InvalidArgumentException if command does not exist, with alternatives'); $this->assertRegExp('/afoobar1/', $e->getMessage(), '->find() throws an \InvalidArgumentException if command does not exist, with alternative : "afoobar1"'); $this->assertRegExp('/foo:bar1/', $e->getMessage(), '->find() throws an \InvalidArgumentException if command does not exist, with alternative : "foo:bar1"'); $this->assertNotRegExp('/foo:bar(?>!1)/', $e->getMessage(), '->find() throws an \InvalidArgumentException if command does not exist, without "foo:bar" alternative'); } } public function testFindAlternativeCommandsWithAnAlias() { $fooCommand = new \FooCommand(); $fooCommand->setAliases(array('foo2')); $application = new Application(); $application->add($fooCommand); $result = $application->find('foo'); $this->assertSame($fooCommand, $result); } public function testFindAlternativeNamespace() { $application = new Application(); $application->add(new \FooCommand()); $application->add(new \Foo1Command()); $application->add(new \Foo2Command()); $application->add(new \foo3Command()); try { $application->find('Unknown-namespace:Unknown-command'); $this->fail('->find() throws an \InvalidArgumentException if namespace does not exist'); } catch (\Exception $e) { $this->assertInstanceOf('\InvalidArgumentException', $e, '->find() throws an \InvalidArgumentException if namespace does not exist'); $this->assertEquals('There are no commands defined in the "Unknown-namespace" namespace.', $e->getMessage(), '->find() throws an \InvalidArgumentException if namespace does not exist, without alternatives'); } try { $application->find('foo2:command'); $this->fail('->find() throws an \InvalidArgumentException if namespace does not exist'); } catch (\Exception $e) { $this->assertInstanceOf('\InvalidArgumentException', $e, '->find() throws an \InvalidArgumentException if namespace does not exist'); $this->assertRegExp('/There are no commands defined in the "foo2" namespace./', $e->getMessage(), '->find() throws an \InvalidArgumentException if namespace does not exist, with alternative'); $this->assertRegExp('/foo/', $e->getMessage(), '->find() throws an \InvalidArgumentException if namespace does not exist, with alternative : "foo"'); $this->assertRegExp('/foo1/', $e->getMessage(), '->find() throws an \InvalidArgumentException if namespace does not exist, with alternative : "foo1"'); $this->assertRegExp('/foo3/', $e->getMessage(), '->find() throws an \InvalidArgumentException if namespace does not exist, with alternative : "foo3"'); } } public function testFindNamespaceDoesNotFailOnDeepSimilarNamespaces() { $application = $this->getMock('Symfony\Component\Console\Application', array('getNamespaces')); $application->expects($this->once()) ->method('getNamespaces') ->will($this->returnValue(array('foo:sublong', 'bar:sub'))); $this->assertEquals('foo:sublong', $application->findNamespace('f:sub')); } public function testSetCatchExceptions() { $application = $this->getMock('Symfony\Component\Console\Application', array('getTerminalWidth')); $application->setAutoExit(false); $application->expects($this->any()) ->method('getTerminalWidth') ->will($this->returnValue(120)); $tester = new ApplicationTester($application); $application->setCatchExceptions(true); $tester->run(array('command' => 'foo'), array('decorated' => false)); $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception1.txt', $tester->getDisplay(true), '->setCatchExceptions() sets the catch exception flag'); $application->setCatchExceptions(false); try { $tester->run(array('command' => 'foo'), array('decorated' => false)); $this->fail('->setCatchExceptions() sets the catch exception flag'); } catch (\Exception $e) { $this->assertInstanceOf('\Exception', $e, '->setCatchExceptions() sets the catch exception flag'); $this->assertEquals('Command "foo" is not defined.', $e->getMessage(), '->setCatchExceptions() sets the catch exception flag'); } } public function testAsText() { $application = new Application(); $application->add(new \FooCommand()); $this->ensureStaticCommandHelp($application); $this->assertStringEqualsFile(self::$fixturesPath.'/application_astext1.txt', $this->normalizeLineBreaks($application->asText()), '->asText() returns a text representation of the application'); $this->assertStringEqualsFile(self::$fixturesPath.'/application_astext2.txt', $this->normalizeLineBreaks($application->asText('foo')), '->asText() returns a text representation of the application'); } public function testAsXml() { $application = new Application(); $application->add(new \FooCommand()); $this->ensureStaticCommandHelp($application); $this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/application_asxml1.txt', $application->asXml(), '->asXml() returns an XML representation of the application'); $this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/application_asxml2.txt', $application->asXml('foo'), '->asXml() returns an XML representation of the application'); } public function testRenderException() { $application = $this->getMock('Symfony\Component\Console\Application', array('getTerminalWidth')); $application->setAutoExit(false); $application->expects($this->any()) ->method('getTerminalWidth') ->will($this->returnValue(120)); $tester = new ApplicationTester($application); $tester->run(array('command' => 'foo'), array('decorated' => false)); $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception1.txt', $tester->getDisplay(true), '->renderException() renders a pretty exception'); $tester->run(array('command' => 'foo'), array('decorated' => false, 'verbosity' => Output::VERBOSITY_VERBOSE)); $this->assertContains('Exception trace', $tester->getDisplay(), '->renderException() renders a pretty exception with a stack trace when verbosity is verbose'); $tester->run(array('command' => 'list', '--foo' => true), array('decorated' => false)); $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception2.txt', $tester->getDisplay(true), '->renderException() renders the command synopsis when an exception occurs in the context of a command'); $application->add(new \Foo3Command()); $tester = new ApplicationTester($application); $tester->run(array('command' => 'foo3:bar'), array('decorated' => false)); $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception3.txt', $tester->getDisplay(true), '->renderException() renders a pretty exceptions with previous exceptions'); $tester->run(array('command' => 'foo3:bar'), array('decorated' => true)); $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception3decorated.txt', $tester->getDisplay(true), '->renderException() renders a pretty exceptions with previous exceptions'); $application = $this->getMock('Symfony\Component\Console\Application', array('getTerminalWidth')); $application->setAutoExit(false); $application->expects($this->any()) ->method('getTerminalWidth') ->will($this->returnValue(32)); $tester = new ApplicationTester($application); $tester->run(array('command' => 'foo'), array('decorated' => false)); $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception4.txt', $tester->getDisplay(true), '->renderException() wraps messages when they are bigger than the terminal'); } public function testRun() { $application = new Application(); $application->setAutoExit(false); $application->setCatchExceptions(false); $application->add($command = new \Foo1Command()); $_SERVER['argv'] = array('cli.php', 'foo:bar1'); ob_start(); $application->run(); ob_end_clean(); $this->assertInstanceOf('Symfony\Component\Console\Input\ArgvInput', $command->input, '->run() creates an ArgvInput by default if none is given'); $this->assertInstanceOf('Symfony\Component\Console\Output\ConsoleOutput', $command->output, '->run() creates a ConsoleOutput by default if none is given'); $application = new Application(); $application->setAutoExit(false); $application->setCatchExceptions(false); $this->ensureStaticCommandHelp($application); $tester = new ApplicationTester($application); $tester->run(array(), array('decorated' => false)); $this->assertStringEqualsFile(self::$fixturesPath.'/application_run1.txt', $tester->getDisplay(true), '->run() runs the list command if no argument is passed'); $tester->run(array('--help' => true), array('decorated' => false)); $this->assertStringEqualsFile(self::$fixturesPath.'/application_run2.txt', $tester->getDisplay(true), '->run() runs the help command if --help is passed'); $tester->run(array('-h' => true), array('decorated' => false)); $this->assertStringEqualsFile(self::$fixturesPath.'/application_run2.txt', $tester->getDisplay(true), '->run() runs the help command if -h is passed'); $tester->run(array('command' => 'list', '--help' => true), array('decorated' => false)); $this->assertStringEqualsFile(self::$fixturesPath.'/application_run3.txt', $tester->getDisplay(true), '->run() displays the help if --help is passed'); $tester->run(array('command' => 'list', '-h' => true), array('decorated' => false)); $this->assertStringEqualsFile(self::$fixturesPath.'/application_run3.txt', $tester->getDisplay(true), '->run() displays the help if -h is passed'); $tester->run(array('--ansi' => true)); $this->assertTrue($tester->getOutput()->isDecorated(), '->run() forces color output if --ansi is passed'); $tester->run(array('--no-ansi' => true)); $this->assertFalse($tester->getOutput()->isDecorated(), '->run() forces color output to be disabled if --no-ansi is passed'); $tester->run(array('--version' => true), array('decorated' => false)); $this->assertStringEqualsFile(self::$fixturesPath.'/application_run4.txt', $tester->getDisplay(true), '->run() displays the program version if --version is passed'); $tester->run(array('-V' => true), array('decorated' => false)); $this->assertStringEqualsFile(self::$fixturesPath.'/application_run4.txt', $tester->getDisplay(true), '->run() displays the program version if -v is passed'); $tester->run(array('command' => 'list', '--quiet' => true)); $this->assertSame('', $tester->getDisplay(), '->run() removes all output if --quiet is passed'); $tester->run(array('command' => 'list', '-q' => true)); $this->assertSame('', $tester->getDisplay(), '->run() removes all output if -q is passed'); $tester->run(array('command' => 'list', '--verbose' => true)); $this->assertSame(Output::VERBOSITY_VERBOSE, $tester->getOutput()->getVerbosity(), '->run() sets the output to verbose if --verbose is passed'); $tester->run(array('command' => 'list', '--verbose' => 1)); $this->assertSame(Output::VERBOSITY_VERBOSE, $tester->getOutput()->getVerbosity(), '->run() sets the output to verbose if --verbose=1 is passed'); $tester->run(array('command' => 'list', '--verbose' => 2)); $this->assertSame(Output::VERBOSITY_VERY_VERBOSE, $tester->getOutput()->getVerbosity(), '->run() sets the output to very verbose if --verbose=2 is passed'); $tester->run(array('command' => 'list', '--verbose' => 3)); $this->assertSame(Output::VERBOSITY_DEBUG, $tester->getOutput()->getVerbosity(), '->run() sets the output to debug if --verbose=3 is passed'); $tester->run(array('command' => 'list', '--verbose' => 4)); $this->assertSame(Output::VERBOSITY_VERBOSE, $tester->getOutput()->getVerbosity(), '->run() sets the output to verbose if unknown --verbose level is passed'); $tester->run(array('command' => 'list', '-v' => true)); $this->assertSame(Output::VERBOSITY_VERBOSE, $tester->getOutput()->getVerbosity(), '->run() sets the output to verbose if -v is passed'); $tester->run(array('command' => 'list', '-vv' => true)); $this->assertSame(Output::VERBOSITY_VERY_VERBOSE, $tester->getOutput()->getVerbosity(), '->run() sets the output to verbose if -v is passed'); $tester->run(array('command' => 'list', '-vvv' => true)); $this->assertSame(Output::VERBOSITY_DEBUG, $tester->getOutput()->getVerbosity(), '->run() sets the output to verbose if -v is passed'); $application = new Application(); $application->setAutoExit(false); $application->setCatchExceptions(false); $application->add(new \FooCommand()); $tester = new ApplicationTester($application); $tester->run(array('command' => 'foo:bar', '--no-interaction' => true), array('decorated' => false)); $this->assertSame('called'.PHP_EOL, $tester->getDisplay(), '->run() does not call interact() if --no-interaction is passed'); $tester->run(array('command' => 'foo:bar', '-n' => true), array('decorated' => false)); $this->assertSame('called'.PHP_EOL, $tester->getDisplay(), '->run() does not call interact() if -n is passed'); } /** * Issue #9285 * * If the "verbose" option is just before an argument in ArgvInput, * an argument value should not be treated as verbosity value. * This test will fail with "Not enough arguments." if broken */ public function testVerboseValueNotBreakArguments() { $application = new Application(); $application->setAutoExit(false); $application->setCatchExceptions(false); $application->add(new \FooCommand()); $output = new StreamOutput(fopen('php://memory', 'w', false)); $input = new ArgvInput(array('cli.php', '-v', 'foo:bar')); $application->run($input, $output); $input = new ArgvInput(array('cli.php', '--verbose', 'foo:bar')); $application->run($input, $output); } public function testRunReturnsIntegerExitCode() { $exception = new \Exception('', 4); $application = $this->getMock('Symfony\Component\Console\Application', array('doRun')); $application->setAutoExit(false); $application->expects($this->once()) ->method('doRun') ->will($this->throwException($exception)); $exitCode = $application->run(new ArrayInput(array()), new NullOutput()); $this->assertSame(4, $exitCode, '->run() returns integer exit code extracted from raised exception'); } public function testRunReturnsExitCodeOneForExceptionCodeZero() { $exception = new \Exception('', 0); $application = $this->getMock('Symfony\Component\Console\Application', array('doRun')); $application->setAutoExit(false); $application->expects($this->once()) ->method('doRun') ->will($this->throwException($exception)); $exitCode = $application->run(new ArrayInput(array()), new NullOutput()); $this->assertSame(1, $exitCode, '->run() returns exit code 1 when exception code is 0'); } /** * @expectedException \LogicException * @dataProvider getAddingAlreadySetDefinitionElementData */ public function testAddingAlreadySetDefinitionElementData($def) { $application = new Application(); $application->setAutoExit(false); $application->setCatchExceptions(false); $application ->register('foo') ->setDefinition(array($def)) ->setCode(function (InputInterface $input, OutputInterface $output) {}) ; $input = new ArrayInput(array('command' => 'foo')); $output = new NullOutput(); $application->run($input, $output); } public function getAddingAlreadySetDefinitionElementData() { return array( array(new InputArgument('command', InputArgument::REQUIRED)), array(new InputOption('quiet', '', InputOption::VALUE_NONE)), array(new InputOption('query', 'q', InputOption::VALUE_NONE)), ); } public function testGetDefaultHelperSetReturnsDefaultValues() { $application = new Application(); $application->setAutoExit(false); $application->setCatchExceptions(false); $helperSet = $application->getHelperSet(); $this->assertTrue($helperSet->has('formatter')); $this->assertTrue($helperSet->has('dialog')); $this->assertTrue($helperSet->has('progress')); } public function testAddingSingleHelperSetOverwritesDefaultValues() { $application = new Application(); $application->setAutoExit(false); $application->setCatchExceptions(false); $application->setHelperSet(new HelperSet(array(new FormatterHelper()))); $helperSet = $application->getHelperSet(); $this->assertTrue($helperSet->has('formatter')); // no other default helper set should be returned $this->assertFalse($helperSet->has('dialog')); $this->assertFalse($helperSet->has('progress')); } public function testOverwritingDefaultHelperSetOverwritesDefaultValues() { $application = new CustomApplication(); $application->setAutoExit(false); $application->setCatchExceptions(false); $application->setHelperSet(new HelperSet(array(new FormatterHelper()))); $helperSet = $application->getHelperSet(); $this->assertTrue($helperSet->has('formatter')); // no other default helper set should be returned $this->assertFalse($helperSet->has('dialog')); $this->assertFalse($helperSet->has('progress')); } public function testGetDefaultInputDefinitionReturnsDefaultValues() { $application = new Application(); $application->setAutoExit(false); $application->setCatchExceptions(false); $inputDefinition = $application->getDefinition(); $this->assertTrue($inputDefinition->hasArgument('command')); $this->assertTrue($inputDefinition->hasOption('help')); $this->assertTrue($inputDefinition->hasOption('quiet')); $this->assertTrue($inputDefinition->hasOption('verbose')); $this->assertTrue($inputDefinition->hasOption('version')); $this->assertTrue($inputDefinition->hasOption('ansi')); $this->assertTrue($inputDefinition->hasOption('no-ansi')); $this->assertTrue($inputDefinition->hasOption('no-interaction')); } public function testOverwritingDefaultInputDefinitionOverwritesDefaultValues() { $application = new CustomApplication(); $application->setAutoExit(false); $application->setCatchExceptions(false); $inputDefinition = $application->getDefinition(); // check whether the default arguments and options are not returned any more $this->assertFalse($inputDefinition->hasArgument('command')); $this->assertFalse($inputDefinition->hasOption('help')); $this->assertFalse($inputDefinition->hasOption('quiet')); $this->assertFalse($inputDefinition->hasOption('verbose')); $this->assertFalse($inputDefinition->hasOption('version')); $this->assertFalse($inputDefinition->hasOption('ansi')); $this->assertFalse($inputDefinition->hasOption('no-ansi')); $this->assertFalse($inputDefinition->hasOption('no-interaction')); $this->assertTrue($inputDefinition->hasOption('custom')); } public function testSettingCustomInputDefinitionOverwritesDefaultValues() { $application = new Application(); $application->setAutoExit(false); $application->setCatchExceptions(false); $application->setDefinition(new InputDefinition(array(new InputOption('--custom', '-c', InputOption::VALUE_NONE, 'Set the custom input definition.')))); $inputDefinition = $application->getDefinition(); // check whether the default arguments and options are not returned any more $this->assertFalse($inputDefinition->hasArgument('command')); $this->assertFalse($inputDefinition->hasOption('help')); $this->assertFalse($inputDefinition->hasOption('quiet')); $this->assertFalse($inputDefinition->hasOption('verbose')); $this->assertFalse($inputDefinition->hasOption('version')); $this->assertFalse($inputDefinition->hasOption('ansi')); $this->assertFalse($inputDefinition->hasOption('no-ansi')); $this->assertFalse($inputDefinition->hasOption('no-interaction')); $this->assertTrue($inputDefinition->hasOption('custom')); } public function testRunWithDispatcher() { $application = new Application(); $application->setAutoExit(false); $application->setDispatcher($this->getDispatcher()); $application->register('foo')->setCode(function (InputInterface $input, OutputInterface $output) { $output->write('foo.'); }); $tester = new ApplicationTester($application); $tester->run(array('command' => 'foo')); $this->assertEquals('before.foo.after.', $tester->getDisplay()); } /** * @expectedException \LogicException * @expectedExceptionMessage caught */ public function testRunWithExceptionAndDispatcher() { $application = new Application(); $application->setDispatcher($this->getDispatcher()); $application->setAutoExit(false); $application->setCatchExceptions(false); $application->register('foo')->setCode(function (InputInterface $input, OutputInterface $output) { throw new \RuntimeException('foo'); }); $tester = new ApplicationTester($application); $tester->run(array('command' => 'foo')); } public function testRunDispatchesAllEventsWithException() { $application = new Application(); $application->setDispatcher($this->getDispatcher()); $application->setAutoExit(false); $application->register('foo')->setCode(function (InputInterface $input, OutputInterface $output) { $output->write('foo.'); throw new \RuntimeException('foo'); }); $tester = new ApplicationTester($application); $tester->run(array('command' => 'foo')); $this->assertContains('before.foo.after.caught.', $tester->getDisplay()); } public function testTerminalDimensions() { $application = new Application(); $originalDimensions = $application->getTerminalDimensions(); $this->assertCount(2, $originalDimensions); $width = 80; if ($originalDimensions[0] == $width) { $width = 100; } $application->setTerminalDimensions($width, 80); $this->assertSame(array($width, 80), $application->getTerminalDimensions()); } protected function getDispatcher() { $dispatcher = new EventDispatcher(); $dispatcher->addListener('console.command', function (ConsoleCommandEvent $event) { $event->getOutput()->write('before.'); }); $dispatcher->addListener('console.terminate', function (ConsoleTerminateEvent $event) { $event->getOutput()->write('after.'); $event->setExitCode(128); }); $dispatcher->addListener('console.exception', function (ConsoleExceptionEvent $event) { $event->getOutput()->writeln('caught.'); $event->setException(new \LogicException('caught.', $event->getExitCode(), $event->getException())); }); return $dispatcher; } } class CustomApplication extends Application { /** * Overwrites the default input definition. * * @return InputDefinition An InputDefinition instance */ protected function getDefaultInputDefinition() { return new InputDefinition(array(new InputOption('--custom', '-c', InputOption::VALUE_NONE, 'Set the custom input definition.'))); } /** * Gets the default helper set with the helpers that should always be available. * * @return HelperSet A HelperSet instance */ protected function getDefaultHelperSet() { return new HelperSet(array(new FormatterHelper())); } } PK.j]o"Z9Z97Symfony/Component/Console/Tests/Command/CommandTest.phpnu[ * * 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 Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Helper\FormatterHelper; use Symfony\Component\Console\Application; use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\StringInput; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\NullOutput; use Symfony\Component\Console\Tester\CommandTester; class CommandTest extends \PHPUnit_Framework_TestCase { protected static $fixturesPath; public static function setUpBeforeClass() { self::$fixturesPath = __DIR__.'/../Fixtures/'; require_once self::$fixturesPath.'/TestCommand.php'; } public function testConstructor() { $command = new Command('foo:bar'); $this->assertEquals('foo:bar', $command->getName(), '__construct() takes the command name as its first argument'); } /** * @expectedException \LogicException * @expectedExceptionMessage The command name cannot be empty. */ public function testCommandNameCannotBeEmpty() { new Command(); } public function testSetApplication() { $application = new Application(); $command = new \TestCommand(); $command->setApplication($application); $this->assertEquals($application, $command->getApplication(), '->setApplication() sets the current application'); } public function testSetGetDefinition() { $command = new \TestCommand(); $ret = $command->setDefinition($definition = new InputDefinition()); $this->assertEquals($command, $ret, '->setDefinition() implements a fluent interface'); $this->assertEquals($definition, $command->getDefinition(), '->setDefinition() sets the current InputDefinition instance'); $command->setDefinition(array(new InputArgument('foo'), new InputOption('bar'))); $this->assertTrue($command->getDefinition()->hasArgument('foo'), '->setDefinition() also takes an array of InputArguments and InputOptions as an argument'); $this->assertTrue($command->getDefinition()->hasOption('bar'), '->setDefinition() also takes an array of InputArguments and InputOptions as an argument'); $command->setDefinition(new InputDefinition()); } public function testAddArgument() { $command = new \TestCommand(); $ret = $command->addArgument('foo'); $this->assertEquals($command, $ret, '->addArgument() implements a fluent interface'); $this->assertTrue($command->getDefinition()->hasArgument('foo'), '->addArgument() adds an argument to the command'); } public function testAddOption() { $command = new \TestCommand(); $ret = $command->addOption('foo'); $this->assertEquals($command, $ret, '->addOption() implements a fluent interface'); $this->assertTrue($command->getDefinition()->hasOption('foo'), '->addOption() adds an option to the command'); } public function testGetNamespaceGetNameSetName() { $command = new \TestCommand(); $this->assertEquals('namespace:name', $command->getName(), '->getName() returns the command name'); $command->setName('foo'); $this->assertEquals('foo', $command->getName(), '->setName() sets the command name'); $ret = $command->setName('foobar:bar'); $this->assertEquals($command, $ret, '->setName() implements a fluent interface'); $this->assertEquals('foobar:bar', $command->getName(), '->setName() sets the command name'); } /** * @dataProvider provideInvalidCommandNames */ public function testInvalidCommandNames($name) { $this->setExpectedException('InvalidArgumentException', sprintf('Command name "%s" is invalid.', $name)); $command = new \TestCommand(); $command->setName($name); } public function provideInvalidCommandNames() { return array( array(''), array('foo:') ); } public function testGetSetDescription() { $command = new \TestCommand(); $this->assertEquals('description', $command->getDescription(), '->getDescription() returns the description'); $ret = $command->setDescription('description1'); $this->assertEquals($command, $ret, '->setDescription() implements a fluent interface'); $this->assertEquals('description1', $command->getDescription(), '->setDescription() sets the description'); } public function testGetSetHelp() { $command = new \TestCommand(); $this->assertEquals('help', $command->getHelp(), '->getHelp() returns the help'); $ret = $command->setHelp('help1'); $this->assertEquals($command, $ret, '->setHelp() implements a fluent interface'); $this->assertEquals('help1', $command->getHelp(), '->setHelp() sets the help'); } public function testGetProcessedHelp() { $command = new \TestCommand(); $command->setHelp('The %command.name% command does... Example: php %command.full_name%.'); $this->assertContains('The namespace:name command does...', $command->getProcessedHelp(), '->getProcessedHelp() replaces %command.name% correctly'); $this->assertNotContains('%command.full_name%', $command->getProcessedHelp(), '->getProcessedHelp() replaces %command.full_name%'); } public function testGetSetAliases() { $command = new \TestCommand(); $this->assertEquals(array('name'), $command->getAliases(), '->getAliases() returns the aliases'); $ret = $command->setAliases(array('name1')); $this->assertEquals($command, $ret, '->setAliases() implements a fluent interface'); $this->assertEquals(array('name1'), $command->getAliases(), '->setAliases() sets the aliases'); } public function testGetSynopsis() { $command = new \TestCommand(); $command->addOption('foo'); $command->addArgument('foo'); $this->assertEquals('namespace:name [--foo] [foo]', $command->getSynopsis(), '->getSynopsis() returns the synopsis'); } public function testGetHelper() { $application = new Application(); $command = new \TestCommand(); $command->setApplication($application); $formatterHelper = new FormatterHelper(); $this->assertEquals($formatterHelper->getName(), $command->getHelper('formatter')->getName(), '->getHelper() returns the correct helper'); } public function testGet() { $application = new Application(); $command = new \TestCommand(); $command->setApplication($application); $formatterHelper = new FormatterHelper(); $this->assertEquals($formatterHelper->getName(), $command->getHelper('formatter')->getName(), '->__get() returns the correct helper'); } public function testMergeApplicationDefinition() { $application1 = new Application(); $application1->getDefinition()->addArguments(array(new InputArgument('foo'))); $application1->getDefinition()->addOptions(array(new InputOption('bar'))); $command = new \TestCommand(); $command->setApplication($application1); $command->setDefinition($definition = new InputDefinition(array(new InputArgument('bar'), new InputOption('foo')))); $r = new \ReflectionObject($command); $m = $r->getMethod('mergeApplicationDefinition'); $m->setAccessible(true); $m->invoke($command); $this->assertTrue($command->getDefinition()->hasArgument('foo'), '->mergeApplicationDefinition() merges the application arguments and the command arguments'); $this->assertTrue($command->getDefinition()->hasArgument('bar'), '->mergeApplicationDefinition() merges the application arguments and the command arguments'); $this->assertTrue($command->getDefinition()->hasOption('foo'), '->mergeApplicationDefinition() merges the application options and the command options'); $this->assertTrue($command->getDefinition()->hasOption('bar'), '->mergeApplicationDefinition() merges the application options and the command options'); $m->invoke($command); $this->assertEquals(3, $command->getDefinition()->getArgumentCount(), '->mergeApplicationDefinition() does not try to merge twice the application arguments and options'); } public function testMergeApplicationDefinitionWithoutArgsThenWithArgsAddsArgs() { $application1 = new Application(); $application1->getDefinition()->addArguments(array(new InputArgument('foo'))); $application1->getDefinition()->addOptions(array(new InputOption('bar'))); $command = new \TestCommand(); $command->setApplication($application1); $command->setDefinition($definition = new InputDefinition(array())); $r = new \ReflectionObject($command); $m = $r->getMethod('mergeApplicationDefinition'); $m->setAccessible(true); $m->invoke($command, false); $this->assertTrue($command->getDefinition()->hasOption('bar'), '->mergeApplicationDefinition(false) merges the application and the commmand options'); $this->assertFalse($command->getDefinition()->hasArgument('foo'), '->mergeApplicationDefinition(false) does not merge the application arguments'); $m->invoke($command, true); $this->assertTrue($command->getDefinition()->hasArgument('foo'), '->mergeApplicationDefinition(true) merges the application arguments and the command arguments'); $m->invoke($command); $this->assertEquals(2, $command->getDefinition()->getArgumentCount(), '->mergeApplicationDefinition() does not try to merge twice the application arguments'); } public function testRunInteractive() { $tester = new CommandTester(new \TestCommand()); $tester->execute(array(), array('interactive' => true)); $this->assertEquals('interact called'.PHP_EOL.'execute called'.PHP_EOL, $tester->getDisplay(), '->run() calls the interact() method if the input is interactive'); } public function testRunNonInteractive() { $tester = new CommandTester(new \TestCommand()); $tester->execute(array(), array('interactive' => false)); $this->assertEquals('execute called'.PHP_EOL, $tester->getDisplay(), '->run() does not call the interact() method if the input is not interactive'); } /** * @expectedException \LogicException * @expectedExceptionMessage You must override the execute() method in the concrete command class. */ public function testExecuteMethodNeedsToBeOverriden() { $command = new Command('foo'); $command->run(new StringInput(''), new NullOutput()); } /** * @expectedException \InvalidArgumentException * @expectedExceptionMessage The "--bar" option does not exist. */ public function testRunWithInvalidOption() { $command = new \TestCommand(); $tester = new CommandTester($command); $tester->execute(array('--bar' => true)); } public function testRunReturnsIntegerExitCode() { $command = new \TestCommand(); $exitCode = $command->run(new StringInput(''), new NullOutput()); $this->assertSame(0, $exitCode, '->run() returns integer exit code (treats null as 0)'); $command = $this->getMock('TestCommand', array('execute')); $command->expects($this->once()) ->method('execute') ->will($this->returnValue('2.3')); $exitCode = $command->run(new StringInput(''), new NullOutput()); $this->assertSame(2, $exitCode, '->run() returns integer exit code (casts numeric to int)'); } public function testRunReturnsAlwaysInteger() { $command = new \TestCommand(); $this->assertSame(0, $command->run(new StringInput(''), new NullOutput())); } public function testSetCode() { $command = new \TestCommand(); $ret = $command->setCode(function (InputInterface $input, OutputInterface $output) { $output->writeln('from the code...'); }); $this->assertEquals($command, $ret, '->setCode() implements a fluent interface'); $tester = new CommandTester($command); $tester->execute(array()); $this->assertEquals('interact called'.PHP_EOL.'from the code...'.PHP_EOL, $tester->getDisplay()); } public function testSetCodeWithNonClosureCallable() { $command = new \TestCommand(); $ret = $command->setCode(array($this, 'callableMethodCommand')); $this->assertEquals($command, $ret, '->setCode() implements a fluent interface'); $tester = new CommandTester($command); $tester->execute(array()); $this->assertEquals('interact called'.PHP_EOL.'from the code...'.PHP_EOL, $tester->getDisplay()); } /** * @expectedException \InvalidArgumentException * @expectedExceptionMessage Invalid callable provided to Command::setCode. */ public function testSetCodeWithNonCallable() { $command = new \TestCommand(); $command->setCode(array($this, 'nonExistentMethod')); } public function callableMethodCommand(InputInterface $input, OutputInterface $output) { $output->writeln('from the code...'); } public function testAsText() { $command = new \TestCommand(); $command->setApplication(new Application()); $tester = new CommandTester($command); $tester->execute(array('command' => $command->getName())); $this->assertStringEqualsFile(self::$fixturesPath.'/command_astext.txt', $command->asText(), '->asText() returns a text representation of the command'); } public function testAsXml() { $command = new \TestCommand(); $command->setApplication(new Application()); $tester = new CommandTester($command); $tester->execute(array('command' => $command->getName())); $this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/command_asxml.txt', $command->asXml(), '->asXml() returns an XML representation of the command'); } } PK.j]by1 1 ;Symfony/Component/Console/Tests/Command/HelpCommandTest.phpnu[ * * 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 Symfony\Component\Console\Tester\CommandTester; use Symfony\Component\Console\Command\HelpCommand; use Symfony\Component\Console\Command\ListCommand; use Symfony\Component\Console\Application; class HelpCommandTest extends \PHPUnit_Framework_TestCase { public function testExecuteForCommandAlias() { $command = new HelpCommand(); $command->setApplication(new Application()); $commandTester = new CommandTester($command); $commandTester->execute(array('command_name' => 'li')); $this->assertRegExp('/list \[--xml\] \[--raw\] \[--format="\.\.\."\] \[namespace\]/', $commandTester->getDisplay(), '->execute() returns a text help for the given command alias'); } public function testExecuteForCommand() { $command = new HelpCommand(); $commandTester = new CommandTester($command); $command->setCommand(new ListCommand()); $commandTester->execute(array()); $this->assertRegExp('/list \[--xml\] \[--raw\] \[--format="\.\.\."\] \[namespace\]/', $commandTester->getDisplay(), '->execute() returns a text help for the given command'); } public function testExecuteForCommandWithXmlOption() { $command = new HelpCommand(); $commandTester = new CommandTester($command); $command->setCommand(new ListCommand()); $commandTester->execute(array('--format' => 'xml')); $this->assertRegExp('/getDisplay(), '->execute() returns an XML help text if --xml is passed'); } public function testExecuteForApplicationCommand() { $application = new Application(); $commandTester = new CommandTester($application->get('help')); $commandTester->execute(array('command_name' => 'list')); $this->assertRegExp('/list \[--xml\] \[--raw\] \[--format="\.\.\."\] \[namespace\]/', $commandTester->getDisplay(), '->execute() returns a text help for the given command'); } public function testExecuteForApplicationCommandWithXmlOption() { $application = new Application(); $commandTester = new CommandTester($application->get('help')); $commandTester->execute(array('command_name' => 'list', '--format' => 'xml')); $this->assertRegExp('/list \[--xml\] \[--raw\] \[--format="\.\.\."\] \[namespace\]/', $commandTester->getDisplay(), '->execute() returns a text help for the given command'); $this->assertRegExp('/getDisplay(), '->execute() returns an XML help text if --format=xml is passed'); } } PK.j]C C ;Symfony/Component/Console/Tests/Command/ListCommandTest.phpnu[ * * 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 Symfony\Component\Console\Tester\CommandTester; use Symfony\Component\Console\Application; class ListCommandTest extends \PHPUnit_Framework_TestCase { public function testExecuteListsCommands() { $application = new Application(); $commandTester = new CommandTester($command = $application->get('list')); $commandTester->execute(array('command' => $command->getName()), array('decorated' => false)); $this->assertRegExp('/help Displays help for a command/', $commandTester->getDisplay(), '->execute() returns a list of available commands'); } public function testExecuteListsCommandsWithXmlOption() { $application = new Application(); $commandTester = new CommandTester($command = $application->get('list')); $commandTester->execute(array('command' => $command->getName(), '--format' => 'xml')); $this->assertRegExp('//', $commandTester->getDisplay(), '->execute() returns a list of available commands in XML if --xml is passed'); } public function testExecuteListsCommandsWithRawOption() { $application = new Application(); $commandTester = new CommandTester($command = $application->get('list')); $commandTester->execute(array('command' => $command->getName(), '--raw' => true)); $output = <<assertEquals($output, $commandTester->getDisplay(true)); } public function testExecuteListsCommandsWithNamespaceArgument() { require_once(realpath(__DIR__.'/../Fixtures/FooCommand.php')); $application = new Application(); $application->add(new \FooCommand()); $commandTester = new CommandTester($command = $application->get('list')); $commandTester->execute(array('command' => $command->getName(), 'namespace' => 'foo', '--raw' => true)); $output = <<assertEquals($output, $commandTester->getDisplay(true)); } } PK.j]Qd d @Symfony/Component/Console/Tests/Tester/ApplicationTesterTest.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Tester; use Symfony\Component\Console\Application; use Symfony\Component\Console\Output\Output; use Symfony\Component\Console\Tester\ApplicationTester; class ApplicationTesterTest extends \PHPUnit_Framework_TestCase { protected $application; protected $tester; protected function setUp() { $this->application = new Application(); $this->application->setAutoExit(false); $this->application->register('foo') ->addArgument('foo') ->setCode(function ($input, $output) { $output->writeln('foo'); }) ; $this->tester = new ApplicationTester($this->application); $this->tester->run(array('command' => 'foo', 'foo' => 'bar'), array('interactive' => false, 'decorated' => false, 'verbosity' => Output::VERBOSITY_VERBOSE)); } protected function tearDown() { $this->application = null; $this->tester = null; } public function testRun() { $this->assertFalse($this->tester->getInput()->isInteractive(), '->execute() takes an interactive option'); $this->assertFalse($this->tester->getOutput()->isDecorated(), '->execute() takes a decorated option'); $this->assertEquals(Output::VERBOSITY_VERBOSE, $this->tester->getOutput()->getVerbosity(), '->execute() takes a verbosity option'); } public function testGetInput() { $this->assertEquals('bar', $this->tester->getInput()->getArgument('foo'), '->getInput() returns the current input instance'); } 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'); } public function testGetDisplay() { $this->assertEquals('foo'.PHP_EOL, $this->tester->getDisplay(), '->getDisplay() returns the display of the last execution'); } public function testGetStatusCode() { $this->assertSame(0, $this->tester->getStatusCode(), '->getStatusCode() returns the status code'); } } PK.j]x0mB B <Symfony/Component/Console/Tests/Tester/CommandTesterTest.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Tester; use Symfony\Component\Console\Application; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Output\Output; use Symfony\Component\Console\Tester\CommandTester; class CommandTesterTest extends \PHPUnit_Framework_TestCase { protected $command; protected $tester; protected function setUp() { $this->command = new Command('foo'); $this->command->addArgument('command'); $this->command->addArgument('foo'); $this->command->setCode(function ($input, $output) { $output->writeln('foo'); }); $this->tester = new CommandTester($this->command); $this->tester->execute(array('foo' => 'bar'), array('interactive' => false, 'decorated' => false, 'verbosity' => Output::VERBOSITY_VERBOSE)); } protected function tearDown() { $this->command = null; $this->tester = null; } public function testExecute() { $this->assertFalse($this->tester->getInput()->isInteractive(), '->execute() takes an interactive option'); $this->assertFalse($this->tester->getOutput()->isDecorated(), '->execute() takes a decorated option'); $this->assertEquals(Output::VERBOSITY_VERBOSE, $this->tester->getOutput()->getVerbosity(), '->execute() takes a verbosity option'); } public function testGetInput() { $this->assertEquals('bar', $this->tester->getInput()->getArgument('foo'), '->getInput() returns the current input instance'); } 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'); } public function testGetDisplay() { $this->assertEquals('foo'.PHP_EOL, $this->tester->getDisplay(), '->getDisplay() returns the display of the last execution'); } public function testGetStatusCode() { $this->assertSame(0, $this->tester->getStatusCode(), '->getStatusCode() returns the status code'); } public function testCommandFromApplication() { $application = new Application(); $application->setAutoExit(false); $command = new Command('foo'); $command->setCode(function ($input, $output) { $output->writeln('foo'); }); $application->add($command); $tester = new CommandTester($application->find('foo')); // check that there is no need to pass the command name here $this->assertEquals(0, $tester->execute(array())); } } PK.j]KU##9Symfony/Component/Console/Tests/Input/InputOptionTest.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Input; use Symfony\Component\Console\Input\InputOption; class InputOptionTest extends \PHPUnit_Framework_TestCase { public function testConstructor() { $option = new InputOption('foo'); $this->assertEquals('foo', $option->getName(), '__construct() takes a name as its first argument'); $option = new InputOption('--foo'); $this->assertEquals('foo', $option->getName(), '__construct() removes the leading -- of the option name'); } /** * @expectedException \InvalidArgumentException * @expectedExceptionMessage Impossible to have an option mode VALUE_IS_ARRAY if the option does not accept a value. */ public function testArrayModeWithoutValue() { new InputOption('foo', 'f', InputOption::VALUE_IS_ARRAY); } public function testShortcut() { $option = new InputOption('foo', 'f'); $this->assertEquals('f', $option->getShortcut(), '__construct() can take a shortcut as its second argument'); $option = new InputOption('foo', '-f|-ff|fff'); $this->assertEquals('f|ff|fff', $option->getShortcut(), '__construct() removes the leading - of the shortcuts'); $option = new InputOption('foo', array('f', 'ff', '-fff')); $this->assertEquals('f|ff|fff', $option->getShortcut(), '__construct() removes the leading - of the shortcuts'); $option = new InputOption('foo'); $this->assertNull($option->getShortcut(), '__construct() makes the shortcut null by default'); } public function testModes() { $option = new InputOption('foo', 'f'); $this->assertFalse($option->acceptValue(), '__construct() gives a "InputOption::VALUE_NONE" mode by default'); $this->assertFalse($option->isValueRequired(), '__construct() gives a "InputOption::VALUE_NONE" mode by default'); $this->assertFalse($option->isValueOptional(), '__construct() gives a "InputOption::VALUE_NONE" mode by default'); $option = new InputOption('foo', 'f', null); $this->assertFalse($option->acceptValue(), '__construct() can take "InputOption::VALUE_NONE" as its mode'); $this->assertFalse($option->isValueRequired(), '__construct() can take "InputOption::VALUE_NONE" as its mode'); $this->assertFalse($option->isValueOptional(), '__construct() can take "InputOption::VALUE_NONE" as its mode'); $option = new InputOption('foo', 'f', InputOption::VALUE_NONE); $this->assertFalse($option->acceptValue(), '__construct() can take "InputOption::VALUE_NONE" as its mode'); $this->assertFalse($option->isValueRequired(), '__construct() can take "InputOption::VALUE_NONE" as its mode'); $this->assertFalse($option->isValueOptional(), '__construct() can take "InputOption::VALUE_NONE" as its mode'); $option = new InputOption('foo', 'f', InputOption::VALUE_REQUIRED); $this->assertTrue($option->acceptValue(), '__construct() can take "InputOption::VALUE_REQUIRED" as its mode'); $this->assertTrue($option->isValueRequired(), '__construct() can take "InputOption::VALUE_REQUIRED" as its mode'); $this->assertFalse($option->isValueOptional(), '__construct() can take "InputOption::VALUE_REQUIRED" as its mode'); $option = new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL); $this->assertTrue($option->acceptValue(), '__construct() can take "InputOption::VALUE_OPTIONAL" as its mode'); $this->assertFalse($option->isValueRequired(), '__construct() can take "InputOption::VALUE_OPTIONAL" as its mode'); $this->assertTrue($option->isValueOptional(), '__construct() can take "InputOption::VALUE_OPTIONAL" as its mode'); } /** * @dataProvider provideInvalidModes */ public function testInvalidModes($mode) { $this->setExpectedException('InvalidArgumentException', sprintf('Option mode "%s" is not valid.', $mode)); new InputOption('foo', 'f', $mode); } public function provideInvalidModes() { return array( array('ANOTHER_ONE'), array(-1) ); } /** * @expectedException \InvalidArgumentException */ public function testEmptyNameIsInvalid() { new InputOption(''); } /** * @expectedException \InvalidArgumentException */ public function testDoubleDashNameIsInvalid() { new InputOption('--'); } /** * @expectedException \InvalidArgumentException */ public function testSingleDashOptionIsInvalid() { new InputOption('foo', '-'); } public function testIsArray() { $option = new InputOption('foo', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY); $this->assertTrue($option->isArray(), '->isArray() returns true if the option can be an array'); $option = new InputOption('foo', null, InputOption::VALUE_NONE); $this->assertFalse($option->isArray(), '->isArray() returns false if the option can not be an array'); } public function testGetDescription() { $option = new InputOption('foo', 'f', null, 'Some description'); $this->assertEquals('Some description', $option->getDescription(), '->getDescription() returns the description message'); } public function testGetDefault() { $option = new InputOption('foo', null, InputOption::VALUE_OPTIONAL, '', 'default'); $this->assertEquals('default', $option->getDefault(), '->getDefault() returns the default value'); $option = new InputOption('foo', null, InputOption::VALUE_REQUIRED, '', 'default'); $this->assertEquals('default', $option->getDefault(), '->getDefault() returns the default value'); $option = new InputOption('foo', null, InputOption::VALUE_REQUIRED); $this->assertNull($option->getDefault(), '->getDefault() returns null if no default value is configured'); $option = new InputOption('foo', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY); $this->assertEquals(array(), $option->getDefault(), '->getDefault() returns an empty array if option is an array'); $option = new InputOption('foo', null, InputOption::VALUE_NONE); $this->assertFalse($option->getDefault(), '->getDefault() returns false if the option does not take a value'); } public function testSetDefault() { $option = new InputOption('foo', null, InputOption::VALUE_REQUIRED, '', 'default'); $option->setDefault(null); $this->assertNull($option->getDefault(), '->setDefault() can reset the default value by passing null'); $option->setDefault('another'); $this->assertEquals('another', $option->getDefault(), '->setDefault() changes the default value'); $option = new InputOption('foo', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY); $option->setDefault(array(1, 2)); $this->assertEquals(array(1, 2), $option->getDefault(), '->setDefault() changes the default value'); } /** * @expectedException \LogicException * @expectedExceptionMessage Cannot set a default value when using InputOption::VALUE_NONE mode. */ public function testDefaultValueWithValueNoneMode() { $option = new InputOption('foo', 'f', InputOption::VALUE_NONE); $option->setDefault('default'); } /** * @expectedException \LogicException * @expectedExceptionMessage A default value for an array option must be an array. */ public function testDefaultValueWithIsArrayMode() { $option = new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY); $option->setDefault('default'); } public function testEquals() { $option = new InputOption('foo', 'f', null, 'Some description'); $option2 = new InputOption('foo', 'f', null, 'Alternative description'); $this->assertTrue($option->equals($option2)); $option = new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL, 'Some description'); $option2 = new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL, 'Some description', true); $this->assertFalse($option->equals($option2)); $option = new InputOption('foo', 'f', null, 'Some description'); $option2 = new InputOption('bar', 'f', null, 'Some description'); $this->assertFalse($option->equals($option2)); $option = new InputOption('foo', 'f', null, 'Some description'); $option2 = new InputOption('foo', '', null, 'Some description'); $this->assertFalse($option->equals($option2)); $option = new InputOption('foo', 'f', null, 'Some description'); $option2 = new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL, 'Some description'); $this->assertFalse($option->equals($option2)); } } PK.j]p3Symfony/Component/Console/Tests/Input/InputTest.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Input; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; class InputTest extends \PHPUnit_Framework_TestCase { public function testConstructor() { $input = new ArrayInput(array('name' => 'foo'), new InputDefinition(array(new InputArgument('name')))); $this->assertEquals('foo', $input->getArgument('name'), '->__construct() takes a InputDefinition as an argument'); } public function testOptions() { $input = new ArrayInput(array('--name' => 'foo'), new InputDefinition(array(new InputOption('name')))); $this->assertEquals('foo', $input->getOption('name'), '->getOption() returns the value for the given option'); $input->setOption('name', 'bar'); $this->assertEquals('bar', $input->getOption('name'), '->setOption() sets the value for a given option'); $this->assertEquals(array('name' => 'bar'), $input->getOptions(), '->getOptions() returns all option values'); $input = new ArrayInput(array('--name' => 'foo'), new InputDefinition(array(new InputOption('name'), new InputOption('bar', '', InputOption::VALUE_OPTIONAL, '', 'default')))); $this->assertEquals('default', $input->getOption('bar'), '->getOption() returns the default value for optional options'); $this->assertEquals(array('name' => 'foo', 'bar' => 'default'), $input->getOptions(), '->getOptions() returns all option values, even optional ones'); } /** * @expectedException \InvalidArgumentException * @expectedExceptionMessage The "foo" option does not exist. */ public function testSetInvalidOption() { $input = new ArrayInput(array('--name' => 'foo'), new InputDefinition(array(new InputOption('name'), new InputOption('bar', '', InputOption::VALUE_OPTIONAL, '', 'default')))); $input->setOption('foo', 'bar'); } /** * @expectedException \InvalidArgumentException * @expectedExceptionMessage The "foo" option does not exist. */ public function testGetInvalidOption() { $input = new ArrayInput(array('--name' => 'foo'), new InputDefinition(array(new InputOption('name'), new InputOption('bar', '', InputOption::VALUE_OPTIONAL, '', 'default')))); $input->getOption('foo'); } public function testArguments() { $input = new ArrayInput(array('name' => 'foo'), new InputDefinition(array(new InputArgument('name')))); $this->assertEquals('foo', $input->getArgument('name'), '->getArgument() returns the value for the given argument'); $input->setArgument('name', 'bar'); $this->assertEquals('bar', $input->getArgument('name'), '->setArgument() sets the value for a given argument'); $this->assertEquals(array('name' => 'bar'), $input->getArguments(), '->getArguments() returns all argument values'); $input = new ArrayInput(array('name' => 'foo'), new InputDefinition(array(new InputArgument('name'), new InputArgument('bar', InputArgument::OPTIONAL, '', 'default')))); $this->assertEquals('default', $input->getArgument('bar'), '->getArgument() returns the default value for optional arguments'); $this->assertEquals(array('name' => 'foo', 'bar' => 'default'), $input->getArguments(), '->getArguments() returns all argument values, even optional ones'); } /** * @expectedException \InvalidArgumentException * @expectedExceptionMessage The "foo" argument does not exist. */ public function testSetInvalidArgument() { $input = new ArrayInput(array('name' => 'foo'), new InputDefinition(array(new InputArgument('name'), new InputArgument('bar', InputArgument::OPTIONAL, '', 'default')))); $input->setArgument('foo', 'bar'); } /** * @expectedException \InvalidArgumentException * @expectedExceptionMessage The "foo" argument does not exist. */ public function testGetInvalidArgument() { $input = new ArrayInput(array('name' => 'foo'), new InputDefinition(array(new InputArgument('name'), new InputArgument('bar', InputArgument::OPTIONAL, '', 'default')))); $input->getArgument('foo'); } /** * @expectedException \RuntimeException * @expectedExceptionMessage Not enough arguments. */ public function testValidateWithMissingArguments() { $input = new ArrayInput(array()); $input->bind(new InputDefinition(array(new InputArgument('name', InputArgument::REQUIRED)))); $input->validate(); } public function testValidate() { $input = new ArrayInput(array('name' => 'foo')); $input->bind(new InputDefinition(array(new InputArgument('name', InputArgument::REQUIRED)))); $this->assertNull($input->validate()); } public function testSetGetInteractive() { $input = new ArrayInput(array()); $this->assertTrue($input->isInteractive(), '->isInteractive() returns whether the input should be interactive or not'); $input->setInteractive(false); $this->assertFalse($input->isInteractive(), '->setInteractive() changes the interactive flag'); } } PK.j]@HH=Symfony/Component/Console/Tests/Input/InputDefinitionTest.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Input; use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; class InputDefinitionTest extends \PHPUnit_Framework_TestCase { protected static $fixtures; protected $foo, $bar, $foo1, $foo2; public static function setUpBeforeClass() { self::$fixtures = __DIR__.'/../Fixtures/'; } public function testConstructorArguments() { $this->initializeArguments(); $definition = new InputDefinition(); $this->assertEquals(array(), $definition->getArguments(), '__construct() creates a new InputDefinition object'); $definition = new InputDefinition(array($this->foo, $this->bar)); $this->assertEquals(array('foo' => $this->foo, 'bar' => $this->bar), $definition->getArguments(), '__construct() takes an array of InputArgument objects as its first argument'); } public function testConstructorOptions() { $this->initializeOptions(); $definition = new InputDefinition(); $this->assertEquals(array(), $definition->getOptions(), '__construct() creates a new InputDefinition object'); $definition = new InputDefinition(array($this->foo, $this->bar)); $this->assertEquals(array('foo' => $this->foo, 'bar' => $this->bar), $definition->getOptions(), '__construct() takes an array of InputOption objects as its first argument'); } public function testSetArguments() { $this->initializeArguments(); $definition = new InputDefinition(); $definition->setArguments(array($this->foo)); $this->assertEquals(array('foo' => $this->foo), $definition->getArguments(), '->setArguments() sets the array of InputArgument objects'); $definition->setArguments(array($this->bar)); $this->assertEquals(array('bar' => $this->bar), $definition->getArguments(), '->setArguments() clears all InputArgument objects'); } public function testAddArguments() { $this->initializeArguments(); $definition = new InputDefinition(); $definition->addArguments(array($this->foo)); $this->assertEquals(array('foo' => $this->foo), $definition->getArguments(), '->addArguments() adds an array of InputArgument objects'); $definition->addArguments(array($this->bar)); $this->assertEquals(array('foo' => $this->foo, 'bar' => $this->bar), $definition->getArguments(), '->addArguments() does not clear existing InputArgument objects'); } public function testAddArgument() { $this->initializeArguments(); $definition = new InputDefinition(); $definition->addArgument($this->foo); $this->assertEquals(array('foo' => $this->foo), $definition->getArguments(), '->addArgument() adds a InputArgument object'); $definition->addArgument($this->bar); $this->assertEquals(array('foo' => $this->foo, 'bar' => $this->bar), $definition->getArguments(), '->addArgument() adds a InputArgument object'); } /** * @expectedException \LogicException * @expectedExceptionMessage An argument with name "foo" already exists. */ public function testArgumentsMustHaveDifferentNames() { $this->initializeArguments(); $definition = new InputDefinition(); $definition->addArgument($this->foo); $definition->addArgument($this->foo1); } /** * @expectedException \LogicException * @expectedExceptionMessage Cannot add an argument after an array argument. */ public function testArrayArgumentHasToBeLast() { $this->initializeArguments(); $definition = new InputDefinition(); $definition->addArgument(new InputArgument('fooarray', InputArgument::IS_ARRAY)); $definition->addArgument(new InputArgument('anotherbar')); } /** * @expectedException \LogicException * @expectedExceptionMessage Cannot add a required argument after an optional one. */ public function testRequiredArgumentCannotFollowAnOptionalOne() { $this->initializeArguments(); $definition = new InputDefinition(); $definition->addArgument($this->foo); $definition->addArgument($this->foo2); } public function testGetArgument() { $this->initializeArguments(); $definition = new InputDefinition(); $definition->addArguments(array($this->foo)); $this->assertEquals($this->foo, $definition->getArgument('foo'), '->getArgument() returns a InputArgument by its name'); } /** * @expectedException \InvalidArgumentException * @expectedExceptionMessage The "bar" argument does not exist. */ public function testGetInvalidArgument() { $this->initializeArguments(); $definition = new InputDefinition(); $definition->addArguments(array($this->foo)); $definition->getArgument('bar'); } public function testHasArgument() { $this->initializeArguments(); $definition = new InputDefinition(); $definition->addArguments(array($this->foo)); $this->assertTrue($definition->hasArgument('foo'), '->hasArgument() returns true if a InputArgument exists for the given name'); $this->assertFalse($definition->hasArgument('bar'), '->hasArgument() returns false if a InputArgument exists for the given name'); } public function testGetArgumentRequiredCount() { $this->initializeArguments(); $definition = new InputDefinition(); $definition->addArgument($this->foo2); $this->assertEquals(1, $definition->getArgumentRequiredCount(), '->getArgumentRequiredCount() returns the number of required arguments'); $definition->addArgument($this->foo); $this->assertEquals(1, $definition->getArgumentRequiredCount(), '->getArgumentRequiredCount() returns the number of required arguments'); } public function testGetArgumentCount() { $this->initializeArguments(); $definition = new InputDefinition(); $definition->addArgument($this->foo2); $this->assertEquals(1, $definition->getArgumentCount(), '->getArgumentCount() returns the number of arguments'); $definition->addArgument($this->foo); $this->assertEquals(2, $definition->getArgumentCount(), '->getArgumentCount() returns the number of arguments'); } public function testGetArgumentDefaults() { $definition = new InputDefinition(array( new InputArgument('foo1', InputArgument::OPTIONAL), new InputArgument('foo2', InputArgument::OPTIONAL, '', 'default'), new InputArgument('foo3', InputArgument::OPTIONAL | InputArgument::IS_ARRAY), // new InputArgument('foo4', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, '', array(1, 2)), )); $this->assertEquals(array('foo1' => null, 'foo2' => 'default', 'foo3' => array()), $definition->getArgumentDefaults(), '->getArgumentDefaults() return the default values for each argument'); $definition = new InputDefinition(array( new InputArgument('foo4', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, '', array(1, 2)), )); $this->assertEquals(array('foo4' => array(1, 2)), $definition->getArgumentDefaults(), '->getArgumentDefaults() return the default values for each argument'); } public function testSetOptions() { $this->initializeOptions(); $definition = new InputDefinition(array($this->foo)); $this->assertEquals(array('foo' => $this->foo), $definition->getOptions(), '->setOptions() sets the array of InputOption objects'); $definition->setOptions(array($this->bar)); $this->assertEquals(array('bar' => $this->bar), $definition->getOptions(), '->setOptions() clears all InputOption objects'); } /** * @expectedException \InvalidArgumentException * @expectedExceptionMessage The "-f" option does not exist. */ public function testSetOptionsClearsOptions() { $this->initializeOptions(); $definition = new InputDefinition(array($this->foo)); $definition->setOptions(array($this->bar)); $definition->getOptionForShortcut('f'); } public function testAddOptions() { $this->initializeOptions(); $definition = new InputDefinition(array($this->foo)); $this->assertEquals(array('foo' => $this->foo), $definition->getOptions(), '->addOptions() adds an array of InputOption objects'); $definition->addOptions(array($this->bar)); $this->assertEquals(array('foo' => $this->foo, 'bar' => $this->bar), $definition->getOptions(), '->addOptions() does not clear existing InputOption objects'); } public function testAddOption() { $this->initializeOptions(); $definition = new InputDefinition(); $definition->addOption($this->foo); $this->assertEquals(array('foo' => $this->foo), $definition->getOptions(), '->addOption() adds a InputOption object'); $definition->addOption($this->bar); $this->assertEquals(array('foo' => $this->foo, 'bar' => $this->bar), $definition->getOptions(), '->addOption() adds a InputOption object'); } /** * @expectedException \LogicException * @expectedExceptionMessage An option named "foo" already exists. */ public function testAddDuplicateOption() { $this->initializeOptions(); $definition = new InputDefinition(); $definition->addOption($this->foo); $definition->addOption($this->foo2); } /** * @expectedException \LogicException * @expectedExceptionMessage An option with shortcut "f" already exists. */ public function testAddDuplicateShortcutOption() { $this->initializeOptions(); $definition = new InputDefinition(); $definition->addOption($this->foo); $definition->addOption($this->foo1); } public function testGetOption() { $this->initializeOptions(); $definition = new InputDefinition(array($this->foo)); $this->assertEquals($this->foo, $definition->getOption('foo'), '->getOption() returns a InputOption by its name'); } /** * @expectedException \InvalidArgumentException * @expectedExceptionMessage The "--bar" option does not exist. */ public function testGetInvalidOption() { $this->initializeOptions(); $definition = new InputDefinition(array($this->foo)); $definition->getOption('bar'); } public function testHasOption() { $this->initializeOptions(); $definition = new InputDefinition(array($this->foo)); $this->assertTrue($definition->hasOption('foo'), '->hasOption() returns true if a InputOption exists for the given name'); $this->assertFalse($definition->hasOption('bar'), '->hasOption() returns false if a InputOption exists for the given name'); } public function testHasShortcut() { $this->initializeOptions(); $definition = new InputDefinition(array($this->foo)); $this->assertTrue($definition->hasShortcut('f'), '->hasShortcut() returns true if a InputOption exists for the given shortcut'); $this->assertFalse($definition->hasShortcut('b'), '->hasShortcut() returns false if a InputOption exists for the given shortcut'); } public function testGetOptionForShortcut() { $this->initializeOptions(); $definition = new InputDefinition(array($this->foo)); $this->assertEquals($this->foo, $definition->getOptionForShortcut('f'), '->getOptionForShortcut() returns a InputOption by its shortcut'); } public function testGetOptionForMultiShortcut() { $this->initializeOptions(); $definition = new InputDefinition(array($this->multi)); $this->assertEquals($this->multi, $definition->getOptionForShortcut('m'), '->getOptionForShortcut() returns a InputOption by its shortcut'); $this->assertEquals($this->multi, $definition->getOptionForShortcut('mmm'), '->getOptionForShortcut() returns a InputOption by its shortcut'); } /** * @expectedException \InvalidArgumentException * @expectedExceptionMessage The "-l" option does not exist. */ public function testGetOptionForInvalidShortcut() { $this->initializeOptions(); $definition = new InputDefinition(array($this->foo)); $definition->getOptionForShortcut('l'); } public function testGetOptionDefaults() { $definition = new InputDefinition(array( new InputOption('foo1', null, InputOption::VALUE_NONE), new InputOption('foo2', null, InputOption::VALUE_REQUIRED), new InputOption('foo3', null, InputOption::VALUE_REQUIRED, '', 'default'), new InputOption('foo4', null, InputOption::VALUE_OPTIONAL), new InputOption('foo5', null, InputOption::VALUE_OPTIONAL, '', 'default'), new InputOption('foo6', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY), new InputOption('foo7', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, '', array(1, 2)), )); $defaults = array( 'foo1' => null, 'foo2' => null, 'foo3' => 'default', 'foo4' => null, 'foo5' => 'default', 'foo6' => array(), 'foo7' => array(1, 2), ); $this->assertEquals($defaults, $definition->getOptionDefaults(), '->getOptionDefaults() returns the default values for all options'); } public function testGetSynopsis() { $definition = new InputDefinition(array(new InputOption('foo'))); $this->assertEquals('[--foo]', $definition->getSynopsis(), '->getSynopsis() returns a synopsis of arguments and options'); $definition = new InputDefinition(array(new InputOption('foo', 'f'))); $this->assertEquals('[-f|--foo]', $definition->getSynopsis(), '->getSynopsis() returns a synopsis of arguments and options'); $definition = new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_REQUIRED))); $this->assertEquals('[-f|--foo="..."]', $definition->getSynopsis(), '->getSynopsis() returns a synopsis of arguments and options'); $definition = new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL))); $this->assertEquals('[-f|--foo[="..."]]', $definition->getSynopsis(), '->getSynopsis() returns a synopsis of arguments and options'); $definition = new InputDefinition(array(new InputArgument('foo'))); $this->assertEquals('[foo]', $definition->getSynopsis(), '->getSynopsis() returns a synopsis of arguments and options'); $definition = new InputDefinition(array(new InputArgument('foo', InputArgument::REQUIRED))); $this->assertEquals('foo', $definition->getSynopsis(), '->getSynopsis() returns a synopsis of arguments and options'); $definition = new InputDefinition(array(new InputArgument('foo', InputArgument::IS_ARRAY))); $this->assertEquals('[foo1] ... [fooN]', $definition->getSynopsis(), '->getSynopsis() returns a synopsis of arguments and options'); $definition = new InputDefinition(array(new InputArgument('foo', InputArgument::REQUIRED | InputArgument::IS_ARRAY))); $this->assertEquals('foo1 ... [fooN]', $definition->getSynopsis(), '->getSynopsis() returns a synopsis of arguments and options'); } public function testAsText() { $definition = new InputDefinition(array( new InputArgument('foo', InputArgument::OPTIONAL, 'The foo argument'), new InputArgument('baz', InputArgument::OPTIONAL, 'The baz argument', true), new InputArgument('bar', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, 'The bar argument', array('http://foo.com/')), new InputOption('foo', 'f', InputOption::VALUE_REQUIRED, 'The foo option'), new InputOption('baz', null, InputOption::VALUE_OPTIONAL, 'The baz option', false), new InputOption('bar', 'b', InputOption::VALUE_OPTIONAL, 'The bar option', 'bar'), new InputOption('qux', '', InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'The qux option', array('http://foo.com/', 'bar')), new InputOption('qux2', '', InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'The qux2 option', array('foo' => 'bar')), )); $this->assertStringEqualsFile(self::$fixtures.'/definition_astext.txt', $definition->asText(), '->asText() returns a textual representation of the InputDefinition'); } public function testAsXml() { $definition = new InputDefinition(array( new InputArgument('foo', InputArgument::OPTIONAL, 'The foo argument'), new InputArgument('baz', InputArgument::OPTIONAL, 'The baz argument', true), new InputArgument('bar', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, 'The bar argument', array('bar')), new InputOption('foo', 'f', InputOption::VALUE_REQUIRED, 'The foo option'), new InputOption('baz', null, InputOption::VALUE_OPTIONAL, 'The baz option', false), new InputOption('bar', 'b', InputOption::VALUE_OPTIONAL, 'The bar option', 'bar'), )); $this->assertXmlStringEqualsXmlFile(self::$fixtures.'/definition_asxml.txt', $definition->asXml(), '->asText() returns a textual representation of the InputDefinition'); } protected function initializeArguments() { $this->foo = new InputArgument('foo'); $this->bar = new InputArgument('bar'); $this->foo1 = new InputArgument('foo'); $this->foo2 = new InputArgument('foo2', InputArgument::REQUIRED); } protected function initializeOptions() { $this->foo = new InputOption('foo', 'f'); $this->bar = new InputOption('bar', 'b'); $this->foo1 = new InputOption('fooBis', 'f'); $this->foo2 = new InputOption('foo', 'p'); $this->multi = new InputOption('multi', 'm|mm|mmm'); } } PK.j]9I;;7Symfony/Component/Console/Tests/Input/ArgvInputTest.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Input; use Symfony\Component\Console\Input\ArgvInput; use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; class ArgvInputTest extends \PHPUnit_Framework_TestCase { public function testConstructor() { $_SERVER['argv'] = array('cli.php', 'foo'); $input = new ArgvInput(); $r = new \ReflectionObject($input); $p = $r->getProperty('tokens'); $p->setAccessible(true); $this->assertEquals(array('foo'), $p->getValue($input), '__construct() automatically get its input from the argv server variable'); } public function testParseArguments() { $input = new ArgvInput(array('cli.php', 'foo')); $input->bind(new InputDefinition(array(new InputArgument('name')))); $this->assertEquals(array('name' => 'foo'), $input->getArguments(), '->parse() parses required arguments'); $input->bind(new InputDefinition(array(new InputArgument('name')))); $this->assertEquals(array('name' => 'foo'), $input->getArguments(), '->parse() is stateless'); } /** * @dataProvider provideOptions */ public function testParseOptions($input, $options, $expectedOptions, $message) { $input = new ArgvInput($input); $input->bind(new InputDefinition($options)); $this->assertEquals($expectedOptions, $input->getOptions(), $message); } public function provideOptions() { return array( array( array('cli.php', '--foo'), array(new InputOption('foo')), array('foo' => true), '->parse() parses long options without a value' ), array( array('cli.php', '--foo=bar'), array(new InputOption('foo', 'f', InputOption::VALUE_REQUIRED)), array('foo' => 'bar'), '->parse() parses long options with a required value (with a = separator)' ), array( array('cli.php', '--foo', 'bar'), array(new InputOption('foo', 'f', InputOption::VALUE_REQUIRED)), array('foo' => 'bar'), '->parse() parses long options with a required value (with a space separator)' ), array( array('cli.php', '-f'), array(new InputOption('foo', 'f')), array('foo' => true), '->parse() parses short options without a value' ), array( array('cli.php', '-fbar'), array(new InputOption('foo', 'f', InputOption::VALUE_REQUIRED)), array('foo' => 'bar'), '->parse() parses short options with a required value (with no separator)' ), array( array('cli.php', '-f', 'bar'), array(new InputOption('foo', 'f', InputOption::VALUE_REQUIRED)), array('foo' => 'bar'), '->parse() parses short options with a required value (with a space separator)' ), array( array('cli.php', '-f', ''), array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL)), array('foo' => ''), '->parse() parses short options with an optional empty value' ), array( array('cli.php', '-f', '', 'foo'), array(new InputArgument('name'), new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL)), array('foo' => ''), '->parse() parses short options with an optional empty value followed by an argument' ), array( array('cli.php', '-f', '', '-b'), array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputOption('bar', 'b')), array('foo' => '', 'bar' => true), '->parse() parses short options with an optional empty value followed by an option' ), array( array('cli.php', '-f', '-b', 'foo'), array(new InputArgument('name'), new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputOption('bar', 'b')), array('foo' => null, 'bar' => true), '->parse() parses short options with an optional value which is not present' ), array( array('cli.php', '-fb'), array(new InputOption('foo', 'f'), new InputOption('bar', 'b')), array('foo' => true, 'bar' => true), '->parse() parses short options when they are aggregated as a single one' ), array( array('cli.php', '-fb', 'bar'), array(new InputOption('foo', 'f'), new InputOption('bar', 'b', InputOption::VALUE_REQUIRED)), array('foo' => true, 'bar' => 'bar'), '->parse() parses short options when they are aggregated as a single one and the last one has a required value' ), array( array('cli.php', '-fb', 'bar'), array(new InputOption('foo', 'f'), new InputOption('bar', 'b', InputOption::VALUE_OPTIONAL)), array('foo' => true, 'bar' => 'bar'), '->parse() parses short options when they are aggregated as a single one and the last one has an optional value' ), array( array('cli.php', '-fbbar'), array(new InputOption('foo', 'f'), new InputOption('bar', 'b', InputOption::VALUE_OPTIONAL)), array('foo' => true, 'bar' => 'bar'), '->parse() parses short options when they are aggregated as a single one and the last one has an optional value with no separator' ), array( array('cli.php', '-fbbar'), array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputOption('bar', 'b', InputOption::VALUE_OPTIONAL)), array('foo' => 'bbar', 'bar' => null), '->parse() parses short options when they are aggregated as a single one and one of them takes a value' ) ); } /** * @dataProvider provideInvalidInput */ public function testInvalidInput($argv, $definition, $expectedExceptionMessage) { $this->setExpectedException('RuntimeException', $expectedExceptionMessage); $input = new ArgvInput($argv); $input->bind($definition); } public function provideInvalidInput() { return array( array( array('cli.php', '--foo'), new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_REQUIRED))), 'The "--foo" option requires a value.' ), array( array('cli.php', '-f'), new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_REQUIRED))), 'The "--foo" option requires a value.' ), array( array('cli.php', '-ffoo'), new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_NONE))), 'The "-o" option does not exist.' ), array( array('cli.php', '--foo=bar'), new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_NONE))), 'The "--foo" option does not accept a value.' ), array( array('cli.php', 'foo', 'bar'), new InputDefinition(), 'Too many arguments.' ), array( array('cli.php', '--foo'), new InputDefinition(), 'The "--foo" option does not exist.' ), array( array('cli.php', '-f'), new InputDefinition(), 'The "-f" option does not exist.' ), array( array('cli.php', '-1'), new InputDefinition(array(new InputArgument('number'))), 'The "-1" option does not exist.' ) ); } public function testParseArrayArgument() { $input = new ArgvInput(array('cli.php', 'foo', 'bar', 'baz', 'bat')); $input->bind(new InputDefinition(array(new InputArgument('name', InputArgument::IS_ARRAY)))); $this->assertEquals(array('name' => array('foo', 'bar', 'baz', 'bat')), $input->getArguments(), '->parse() parses array arguments'); } public function testParseArrayOption() { $input = new ArgvInput(array('cli.php', '--name=foo', '--name=bar', '--name=baz')); $input->bind(new InputDefinition(array(new InputOption('name', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY)))); $this->assertEquals(array('name' => array('foo', 'bar', 'baz')), $input->getOptions(), '->parse() parses array options ("--option=value" syntax)'); $input = new ArgvInput(array('cli.php', '--name', 'foo', '--name', 'bar', '--name', 'baz')); $input->bind(new InputDefinition(array(new InputOption('name', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY)))); $this->assertEquals(array('name' => array('foo', 'bar', 'baz')), $input->getOptions(), '->parse() parses array options ("--option value" syntax)'); $input = new ArgvInput(array('cli.php', '--name=foo', '--name=bar', '--name=')); $input->bind(new InputDefinition(array(new InputOption('name', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY)))); $this->assertSame(array('name' => array('foo', 'bar', null)), $input->getOptions(), '->parse() parses empty array options as null ("--option=value" syntax)'); $input = new ArgvInput(array('cli.php', '--name', 'foo', '--name', 'bar', '--name', '--anotherOption')); $input->bind(new InputDefinition(array( new InputOption('name', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY), new InputOption('anotherOption', null, InputOption::VALUE_NONE), ))); $this->assertSame(array('name' => array('foo', 'bar', null), 'anotherOption' => true), $input->getOptions(), '->parse() parses empty array options as null ("--option value" syntax)'); } public function testParseNegativeNumberAfterDoubleDash() { $input = new ArgvInput(array('cli.php', '--', '-1')); $input->bind(new InputDefinition(array(new InputArgument('number')))); $this->assertEquals(array('number' => '-1'), $input->getArguments(), '->parse() parses arguments with leading dashes as arguments after having encountered a double-dash sequence'); $input = new ArgvInput(array('cli.php', '-f', 'bar', '--', '-1')); $input->bind(new InputDefinition(array(new InputArgument('number'), new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL)))); $this->assertEquals(array('foo' => 'bar'), $input->getOptions(), '->parse() parses arguments with leading dashes as options before having encountered a double-dash sequence'); $this->assertEquals(array('number' => '-1'), $input->getArguments(), '->parse() parses arguments with leading dashes as arguments after having encountered a double-dash sequence'); } public function testParseEmptyStringArgument() { $input = new ArgvInput(array('cli.php', '-f', 'bar', '')); $input->bind(new InputDefinition(array(new InputArgument('empty'), new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL)))); $this->assertEquals(array('empty' => ''), $input->getArguments(), '->parse() parses empty string arguments'); } public function testGetFirstArgument() { $input = new ArgvInput(array('cli.php', '-fbbar')); $this->assertEquals('', $input->getFirstArgument(), '->getFirstArgument() returns the first argument from the raw input'); $input = new ArgvInput(array('cli.php', '-fbbar', 'foo')); $this->assertEquals('foo', $input->getFirstArgument(), '->getFirstArgument() returns the first argument from the raw input'); } public function testHasParameterOption() { $input = new ArgvInput(array('cli.php', '-f', 'foo')); $this->assertTrue($input->hasParameterOption('-f'), '->hasParameterOption() returns true if the given short option is in the raw input'); $input = new ArgvInput(array('cli.php', '--foo', 'foo')); $this->assertTrue($input->hasParameterOption('--foo'), '->hasParameterOption() returns true if the given short option is in the raw input'); $input = new ArgvInput(array('cli.php', 'foo')); $this->assertFalse($input->hasParameterOption('--foo'), '->hasParameterOption() returns false if the given short option is not in the raw input'); $input = new ArgvInput(array('cli.php', '--foo=bar')); $this->assertTrue($input->hasParameterOption('--foo'), '->hasParameterOption() returns true if the given option with provided value is in the raw input'); } public function testToString() { $input = new ArgvInput(array('cli.php', '-f', 'foo')); $this->assertEquals('-f foo', (string) $input); $input = new ArgvInput(array('cli.php', '-f', '--bar=foo', 'a b c d', "A\nB'C")); $this->assertEquals('-f --bar=foo '.escapeshellarg('a b c d').' '.escapeshellarg("A\nB'C"), (string) $input); } /** * @dataProvider provideGetParameterOptionValues */ public function testGetParameterOptionEqualSign($argv, $key, $expected) { $input = new ArgvInput($argv); $this->assertEquals($expected, $input->getParameterOption($key), '->getParameterOption() returns the expected value'); } public function provideGetParameterOptionValues() { return array( array(array('app/console', 'foo:bar', '-e', 'dev'), '-e', 'dev'), array(array('app/console', 'foo:bar', '--env=dev'), '--env', 'dev'), array(array('app/console', 'foo:bar', '-e', 'dev'), array('-e', '--env'), 'dev'), array(array('app/console', 'foo:bar', '--env=dev'), array('-e', '--env'), 'dev'), array(array('app/console', 'foo:bar', '--env=dev', '--en=1'), array('--en'), '1'), ); } public function testParseSingleDashAsArgument() { $input = new ArgvInput(array('cli.php', '-')); $input->bind(new InputDefinition(array(new InputArgument('file')))); $this->assertEquals(array('file' => '-'), $input->getArguments(), '->parse() parses single dash as an argument'); } } PK.j]F5;Symfony/Component/Console/Tests/Input/InputArgumentTest.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Input; use Symfony\Component\Console\Input\InputArgument; class InputArgumentTest extends \PHPUnit_Framework_TestCase { public function testConstructor() { $argument = new InputArgument('foo'); $this->assertEquals('foo', $argument->getName(), '__construct() takes a name as its first argument'); } public function testModes() { $argument = new InputArgument('foo'); $this->assertFalse($argument->isRequired(), '__construct() gives a "InputArgument::OPTIONAL" mode by default'); $argument = new InputArgument('foo', null); $this->assertFalse($argument->isRequired(), '__construct() can take "InputArgument::OPTIONAL" as its mode'); $argument = new InputArgument('foo', InputArgument::OPTIONAL); $this->assertFalse($argument->isRequired(), '__construct() can take "InputArgument::OPTIONAL" as its mode'); $argument = new InputArgument('foo', InputArgument::REQUIRED); $this->assertTrue($argument->isRequired(), '__construct() can take "InputArgument::REQUIRED" as its mode'); } /** * @dataProvider provideInvalidModes */ public function testInvalidModes($mode) { $this->setExpectedException('InvalidArgumentException', sprintf('Argument mode "%s" is not valid.', $mode)); new InputArgument('foo', $mode); } public function provideInvalidModes() { return array( array('ANOTHER_ONE'), array(-1) ); } public function testIsArray() { $argument = new InputArgument('foo', InputArgument::IS_ARRAY); $this->assertTrue($argument->isArray(), '->isArray() returns true if the argument can be an array'); $argument = new InputArgument('foo', InputArgument::OPTIONAL | InputArgument::IS_ARRAY); $this->assertTrue($argument->isArray(), '->isArray() returns true if the argument can be an array'); $argument = new InputArgument('foo', InputArgument::OPTIONAL); $this->assertFalse($argument->isArray(), '->isArray() returns false if the argument can not be an array'); } public function testGetDescription() { $argument = new InputArgument('foo', null, 'Some description'); $this->assertEquals('Some description', $argument->getDescription(), '->getDescription() return the message description'); } public function testGetDefault() { $argument = new InputArgument('foo', InputArgument::OPTIONAL, '', 'default'); $this->assertEquals('default', $argument->getDefault(), '->getDefault() return the default value'); } public function testSetDefault() { $argument = new InputArgument('foo', InputArgument::OPTIONAL, '', 'default'); $argument->setDefault(null); $this->assertNull($argument->getDefault(), '->setDefault() can reset the default value by passing null'); $argument->setDefault('another'); $this->assertEquals('another', $argument->getDefault(), '->setDefault() changes the default value'); $argument = new InputArgument('foo', InputArgument::OPTIONAL | InputArgument::IS_ARRAY); $argument->setDefault(array(1, 2)); $this->assertEquals(array(1, 2), $argument->getDefault(), '->setDefault() changes the default value'); } /** * @expectedException \LogicException * @expectedExceptionMessage Cannot set a default value except for InputArgument::OPTIONAL mode. */ public function testSetDefaultWithRequiredArgument() { $argument = new InputArgument('foo', InputArgument::REQUIRED); $argument->setDefault('default'); } /** * @expectedException \LogicException * @expectedExceptionMessage A default value for an array argument must be an array. */ public function testSetDefaultWithArrayArgument() { $argument = new InputArgument('foo', InputArgument::IS_ARRAY); $argument->setDefault('default'); } } PK.j]1E<<8Symfony/Component/Console/Tests/Input/ArrayInputTest.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Input; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; class ArrayInputTest extends \PHPUnit_Framework_TestCase { public function testGetFirstArgument() { $input = new ArrayInput(array()); $this->assertNull($input->getFirstArgument(), '->getFirstArgument() returns null if no argument were passed'); $input = new ArrayInput(array('name' => 'Fabien')); $this->assertEquals('Fabien', $input->getFirstArgument(), '->getFirstArgument() returns the first passed argument'); $input = new ArrayInput(array('--foo' => 'bar', 'name' => 'Fabien')); $this->assertEquals('Fabien', $input->getFirstArgument(), '->getFirstArgument() returns the first passed argument'); } public function testHasParameterOption() { $input = new ArrayInput(array('name' => 'Fabien', '--foo' => 'bar')); $this->assertTrue($input->hasParameterOption('--foo'), '->hasParameterOption() returns true if an option is present in the passed parameters'); $this->assertFalse($input->hasParameterOption('--bar'), '->hasParameterOption() returns false if an option is not present in the passed parameters'); $input = new ArrayInput(array('--foo')); $this->assertTrue($input->hasParameterOption('--foo'), '->hasParameterOption() returns true if an option is present in the passed parameters'); } public function testParseArguments() { $input = new ArrayInput(array('name' => 'foo'), new InputDefinition(array(new InputArgument('name')))); $this->assertEquals(array('name' => 'foo'), $input->getArguments(), '->parse() parses required arguments'); } /** * @dataProvider provideOptions */ public function testParseOptions($input, $options, $expectedOptions, $message) { $input = new ArrayInput($input, new InputDefinition($options)); $this->assertEquals($expectedOptions, $input->getOptions(), $message); } public function provideOptions() { return array( array( array('--foo' => 'bar'), array(new InputOption('foo')), array('foo' => 'bar'), '->parse() parses long options' ), array( array('--foo' => 'bar'), array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL, '', 'default')), array('foo' => 'bar'), '->parse() parses long options with a default value' ), array( array('--foo' => null), array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL, '', 'default')), array('foo' => 'default'), '->parse() parses long options with a default value' ), array( array('-f' => 'bar'), array(new InputOption('foo', 'f')), array('foo' => 'bar'), '->parse() parses short options' ) ); } /** * @dataProvider provideInvalidInput */ public function testParseInvalidInput($parameters, $definition, $expectedExceptionMessage) { $this->setExpectedException('InvalidArgumentException', $expectedExceptionMessage); new ArrayInput($parameters, $definition); } public function provideInvalidInput() { return array( array( array('foo' => 'foo'), new InputDefinition(array(new InputArgument('name'))), 'The "foo" argument does not exist.' ), array( array('--foo' => null), new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_REQUIRED))), 'The "--foo" option requires a value.' ), array( array('--foo' => 'foo'), new InputDefinition(), 'The "--foo" option does not exist.' ), array( array('-o' => 'foo'), new InputDefinition(), 'The "-o" option does not exist.' ) ); } public function testToString() { $input = new ArrayInput(array('-f' => null, '-b' => 'bar', '--foo' => 'b a z', '--lala' => null, 'test' => 'Foo', 'test2' => "A\nB'C")); $this->assertEquals('-f -b=bar --foo='.escapeshellarg('b a z').' --lala Foo '.escapeshellarg("A\nB'C"), (string) $input); } } PK.j]9Symfony/Component/Console/Tests/Input/StringInputTest.phpnu[ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Input; use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\StringInput; class StringInputTest extends \PHPUnit_Framework_TestCase { /** * @dataProvider getTokenizeData */ public function testTokenize($input, $tokens, $message) { $input = new StringInput($input); $r = new \ReflectionClass('Symfony\Component\Console\Input\ArgvInput'); $p = $r->getProperty('tokens'); $p->setAccessible(true); $this->assertEquals($tokens, $p->getValue($input), $message); } public function testInputOptionWithGivenString() { $definition = new InputDefinition( array(new InputOption('foo', null, InputOption::VALUE_REQUIRED)) ); // call to bind $input = new StringInput('--foo=bar'); $input->bind($definition); $this->assertEquals('bar', $input->getOption('foo')); // definition in constructor $input = new StringInput('--foo=bar', $definition); $this->assertEquals('bar', $input->getOption('foo')); } public function getTokenizeData() { return array( array('', array(), '->tokenize() parses an empty string'), array('foo', array('foo'), '->tokenize() parses arguments'), array(' foo bar ', array('foo', 'bar'), '->tokenize() ignores whitespaces between arguments'), array('"quoted"', array('quoted'), '->tokenize() parses quoted arguments'), array("'quoted'", array('quoted'), '->tokenize() parses quoted arguments'), array("'a\rb\nc\td'", array("a\rb\nc\td"), '->tokenize() parses whitespace chars in strings'), array("'a'\r'b'\n'c'\t'd'", array('a','b','c','d'), '->tokenize() parses whitespace chars between args as spaces'), array('\"quoted\"', array('"quoted"'), '->tokenize() parses escaped-quoted arguments'), array("\'quoted\'", array('\'quoted\''), '->tokenize() parses escaped-quoted arguments'), array('-a', array('-a'), '->tokenize() parses short options'), array('-azc', array('-azc'), '->tokenize() parses aggregated short options'), array('-awithavalue', array('-awithavalue'), '->tokenize() parses short options with a value'), array('-a"foo bar"', array('-afoo bar'), '->tokenize() parses short options with a value'), array('-a"foo bar""foo bar"', array('-afoo barfoo bar'), '->tokenize() parses short options with a value'), array('-a\'foo bar\'', array('-afoo bar'), '->tokenize() parses short options with a value'), array('-a\'foo bar\'\'foo bar\'', array('-afoo barfoo bar'), '->tokenize() parses short options with a value'), array('-a\'foo bar\'"foo bar"', array('-afoo barfoo bar'), '->tokenize() parses short options with a value'), array('--long-option', array('--long-option'), '->tokenize() parses long options'), array('--long-option=foo', array('--long-option=foo'), '->tokenize() parses long options with a value'), array('--long-option="foo bar"', array('--long-option=foo bar'), '->tokenize() parses long options with a value'), array('--long-option="foo bar""another"', array('--long-option=foo baranother'), '->tokenize() parses long options with a value'), array('--long-option=\'foo bar\'', array('--long-option=foo bar'), '->tokenize() parses long options with a value'), array("--long-option='foo bar''another'", array("--long-option=foo baranother"), '->tokenize() parses long options with a value'), array("--long-option='foo bar'\"another\"", array("--long-option=foo baranother"), '->tokenize() parses long options with a value'), array('foo -a -ffoo --long bar', array('foo', '-a', '-ffoo', '--long', 'bar'), '->tokenize() parses when several arguments and options'), ); } public function testToString() { $input = new StringInput('-f foo'); $this->assertEquals('-f foo', (string) $input); $input = new StringInput('-f --bar=foo "a b c d"'); $this->assertEquals('-f --bar=foo '.escapeshellarg('a b c d'), (string) $input); $input = new StringInput('-f --bar=foo \'a b c d\' '."'A\nB\\'C'"); $this->assertEquals('-f --bar=foo '.escapeshellarg('a b c d').' '.escapeshellarg("A\nB'C"), (string) $input); } } PK.j]?UHii*Symfony/Component/Console/phpunit.xml.distnu[ ./Tests/ ./ ./Resources ./Tests ./vendor PKi])q&Symfony/Component/Console/CHANGELOG.mdnu[CHANGELOG ========= 2.4.0 ----- * added a way to force terminal dimensions * added a convenient method to detect verbosity level * [BC BREAK] made descriptors use output instead of returning a string 2.3.0 ----- * added multiselect support to the select dialog helper * added Table Helper for tabular data rendering * added support for events in `Application` * added a way to normalize EOLs in `ApplicationTester::getDisplay()` and `CommandTester::getDisplay()` * added a way to set the progress bar progress via the `setCurrent` method * added support for multiple InputOption shortcuts, written as `'-a|-b|-c'` * added two additional verbosity levels, VERBOSITY_VERY_VERBOSE and VERBOSITY_DEBUG 2.2.0 ----- * added support for colorization on Windows via ConEmu * add a method to Dialog Helper to ask for a question and hide the response * added support for interactive selections in console (DialogHelper::select()) * added support for autocompletion as you type in Dialog Helper 2.1.0 ----- * added ConsoleOutputInterface * added the possibility to disable a command (Command::isEnabled()) * added suggestions when a command does not exist * added a --raw option to the list command * added support for STDERR in the console output class (errors are now sent to STDERR) * made the defaults (helper set, commands, input definition) in Application more easily customizable * added support for the shell even if readline is not available * added support for process isolation in Symfony shell via `--process-isolation` switch * added support for `--`, which disables options parsing after that point (tokens will be parsed as arguments) PKi]E))!Symfony/Component/Console/LICENSEnu[Copyright (c) 2004-2014 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. PKi]Q&xee'Symfony/Component/Console/composer.jsonnu[{ "name": "symfony/console", "type": "library", "description": "Symfony Console Component", "keywords": [], "homepage": "http://symfony.com", "license": "MIT", "authors": [ { "name": "Fabien Potencier", "email": "fabien@symfony.com" }, { "name": "Symfony Community", "homepage": "http://symfony.com/contributors" } ], "require": { "php": ">=5.3.3" }, "require-dev": { "symfony/event-dispatcher": "~2.1" }, "suggest": { "symfony/event-dispatcher": "" }, "autoload": { "psr-0": { "Symfony\\Component\\Console\\": "" } }, "target-dir": "Symfony/Component/Console", "minimum-stability": "dev", "extra": { "branch-alias": { "dev-master": "2.4-dev" } } } PKi]#Symfony/Component/Console/README.mdnu[Console Component ================= Console eases the creation of beautiful and testable command line interfaces. The Application object manages the CLI application: use Symfony\Component\Console\Application; $console = new Application(); $console->run(); The ``run()`` method parses the arguments and options passed on the command line and executes the right command. Registering a new command can easily be done via the ``register()`` method, which returns a ``Command`` instance: use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; $console ->register('ls') ->setDefinition(array( new InputArgument('dir', InputArgument::REQUIRED, 'Directory name'), )) ->setDescription('Displays the files in the given directory') ->setCode(function (InputInterface $input, OutputInterface $output) { $dir = $input->getArgument('dir'); $output->writeln(sprintf('Dir listing for %s', $dir)); }) ; You can also register new commands via classes. The component provides a lot of features like output coloring, input and output abstractions (so that you can easily unit-test your commands), validation, automatic help messages, ... Tests ----- You can run the unit tests with the following command: $ cd path/to/Symfony/Component/Console/ $ composer.phar install $ phpunit Third Party ----------- `Resources/bin/hiddeninput.exe` is a third party binary provided within this component. Find sources and license at https://github.com/Seldaek/hidden-input. Resources --------- [The Console Component](http://symfony.com/doc/current/components/console.html) [How to create a Console Command](http://symfony.com/doc/current/cookbook/console/console_command.html) PKǼ ]0AC5C5 Getopt.phpnu[PK.j]1HDDDE}5Symfony/Component/Console/Tests/Descriptor/MarkdownDescriptorTest.phpnu[PK.j]ž_J J >68Symfony/Component/Console/Tests/Descriptor/ObjectsProvider.phpnu[PK.j]} ECSymfony/Component/Console/Tests/Descriptor/AbstractDescriptorTest.phpnu[PK.j]K 99A$SSymfony/Component/Console/Tests/Descriptor/TextDescriptorTest.phpnu[PK.j]66@USymfony/Component/Console/Tests/Descriptor/XmlDescriptorTest.phpnu[PK.j]oW::AtXSymfony/Component/Console/Tests/Descriptor/JsonDescriptorTest.phpnu[PK.j]gO >[Symfony/Component/Console/Tests/Helper/FormatterHelperTest.phpnu[PK.j]L"";\fSymfony/Component/Console/Tests/Helper/DialogHelperTest.phpnu[PK.j]+vv8Symfony/Component/Console/Tests/Helper/HelperSetTest.phpnu[PK.j]" U=Symfony/Component/Console/Tests/Helper/ProgressHelperTest.phpnu[PK.j]]_Դ3)3):Symfony/Component/Console/Tests/Helper/TableHelperTest.phpnu[PK.j]]6\AsSymfony/Component/Console/Tests/Formatter/OutputFormatterTest.phpnu[PK.j] RwwKSymfony/Component/Console/Tests/Formatter/OutputFormatterStyleStackTest.phpnu[PK.j]rHwwFSymfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.phpnu[PK.j];! 9 Symfony/Component/Console/Tests/Output/NullOutputTest.phpnu[PK.j];&Symfony/Component/Console/Tests/Output/StreamOutputTest.phpnu[PK.j]}R<w-Symfony/Component/Console/Tests/Output/ConsoleOutputTest.phpnu[PK.j]50Symfony/Component/Console/Tests/Output/OutputTest.phpnu[PK.j]3P?ESymfony/Component/Console/Tests/Fixtures/input_definition_2.xmlnu[PK.j]9*A8ZGSymfony/Component/Console/Tests/Fixtures/TestCommand.phpnu[PK.j]<|4UU8|JSymfony/Component/Console/Tests/Fixtures/Foo1Command.phpnu[PK.j]-R9MSymfony/Component/Console/Tests/Fixtures/application_renderexception3decorated.txtnu[PK.j]Y-͡:LPSymfony/Component/Console/Tests/Fixtures/input_option_1.mdnu[PK.j]$$@WQSymfony/Component/Console/Tests/Fixtures/application_astext2.txtnu[PK.j]u$´!!;TSymfony/Component/Console/Tests/Fixtures/input_option_1.txtnu[PK.j]G;wUSymfony/Component/Console/Tests/Fixtures/input_option_1.xmlnu[PK.j]#9VSymfony/Component/Console/Tests/Fixtures/application_2.mdnu[PK.j]NY__=rSymfony/Component/Console/Tests/Fixtures/input_argument_3.txtnu[PK.j]'̒6sSymfony/Component/Console/Tests/Fixtures/command_1.txtnu[PK.j] a<tSymfony/Component/Console/Tests/Fixtures/input_option_4.jsonnu[PK.j]g/11=uSymfony/Component/Console/Tests/Fixtures/input_argument_2.txtnu[PK.j]1G~"//:1vSymfony/Component/Console/Tests/Fixtures/FoobarCommand.phpnu[PK.j][%7xSymfony/Component/Console/Tests/Fixtures/command_1.jsonnu[PK.j]q+CySymfony/Component/Console/Tests/Fixtures/DescriptorApplication1.phpnu[PK.j]X<{Symfony/Component/Console/Tests/Fixtures/input_option_1.jsonnu[PK.j]e::=|Symfony/Component/Console/Tests/Fixtures/application_run1.txtnu[PK.j]t;aa;Symfony/Component/Console/Tests/Fixtures/input_option_4.txtnu[PK.j]!"=XSymfony/Component/Console/Tests/Fixtures/application_run3.txtnu[PK.j]>USymfony/Component/Console/Tests/Fixtures/input_definition_1.mdnu[PK.j]c:ÃSymfony/Component/Console/Tests/Fixtures/input_option_3.mdnu[PK.j]X ,,=ۄSymfony/Component/Console/Tests/Fixtures/application_run2.txtnu[PK.j] 8tSymfony/Component/Console/Tests/Fixtures/Foo2Command.phpnu[PK.j]_n=ɋSymfony/Component/Console/Tests/Fixtures/input_argument_1.xmlnu[PK.j]*[Ǿ44>ҌSymfony/Component/Console/Tests/Fixtures/input_definition_4.mdnu[PK.j]#"7tSymfony/Component/Console/Tests/Fixtures/command_2.jsonnu[PK.j]p>Symfony/Component/Console/Tests/Fixtures/input_definition_3.mdnu[PK.j] Ӹ:ґSymfony/Component/Console/Tests/Fixtures/input_option_2.mdnu[PK.j](:Symfony/Component/Console/Tests/Fixtures/application_2.txtnu[PK.j]:Symfony/Component/Console/Tests/Fixtures/BarBucCommand.phpnu[PK.j]#ɤb@Symfony/Component/Console/Tests/Fixtures/application_gethelp.txtnu[PK.j]W،<'Symfony/Component/Console/Tests/Fixtures/input_argument_3.mdnu[PK.j]CQu?Symfony/Component/Console/Tests/Fixtures/input_definition_4.xmlnu[PK.j]Zo9"Symfony/Component/Console/Tests/Fixtures/application_1.mdnu[PK.j]<]]>)Symfony/Component/Console/Tests/Fixtures/input_argument_1.jsonnu[PK.j]󚲱}}>Symfony/Component/Console/Tests/Fixtures/input_argument_3.jsonnu[PK.j]I;߯Symfony/Component/Console/Tests/Fixtures/input_option_4.xmlnu[PK.j] c7Symfony/Component/Console/Tests/Fixtures/FooCommand.phpnu[PK.j]@Symfony/Component/Console/Tests/Fixtures/input_definition_1.jsonnu[PK.j]I<Symfony/Component/Console/Tests/Fixtures/input_option_3.jsonnu[PK.j]a66:Symfony/Component/Console/Tests/Fixtures/application_1.txtnu[PK.j]EOO6Symfony/Component/Console/Tests/Fixtures/command_1.xmlnu[PK.j]$$@nSymfony/Component/Console/Tests/Fixtures/input_definition_4.jsonnu[PK.j]XX;Symfony/Component/Console/Tests/Fixtures/input_option_3.xmlnu[PK.j]x44;?Symfony/Component/Console/Tests/Fixtures/input_option_3.txtnu[PK.j]A(ff6޾Symfony/Component/Console/Tests/Fixtures/command_2.xmlnu[PK.j]?Symfony/Component/Console/Tests/Fixtures/input_definition_1.txtnu[PK.j]lT:Symfony/Component/Console/Tests/Fixtures/application_1.xmlnu[PK.j];`M?'Symfony/Component/Console/Tests/Fixtures/application_asxml1.txtnu[PK.j]==?Symfony/Component/Console/Tests/Fixtures/input_definition_3.txtnu[PK.j];[Symfony/Component/Console/Tests/Fixtures/command_astext.txtnu[PK.j]6 _AA8Symfony/Component/Console/Tests/Fixtures/Foo3Command.phpnu[PK.j]zՌ<bSymfony/Component/Console/Tests/Fixtures/input_argument_2.mdnu[PK.j]U5TSymfony/Component/Console/Tests/Fixtures/command_2.mdnu[PK.j]K@bb;Symfony/Component/Console/Tests/Fixtures/input_option_2.txtnu[PK.j][>kSymfony/Component/Console/Tests/Fixtures/input_definition_2.mdnu[PK.j]J2;]Symfony/Component/Console/Tests/Fixtures/input_option_2.xmlnu[PK.j]oo>Symfony/Component/Console/Tests/Fixtures/input_argument_2.jsonnu[PK.j].p~~?Symfony/Component/Console/Tests/Fixtures/input_definition_4.txtnu[PK.j]/""8Symfony/Component/Console/Tests/Fixtures/Foo5Command.phpnu[PK.j]W'?Symfony/Component/Console/Tests/Fixtures/application_asxml2.txtnu[PK.j]9yX5Symfony/Component/Console/Tests/Fixtures/command_1.mdnu[PK.j]tt<Symfony/Component/Console/Tests/Fixtures/input_argument_1.mdnu[PK.j]1"8MMCkSymfony/Component/Console/Tests/Fixtures/DescriptorApplication2.phpnu[PK.j]Ѹ;;?+ Symfony/Component/Console/Tests/Fixtures/input_definition_2.txtnu[PK.j]*q@ Symfony/Component/Console/Tests/Fixtures/input_definition_3.jsonnu[PK.j]ed8 Symfony/Component/Console/Tests/Fixtures/Foo4Command.phpnu[PK.j]f= Symfony/Component/Console/Tests/Fixtures/input_argument_2.xmlnu[PK.j]S:6Symfony/Component/Console/Tests/Fixtures/command_asxml.txtnu[PK.j]oY;xSymfony/Component/Console/Tests/Fixtures/application_1.jsonnu[PK.j]XlI$Symfony/Component/Console/Tests/Fixtures/application_renderexception4.txtnu[PK.j](?h=%Symfony/Component/Console/Tests/Fixtures/input_argument_1.txtnu[PK.j]ud@l&Symfony/Component/Console/Tests/Fixtures/application_astext1.txtnu[PK.j]ia=*Symfony/Component/Console/Tests/Fixtures/definition_asxml.txtnu[PK.j]P:/Symfony/Component/Console/Tests/Fixtures/input_option_4.mdnu[PK.j],>0Symfony/Component/Console/Tests/Fixtures/definition_astext.txtnu[PK.j]&ID4Symfony/Component/Console/Tests/Fixtures/application_renderexception1.txtnu[PK.j]@]"]":I5Symfony/Component/Console/Tests/Fixtures/application_2.xmlnu[PK.j]G u=IXSymfony/Component/Console/Tests/Fixtures/application_renderexception3.txtnu[PK.j]M;$ZSymfony/Component/Console/Tests/Fixtures/application_2.jsonnu[PK.j]^t^^?vSymfony/Component/Console/Tests/Fixtures/input_definition_1.xmlnu[PK.j]8UT =MwSymfony/Component/Console/Tests/Fixtures/application_run4.txtnu[PK.j]h6wSymfony/Component/Console/Tests/Fixtures/command_2.txtnu[PK.j]۴2<'ySymfony/Component/Console/Tests/Fixtures/input_option_2.jsonnu[PK.j]F:c?;zSymfony/Component/Console/Tests/Fixtures/input_definition_3.xmlnu[PK.j]@{Symfony/Component/Console/Tests/Fixtures/input_definition_2.jsonnu[PK.j]Y'A?|Symfony/Component/Console/Tests/Fixtures/DescriptorCommand1.phpnu[PK.j],DŽISymfony/Component/Console/Tests/Fixtures/application_renderexception2.txtnu[PK.j]Xz???Symfony/Component/Console/Tests/Fixtures/DescriptorCommand2.phpnu[PK.j]: 8=Symfony/Component/Console/Tests/Fixtures/input_argument_3.xmlnu[PK.j]Ĕ3Symfony/Component/Console/Tests/ApplicationTest.phpnu[PK.j]o"Z9Z97)Symfony/Component/Console/Tests/Command/CommandTest.phpnu[PK.j]by1 1 ;cSymfony/Component/Console/Tests/Command/HelpCommandTest.phpnu[PK.j]C C ;8oSymfony/Component/Console/Tests/Command/ListCommandTest.phpnu[PK.j]Qd d @xSymfony/Component/Console/Tests/Tester/ApplicationTesterTest.phpnu[PK.j]x0mB B <Symfony/Component/Console/Tests/Tester/CommandTesterTest.phpnu[PK.j]KU##9hSymfony/Component/Console/Tests/Input/InputOptionTest.phpnu[PK.j]p3ȲSymfony/Component/Console/Tests/Input/InputTest.phpnu[PK.j]@HH=Symfony/Component/Console/Tests/Input/InputDefinitionTest.phpnu[PK.j]9I;;7Symfony/Component/Console/Tests/Input/ArgvInputTest.phpnu[PK.j]F5;gMSymfony/Component/Console/Tests/Input/InputArgumentTest.phpnu[PK.j]1E<<8^Symfony/Component/Console/Tests/Input/ArrayInputTest.phpnu[PK.j]9-rSymfony/Component/Console/Tests/Input/StringInputTest.phpnu[PK.j]?UHii*/Symfony/Component/Console/phpunit.xml.distnu[PKi])q&Symfony/Component/Console/CHANGELOG.mdnu[PKi]E))!ڏSymfony/Component/Console/LICENSEnu[PKi]Q&xee'TSymfony/Component/Console/composer.jsonnu[PKi]#Symfony/Component/Console/README.mdnu[PK=