$this->
assertEquals(['bar' =>
['ding' => 'I\'m a bar %%foo %%bar', 'zero' => null
]],
$bag->
get('foo'
), '->escapeValue() escapes % by doubling it'
);
} /**
* @dataProvider stringsWithSpacesProvider
*/
public function testResolveStringWithSpacesReturnsString($expected,
$test,
$description) { $bag =
new ParameterBag(['foo' => 'bar'
]);
try { $this->
assertEquals($expected,
$bag->
resolveString($test),
$description);
} catch (ParameterNotFoundException
$e) { $this->
fail(sprintf('%s - "%s"',
$description,
$expected));
} } public static function stringsWithSpacesProvider() { return [ ['bar', '%foo%', 'Parameters must be wrapped by %.'
],
['% foo %', '% foo %', 'Parameters should not have spaces.'
],
['{% set my_template = "foo" %}', '{% set my_template = "foo" %}', 'Twig-like strings are not parameters.'
],
[