Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 446f568

Browse files
committed
merged branch jfsimon/issue-7232-2.1 (PR #7236)
This PR was merged into the 2.1 branch. Commits ------- 6681df0 [Console] fixed StringInput binding 6b98883 [Console] added string input test 32f1904 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 Apparently 5b19c89 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.
2 parents dcb1441 + 6681df0 commit 446f568

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

src/Symfony/Component/Console/Input/ArgvInput.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ public function __construct(array $argv = null, InputDefinition $definition = nu
6868
protected function setTokens(array $tokens)
6969
{
7070
$this->tokens = $tokens;
71-
$this->parse();
7271
}
7372

7473
/**

src/Symfony/Component/Console/Input/StringInput.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,13 @@ class StringInput extends ArgvInput
3737
*/
3838
public function __construct($input, InputDefinition $definition = null)
3939
{
40-
parent::__construct(array(), $definition);
40+
parent::__construct(array(), null);
4141

4242
$this->setTokens($this->tokenize($input));
43+
44+
if (null !== $definition) {
45+
$this->bind($definition);
46+
}
4347
}
4448

4549
/**

src/Symfony/Component/Console/Tests/Input/StringInputTest.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111

1212
namespace Symfony\Component\Console\Tests\Input;
1313

14-
use Symfony\Component\Console\Input\StringInput;
1514
use Symfony\Component\Console\Input\InputDefinition;
1615
use Symfony\Component\Console\Input\InputOption;
16+
use Symfony\Component\Console\Input\StringInput;
1717

1818
class StringInputTest extends \PHPUnit_Framework_TestCase
1919
{
@@ -35,10 +35,14 @@ public function testInputOptionWithGivenString()
3535
array(new InputOption('foo', null, InputOption::VALUE_REQUIRED))
3636
);
3737

38-
$input = new StringInput('--foo=bar', $definition);
39-
$actual = $input->getOption('foo');
38+
// call to bind
39+
$input = new StringInput('--foo=bar');
40+
$input->bind($definition);
41+
$this->assertEquals('bar', $input->getOption('foo'));
4042

41-
$this->assertEquals('bar', $actual);
43+
// definition in constructor
44+
$input = new StringInput('--foo=bar', $definition);
45+
$this->assertEquals('bar', $input->getOption('foo'));
4246
}
4347

4448
public function getTokenizeData()

0 commit comments

Comments
 (0)