Skip to content

Commit

Permalink
[Console] added string input test
Browse files Browse the repository at this point in the history
  • Loading branch information
jfsimon committed Mar 1, 2013
1 parent 4b12118 commit f95f8e2
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Symfony/Component/Console/Tests/Input/StringInputTest.php
Expand Up @@ -11,6 +11,8 @@

namespace Symfony\Component\Console\Tests\Input;

use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\StringInput;

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

public function testInputOptionWithGivenString()
{
$definition = new InputDefinition(
array(new InputOption('foo', null, InputOption::VALUE_REQUIRED))
);

$input = new StringInput('--foo=bar');
$input->bind($definition);
$actual = $input->getOption('foo');

$this->assertEquals('bar', $actual);
}

public function getTokenizeData()
{
return array(
Expand Down

0 comments on commit f95f8e2

Please sign in to comment.