Version 1
[yaffs-website] / web / core / modules / node / tests / modules / node_test_exception / node_test_exception.module
diff --git a/web/core/modules/node/tests/modules/node_test_exception/node_test_exception.module b/web/core/modules/node/tests/modules/node_test_exception/node_test_exception.module
new file mode 100644 (file)
index 0000000..b016fe8
--- /dev/null
@@ -0,0 +1,17 @@
+<?php
+
+/**
+ * @file
+ * A module implementing node related hooks to test API interaction.
+ */
+
+use Drupal\node\NodeInterface;
+
+/**
+ * Implements hook_ENTITY_TYPE_insert() for node entities.
+ */
+function node_test_exception_node_insert(NodeInterface $node) {
+  if ($node->getTitle() == 'testing_transaction_exception') {
+    throw new Exception('Test exception for rollback.');
+  }
+}