You are here

public function ContainerTest::testGetThrowsExceptionOnServiceConfiguration in Service Container 7.2

Same name and namespace in other branches
  1. 7 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/ContainerTest.php \Symfony\Component\DependencyInjection\Tests\ContainerTest::testGetThrowsExceptionOnServiceConfiguration()

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/ContainerTest.php, line 559

Class

ContainerTest

Namespace

Symfony\Component\DependencyInjection\Tests

Code

public function testGetThrowsExceptionOnServiceConfiguration() {
  $c = new ProjectServiceContainer();
  try {
    $c
      ->get('throws_exception_on_service_configuration');
  } catch (\Exception $e) {

    // Do nothing.
  }
  $this
    ->assertFalse($c
    ->initialized('throws_exception_on_service_configuration'));

  // Retry, to make sure that get*Service() will be called.
  try {
    $c
      ->get('throws_exception_on_service_configuration');
  } catch (\Exception $e) {

    // Do nothing.
  }
  $this
    ->assertFalse($c
    ->initialized('throws_exception_on_service_configuration'));
}