Skip to content

Commit

Permalink
Added tests for ParameterBag parameters with spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
ericclemmons committed Dec 27, 2011
1 parent f458e96 commit 99011ca
Showing 1 changed file with 25 additions and 0 deletions.
Expand Up @@ -164,4 +164,29 @@ public function testResolveIndicatesWhyAParameterIsNeeded()
$this->assertEquals('The parameter "foo" has a dependency on a non-existent parameter "bar".', $e->getMessage());
}
}

/**
* @covers Symfony\Component\DependencyInjection\ParameterBag\ParameterBag::resolve
* @dataProvider stringsWithSpacesProvider
*/
public function testResolveStringWithSpacesReturnsString($expected, $test, $description)
{
$bag = new ParameterBag(array('foo' => 'bar'));

try {
$this->assertEquals($expected, $bag->resolveString($test), $description);
} catch (ParameterNotFoundException $e) {
$this->fail(sprintf('%s - "%s"', $description, $expected));
}
}

public function stringsWithSpacesProvider()
{
return array(
array('bar', '%foo%', 'Parameters must be wrapped by %.'),
array('% foo %', '% foo %', 'Parameters should not have spaces.'),
array('{% set my_template = "foo" %}', '{% set my_template = "foo" %}', 'Twig-like strings are not parameters.'),
array('50% is less than 100%', '50% is less than 100%', 'Text between % signs is allowed, if there are spaces.'),
);
}
}

0 comments on commit 99011ca

Please sign in to comment.