ExceptionContainer.php

Same filename and directory in other branches
  1. 9 core/tests/Drupal/FunctionalTests/Bootstrap/ExceptionContainer.php
  2. 8.9.x core/tests/Drupal/FunctionalTests/Bootstrap/ExceptionContainer.php
  3. 10 core/tests/Drupal/FunctionalTests/Bootstrap/ExceptionContainer.php

Namespace

Drupal\FunctionalTests\Bootstrap

File

core/tests/Drupal/FunctionalTests/Bootstrap/ExceptionContainer.php

View source
<?php

declare (strict_types=1);
namespace Drupal\FunctionalTests\Bootstrap;

use Drupal\Core\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * Base container which throws an exception.
 */
class ExceptionContainer extends Container {
    
    /**
     * {@inheritdoc}
     */
    public function get($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE) : ?object {
        if ($id === 'http_kernel') {
            throw new \Exception('Thrown exception during Container::get');
        }
        else {
            return parent::get($id, $invalidBehavior);
        }
    }

}

Classes

Title Deprecated Summary
ExceptionContainer Base container which throws an exception.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.