File tree 2 files changed +10
-3
lines changed
src/Symfony/Component/Console
2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -37,9 +37,13 @@ class StringInput extends ArgvInput
37
37
*/
38
38
public function __construct ($ input , InputDefinition $ definition = null )
39
39
{
40
- parent ::__construct (array (), $ definition );
40
+ parent ::__construct (array (), null );
41
41
42
42
$ this ->setTokens ($ this ->tokenize ($ input ));
43
+
44
+ if (null !== $ definition ) {
45
+ $ this ->bind ($ definition );
46
+ }
43
47
}
44
48
45
49
/**
Original file line number Diff line number Diff line change @@ -35,11 +35,14 @@ public function testInputOptionWithGivenString()
35
35
array (new InputOption ('foo ' , null , InputOption::VALUE_REQUIRED ))
36
36
);
37
37
38
+ // call to bind
38
39
$ input = new StringInput ('--foo=bar ' );
39
40
$ input ->bind ($ definition );
40
- $ actual = $ input ->getOption ('foo ' );
41
+ $ this -> assertEquals ( ' bar ' , $ input ->getOption ('foo ' ) );
41
42
42
- $ this ->assertEquals ('bar ' , $ actual );
43
+ // definition in constructor
44
+ $ input = new StringInput ('--foo=bar ' , $ definition );
45
+ $ this ->assertEquals ('bar ' , $ input ->getOption ('foo ' ));
43
46
}
44
47
45
48
public function getTokenizeData ()
You can’t perform that action at this time.
0 commit comments