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

Skip to content

Commit f95f8e2

Browse files
committed
[Console] added string input test
1 parent 4b12118 commit f95f8e2

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

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

14+
use Symfony\Component\Console\Input\InputDefinition;
15+
use Symfony\Component\Console\Input\InputOption;
1416
use Symfony\Component\Console\Input\StringInput;
1517

1618
class StringInputTest extends \PHPUnit_Framework_TestCase
@@ -27,6 +29,19 @@ public function testTokenize($input, $tokens, $message)
2729
$this->assertEquals($tokens, $p->getValue($input), $message);
2830
}
2931

32+
public function testInputOptionWithGivenString()
33+
{
34+
$definition = new InputDefinition(
35+
array(new InputOption('foo', null, InputOption::VALUE_REQUIRED))
36+
);
37+
38+
$input = new StringInput('--foo=bar');
39+
$input->bind($definition);
40+
$actual = $input->getOption('foo');
41+
42+
$this->assertEquals('bar', $actual);
43+
}
44+
3045
public function getTokenizeData()
3146
{
3247
return array(

0 commit comments

Comments
 (0)