mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-29 05:28:44 +02:00
Updating Symfony lib and dependencies:
Package operations: 2 installs, 23 updates, 0 removals - Updating psr/log (1.1.0 => 1.1.2) - Updating symfony/debug (v3.4.30 => v3.4.35) - Updating symfony/console (v3.4.30 => v3.4.35) - Updating symfony/dotenv (v3.4.30 => v3.4.35) - Updating symfony/routing (v3.4.30 => v3.4.35) - Updating symfony/finder (v3.4.30 => v3.4.35) - Updating symfony/filesystem (v3.4.30 => v3.4.35) - Installing symfony/polyfill-util (v1.12.0) - Installing symfony/polyfill-php56 (v1.12.0) - Updating symfony/http-foundation (v3.4.30 => v3.4.35) - Updating symfony/event-dispatcher (v3.4.30 => v3.4.35) - Updating symfony/http-kernel (v3.4.30 => v3.4.35) - Updating symfony/config (v3.4.30 => v3.4.35) - Updating symfony/dependency-injection (v3.4.30 => v3.4.35) - Updating symfony/class-loader (v3.4.30 => v3.4.35) - Updating symfony/cache (v3.4.30 => v3.4.35) - Updating symfony/framework-bundle (v3.4.30 => v3.4.35) - Updating twig/twig (v1.42.2 => v1.42.4) - Updating symfony/twig-bridge (v3.4.30 => v3.4.35) - Updating symfony/twig-bundle (v3.4.30 => v3.4.35) - Updating symfony/yaml (v3.4.30 => v3.4.35) - Updating symfony/stopwatch (v3.4.30 => v3.4.35) - Updating symfony/var-dumper (v3.4.30 => v3.4.35) - Updating symfony/web-profiler-bundle (v3.4.30 => v3.4.35) - Updating symfony/css-selector (v3.4.30 => v3.4.35)
This commit is contained in:
@@ -182,12 +182,8 @@ class ArgvInputTest extends TestCase
|
||||
*/
|
||||
public function testInvalidInput($argv, $definition, $expectedExceptionMessage)
|
||||
{
|
||||
if (method_exists($this, 'expectException')) {
|
||||
$this->expectException('RuntimeException');
|
||||
$this->expectExceptionMessage($expectedExceptionMessage);
|
||||
} else {
|
||||
$this->setExpectedException('RuntimeException', $expectedExceptionMessage);
|
||||
}
|
||||
$this->expectException('RuntimeException');
|
||||
$this->expectExceptionMessage($expectedExceptionMessage);
|
||||
|
||||
$input = new ArgvInput($argv);
|
||||
$input->bind($definition);
|
||||
|
||||
@@ -127,12 +127,8 @@ class ArrayInputTest extends TestCase
|
||||
*/
|
||||
public function testParseInvalidInput($parameters, $definition, $expectedExceptionMessage)
|
||||
{
|
||||
if (method_exists($this, 'expectException')) {
|
||||
$this->expectException('InvalidArgumentException');
|
||||
$this->expectExceptionMessage($expectedExceptionMessage);
|
||||
} else {
|
||||
$this->setExpectedException('InvalidArgumentException', $expectedExceptionMessage);
|
||||
}
|
||||
$this->expectException('InvalidArgumentException');
|
||||
$this->expectExceptionMessage($expectedExceptionMessage);
|
||||
|
||||
new ArrayInput($parameters, $definition);
|
||||
}
|
||||
|
||||
@@ -42,12 +42,8 @@ class InputArgumentTest extends TestCase
|
||||
*/
|
||||
public function testInvalidModes($mode)
|
||||
{
|
||||
if (method_exists($this, 'expectException')) {
|
||||
$this->expectException('InvalidArgumentException');
|
||||
$this->expectExceptionMessage(sprintf('Argument mode "%s" is not valid.', $mode));
|
||||
} else {
|
||||
$this->setExpectedException('InvalidArgumentException', sprintf('Argument mode "%s" is not valid.', $mode));
|
||||
}
|
||||
$this->expectException('InvalidArgumentException');
|
||||
$this->expectExceptionMessage(sprintf('Argument mode "%s" is not valid.', $mode));
|
||||
|
||||
new InputArgument('foo', $mode);
|
||||
}
|
||||
@@ -95,22 +91,18 @@ class InputArgumentTest extends TestCase
|
||||
$this->assertEquals([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()
|
||||
{
|
||||
$this->expectException('LogicException');
|
||||
$this->expectExceptionMessage('Cannot set a default value except for InputArgument::OPTIONAL mode.');
|
||||
$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()
|
||||
{
|
||||
$this->expectException('LogicException');
|
||||
$this->expectExceptionMessage('A default value for an array argument must be an array.');
|
||||
$argument = new InputArgument('foo', InputArgument::IS_ARRAY);
|
||||
$argument->setDefault('default');
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ class InputDefinitionTest extends TestCase
|
||||
{
|
||||
protected static $fixtures;
|
||||
|
||||
protected $multi;
|
||||
protected $foo;
|
||||
protected $bar;
|
||||
protected $foo1;
|
||||
@@ -86,12 +87,10 @@ class InputDefinitionTest extends TestCase
|
||||
$this->assertEquals(['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->expectException('LogicException');
|
||||
$this->expectExceptionMessage('An argument with name "foo" already exists.');
|
||||
$this->initializeArguments();
|
||||
|
||||
$definition = new InputDefinition();
|
||||
@@ -99,12 +98,10 @@ class InputDefinitionTest extends TestCase
|
||||
$definition->addArgument($this->foo1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \LogicException
|
||||
* @expectedExceptionMessage Cannot add an argument after an array argument.
|
||||
*/
|
||||
public function testArrayArgumentHasToBeLast()
|
||||
{
|
||||
$this->expectException('LogicException');
|
||||
$this->expectExceptionMessage('Cannot add an argument after an array argument.');
|
||||
$this->initializeArguments();
|
||||
|
||||
$definition = new InputDefinition();
|
||||
@@ -112,12 +109,10 @@ class InputDefinitionTest extends TestCase
|
||||
$definition->addArgument(new InputArgument('anotherbar'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \LogicException
|
||||
* @expectedExceptionMessage Cannot add a required argument after an optional one.
|
||||
*/
|
||||
public function testRequiredArgumentCannotFollowAnOptionalOne()
|
||||
{
|
||||
$this->expectException('LogicException');
|
||||
$this->expectExceptionMessage('Cannot add a required argument after an optional one.');
|
||||
$this->initializeArguments();
|
||||
|
||||
$definition = new InputDefinition();
|
||||
@@ -134,12 +129,10 @@ class InputDefinitionTest extends TestCase
|
||||
$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->expectException('InvalidArgumentException');
|
||||
$this->expectExceptionMessage('The "bar" argument does not exist.');
|
||||
$this->initializeArguments();
|
||||
|
||||
$definition = new InputDefinition();
|
||||
@@ -206,12 +199,10 @@ class InputDefinitionTest extends TestCase
|
||||
$this->assertEquals(['bar' => $this->bar], $definition->getOptions(), '->setOptions() clears all InputOption objects');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @expectedExceptionMessage The "-f" option does not exist.
|
||||
*/
|
||||
public function testSetOptionsClearsOptions()
|
||||
{
|
||||
$this->expectException('InvalidArgumentException');
|
||||
$this->expectExceptionMessage('The "-f" option does not exist.');
|
||||
$this->initializeOptions();
|
||||
|
||||
$definition = new InputDefinition([$this->foo]);
|
||||
@@ -240,12 +231,10 @@ class InputDefinitionTest extends TestCase
|
||||
$this->assertEquals(['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->expectException('LogicException');
|
||||
$this->expectExceptionMessage('An option named "foo" already exists.');
|
||||
$this->initializeOptions();
|
||||
|
||||
$definition = new InputDefinition();
|
||||
@@ -253,12 +242,10 @@ class InputDefinitionTest extends TestCase
|
||||
$definition->addOption($this->foo2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \LogicException
|
||||
* @expectedExceptionMessage An option with shortcut "f" already exists.
|
||||
*/
|
||||
public function testAddDuplicateShortcutOption()
|
||||
{
|
||||
$this->expectException('LogicException');
|
||||
$this->expectExceptionMessage('An option with shortcut "f" already exists.');
|
||||
$this->initializeOptions();
|
||||
|
||||
$definition = new InputDefinition();
|
||||
@@ -274,12 +261,10 @@ class InputDefinitionTest extends TestCase
|
||||
$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->expectException('InvalidArgumentException');
|
||||
$this->expectExceptionMessage('The "--bar" option does not exist.');
|
||||
$this->initializeOptions();
|
||||
|
||||
$definition = new InputDefinition([$this->foo]);
|
||||
@@ -321,12 +306,10 @@ class InputDefinitionTest extends TestCase
|
||||
$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->expectException('InvalidArgumentException');
|
||||
$this->expectExceptionMessage('The "-l" option does not exist.');
|
||||
$this->initializeOptions();
|
||||
|
||||
$definition = new InputDefinition([$this->foo]);
|
||||
|
||||
@@ -24,12 +24,10 @@ class InputOptionTest extends TestCase
|
||||
$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()
|
||||
{
|
||||
$this->expectException('InvalidArgumentException');
|
||||
$this->expectExceptionMessage('Impossible to have an option mode VALUE_IS_ARRAY if the option does not accept a value.');
|
||||
new InputOption('foo', 'f', InputOption::VALUE_IS_ARRAY);
|
||||
}
|
||||
|
||||
@@ -78,12 +76,8 @@ class InputOptionTest extends TestCase
|
||||
*/
|
||||
public function testInvalidModes($mode)
|
||||
{
|
||||
if (method_exists($this, 'expectException')) {
|
||||
$this->expectException('InvalidArgumentException');
|
||||
$this->expectExceptionMessage(sprintf('Option mode "%s" is not valid.', $mode));
|
||||
} else {
|
||||
$this->setExpectedException('InvalidArgumentException', sprintf('Option mode "%s" is not valid.', $mode));
|
||||
}
|
||||
$this->expectException('InvalidArgumentException');
|
||||
$this->expectExceptionMessage(sprintf('Option mode "%s" is not valid.', $mode));
|
||||
|
||||
new InputOption('foo', 'f', $mode);
|
||||
}
|
||||
@@ -96,27 +90,21 @@ class InputOptionTest extends TestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testEmptyNameIsInvalid()
|
||||
{
|
||||
$this->expectException('InvalidArgumentException');
|
||||
new InputOption('');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testDoubleDashNameIsInvalid()
|
||||
{
|
||||
$this->expectException('InvalidArgumentException');
|
||||
new InputOption('--');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testSingleDashOptionIsInvalid()
|
||||
{
|
||||
$this->expectException('InvalidArgumentException');
|
||||
new InputOption('foo', '-');
|
||||
}
|
||||
|
||||
@@ -165,22 +153,18 @@ class InputOptionTest extends TestCase
|
||||
$this->assertEquals([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()
|
||||
{
|
||||
$this->expectException('LogicException');
|
||||
$this->expectExceptionMessage('Cannot set a default value when using InputOption::VALUE_NONE mode.');
|
||||
$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()
|
||||
{
|
||||
$this->expectException('LogicException');
|
||||
$this->expectExceptionMessage('A default value for an array option must be an array.');
|
||||
$option = new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY);
|
||||
$option->setDefault('default');
|
||||
}
|
||||
|
||||
@@ -47,22 +47,18 @@ class InputTest extends TestCase
|
||||
$this->assertEquals(['name' => 'foo', 'bar' => null], $input->getOptions(), '->getOptions() returns all option values');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @expectedExceptionMessage The "foo" option does not exist.
|
||||
*/
|
||||
public function testSetInvalidOption()
|
||||
{
|
||||
$this->expectException('InvalidArgumentException');
|
||||
$this->expectExceptionMessage('The "foo" option does not exist.');
|
||||
$input = new ArrayInput(['--name' => 'foo'], new InputDefinition([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()
|
||||
{
|
||||
$this->expectException('InvalidArgumentException');
|
||||
$this->expectExceptionMessage('The "foo" option does not exist.');
|
||||
$input = new ArrayInput(['--name' => 'foo'], new InputDefinition([new InputOption('name'), new InputOption('bar', '', InputOption::VALUE_OPTIONAL, '', 'default')]));
|
||||
$input->getOption('foo');
|
||||
}
|
||||
@@ -81,43 +77,35 @@ class InputTest extends TestCase
|
||||
$this->assertEquals(['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()
|
||||
{
|
||||
$this->expectException('InvalidArgumentException');
|
||||
$this->expectExceptionMessage('The "foo" argument does not exist.');
|
||||
$input = new ArrayInput(['name' => 'foo'], new InputDefinition([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()
|
||||
{
|
||||
$this->expectException('InvalidArgumentException');
|
||||
$this->expectExceptionMessage('The "foo" argument does not exist.');
|
||||
$input = new ArrayInput(['name' => 'foo'], new InputDefinition([new InputArgument('name'), new InputArgument('bar', InputArgument::OPTIONAL, '', 'default')]));
|
||||
$input->getArgument('foo');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \RuntimeException
|
||||
* @expectedExceptionMessage Not enough arguments (missing: "name").
|
||||
*/
|
||||
public function testValidateWithMissingArguments()
|
||||
{
|
||||
$this->expectException('RuntimeException');
|
||||
$this->expectExceptionMessage('Not enough arguments (missing: "name").');
|
||||
$input = new ArrayInput([]);
|
||||
$input->bind(new InputDefinition([new InputArgument('name', InputArgument::REQUIRED)]));
|
||||
$input->validate();
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \RuntimeException
|
||||
* @expectedExceptionMessage Not enough arguments (missing: "name").
|
||||
*/
|
||||
public function testValidateWithMissingRequiredArguments()
|
||||
{
|
||||
$this->expectException('RuntimeException');
|
||||
$this->expectExceptionMessage('Not enough arguments (missing: "name").');
|
||||
$input = new ArrayInput(['bar' => 'baz']);
|
||||
$input->bind(new InputDefinition([new InputArgument('name', InputArgument::REQUIRED), new InputArgument('bar', InputArgument::OPTIONAL)]));
|
||||
$input->validate();
|
||||
|
||||
Reference in New Issue
Block a user