Add pear modules, mail and net_smtp via composer (#93)
Add pear modules, mail and net_smtp via composer, remove php 5.6 build due to phpunit 6
This commit is contained in:
@@ -11,12 +11,13 @@
|
||||
|
||||
namespace Symfony\Component\Console\Tests\Input;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
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
|
||||
class ArgvInputTest extends TestCase
|
||||
{
|
||||
public function testConstructor()
|
||||
{
|
||||
@@ -47,7 +48,7 @@ class ArgvInputTest extends \PHPUnit_Framework_TestCase
|
||||
$input = new ArgvInput($input);
|
||||
$input->bind(new InputDefinition($options));
|
||||
|
||||
$this->assertEquals($expectedOptions, $input->getOptions(), $message);
|
||||
$this->assertSame($expectedOptions, $input->getOptions(), $message);
|
||||
}
|
||||
|
||||
public function provideOptions()
|
||||
@@ -74,14 +75,32 @@ class ArgvInputTest extends \PHPUnit_Framework_TestCase
|
||||
array(
|
||||
array('cli.php', '--foo='),
|
||||
array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL)),
|
||||
array('foo' => null),
|
||||
'->parse() parses long options with optional value which is empty (with a = separator) as null',
|
||||
array('foo' => ''),
|
||||
'->parse() parses long options with optional value which is empty (with a = separator) as empty string',
|
||||
),
|
||||
array(
|
||||
array('cli.php', '--foo=', 'bar'),
|
||||
array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputArgument('name', InputArgument::REQUIRED)),
|
||||
array('foo' => ''),
|
||||
'->parse() parses long options with optional value without value specified or an empty string (with a = separator) followed by an argument as empty string',
|
||||
),
|
||||
array(
|
||||
array('cli.php', 'bar', '--foo'),
|
||||
array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputArgument('name', InputArgument::REQUIRED)),
|
||||
array('foo' => null),
|
||||
'->parse() parses long options with optional value which is empty (with a = separator) followed by an argument',
|
||||
'->parse() parses long options with optional value which is empty (with a = separator) preceded by an argument',
|
||||
),
|
||||
array(
|
||||
array('cli.php', '--foo', '', 'bar'),
|
||||
array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputArgument('name', InputArgument::REQUIRED)),
|
||||
array('foo' => ''),
|
||||
'->parse() parses long options with optional value which is empty as empty string even followed by an argument',
|
||||
),
|
||||
array(
|
||||
array('cli.php', '--foo'),
|
||||
array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL)),
|
||||
array('foo' => null),
|
||||
'->parse() parses long options with optional value specified with no separator and no value as null',
|
||||
),
|
||||
array(
|
||||
array('cli.php', '-f'),
|
||||
@@ -163,7 +182,12 @@ class ArgvInputTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testInvalidInput($argv, $definition, $expectedExceptionMessage)
|
||||
{
|
||||
$this->setExpectedException('RuntimeException', $expectedExceptionMessage);
|
||||
if (method_exists($this, 'expectException')) {
|
||||
$this->expectException('RuntimeException');
|
||||
$this->expectExceptionMessage($expectedExceptionMessage);
|
||||
} else {
|
||||
$this->setExpectedException('RuntimeException', $expectedExceptionMessage);
|
||||
}
|
||||
|
||||
$input = new ArgvInput($argv);
|
||||
$input->bind($definition);
|
||||
@@ -246,14 +270,14 @@ class ArgvInputTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$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)');
|
||||
$this->assertSame(array('name' => array('foo', 'bar', '')), $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)');
|
||||
$this->assertSame(array('name' => array('foo', 'bar', null), 'anotherOption' => true), $input->getOptions(), '->parse() parses empty array options ("--option value" syntax)');
|
||||
}
|
||||
|
||||
public function testParseNegativeNumberAfterDoubleDash()
|
||||
@@ -290,6 +314,12 @@ class ArgvInputTest extends \PHPUnit_Framework_TestCase
|
||||
$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', '-fh'));
|
||||
$this->assertTrue($input->hasParameterOption('-fh'), '->hasParameterOption() returns true if the given short option is in the raw input');
|
||||
|
||||
$input = new ArgvInput(array('cli.php', '-e=test'));
|
||||
$this->assertFalse($input->hasParameterOption('-s'), '->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');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user