Version 1
[yaffs-website] / web / core / modules / system / src / Tests / Bootstrap / ExceptionContainer.php
diff --git a/web/core/modules/system/src/Tests/Bootstrap/ExceptionContainer.php b/web/core/modules/system/src/Tests/Bootstrap/ExceptionContainer.php
new file mode 100644 (file)
index 0000000..d430e3b
--- /dev/null
@@ -0,0 +1,24 @@
+<?php
+
+namespace Drupal\system\Tests\Bootstrap;
+
+use Drupal\Core\DependencyInjection\Container;
+
+/**
+ * Base container which throws an exception.
+ */
+class ExceptionContainer extends Container {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE) {
+    if ($id === 'http_kernel') {
+      throw new \Exception('Thrown exception during Container::get');
+    }
+    else {
+      return parent::get($id, $invalidBehavior);
+    }
+  }
+
+}