ExceptionContainer.php 498 B

123456789101112131415161718192021222324
  1. <?php
  2. namespace Drupal\FunctionalTests\Bootstrap;
  3. use Drupal\Core\DependencyInjection\Container;
  4. /**
  5. * Base container which throws an exception.
  6. */
  7. class ExceptionContainer extends Container {
  8. /**
  9. * {@inheritdoc}
  10. */
  11. public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE) {
  12. if ($id === 'http_kernel') {
  13. throw new \Exception('Thrown exception during Container::get');
  14. }
  15. else {
  16. return parent::get($id, $invalidBehavior);
  17. }
  18. }
  19. }