merged branch jfsimon/issue-7232-2.1 (PR #7236)
This PR was merged into the 2.1 branch. Commits -------6681df0
[Console] fixed StringInput binding6b98883
[Console] added string input test32f1904
Revert "merged branch jfsimon/issue-6749 (PR #7220)" Discussion ---------- [Console] fixes tests | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #7231 --------------------------------------------------------------------------- by gigablah at 2013-03-02T13:25:10Z Apparently5b19c892cf
broke the console shell. I was wondering why all commands executed through the shell in 2.2.0 were throwing "Too many arguments" exception. --------------------------------------------------------------------------- by stof at 2013-03-02T13:27:09Z @gigablah This is already fixed in the 2.2 branch as this PR has already been merged in 2.2 (but the revert is also needed in 2.1) --------------------------------------------------------------------------- by gigablah at 2013-03-02T13:51:44Z Ah, guess I'll have to wait for it to be pushed to the symfony/console repository then.
This commit is contained in:
commit
446f56847b
@ -68,7 +68,6 @@ class ArgvInput extends Input
|
|||||||
protected function setTokens(array $tokens)
|
protected function setTokens(array $tokens)
|
||||||
{
|
{
|
||||||
$this->tokens = $tokens;
|
$this->tokens = $tokens;
|
||||||
$this->parse();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,9 +37,13 @@ class StringInput extends ArgvInput
|
|||||||
*/
|
*/
|
||||||
public function __construct($input, InputDefinition $definition = null)
|
public function __construct($input, InputDefinition $definition = null)
|
||||||
{
|
{
|
||||||
parent::__construct(array(), $definition);
|
parent::__construct(array(), null);
|
||||||
|
|
||||||
$this->setTokens($this->tokenize($input));
|
$this->setTokens($this->tokenize($input));
|
||||||
|
|
||||||
|
if (null !== $definition) {
|
||||||
|
$this->bind($definition);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,9 +11,9 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Console\Tests\Input;
|
namespace Symfony\Component\Console\Tests\Input;
|
||||||
|
|
||||||
use Symfony\Component\Console\Input\StringInput;
|
|
||||||
use Symfony\Component\Console\Input\InputDefinition;
|
use Symfony\Component\Console\Input\InputDefinition;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
|
use Symfony\Component\Console\Input\StringInput;
|
||||||
|
|
||||||
class StringInputTest extends \PHPUnit_Framework_TestCase
|
class StringInputTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
@ -35,10 +35,14 @@ class StringInputTest extends \PHPUnit_Framework_TestCase
|
|||||||
array(new InputOption('foo', null, InputOption::VALUE_REQUIRED))
|
array(new InputOption('foo', null, InputOption::VALUE_REQUIRED))
|
||||||
);
|
);
|
||||||
|
|
||||||
$input = new StringInput('--foo=bar', $definition);
|
// call to bind
|
||||||
$actual = $input->getOption('foo');
|
$input = new StringInput('--foo=bar');
|
||||||
|
$input->bind($definition);
|
||||||
|
$this->assertEquals('bar', $input->getOption('foo'));
|
||||||
|
|
||||||
$this->assertEquals('bar', $actual);
|
// definition in constructor
|
||||||
|
$input = new StringInput('--foo=bar', $definition);
|
||||||
|
$this->assertEquals('bar', $input->getOption('foo'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTokenizeData()
|
public function getTokenizeData()
|
||||||
|
Reference in New Issue
Block a user