You are here

public function ParameterBagTest::testResolveIndicatesWhyAParameterIsNeeded in Service Container 7

Same name and namespace in other branches
  1. 7.2 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php \Symfony\Component\DependencyInjection\Tests\ParameterBag\ParameterBagTest::testResolveIndicatesWhyAParameterIsNeeded()

@covers Symfony\Component\DependencyInjection\ParameterBag\ParameterBag::resolve

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php, line 204

Class

ParameterBagTest

Namespace

Symfony\Component\DependencyInjection\Tests\ParameterBag

Code

public function testResolveIndicatesWhyAParameterIsNeeded() {
  $bag = new ParameterBag(array(
    'foo' => '%bar%',
  ));
  try {
    $bag
      ->resolve();
  } catch (ParameterNotFoundException $e) {
    $this
      ->assertEquals('The parameter "foo" has a dependency on a non-existent parameter "bar".', $e
      ->getMessage());
  }
  $bag = new ParameterBag(array(
    'foo' => '%bar%',
  ));
  try {
    $bag
      ->resolve();
  } catch (ParameterNotFoundException $e) {
    $this
      ->assertEquals('The parameter "foo" has a dependency on a non-existent parameter "bar".', $e
      ->getMessage());
  }
}