You are here

function node_test_exception_node_insert in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/node/tests/modules/node_test_exception/node_test_exception.module \node_test_exception_node_insert()
  2. 7 modules/node/tests/node_test_exception.module \node_test_exception_node_insert()

Implements hook_ENTITY_TYPE_insert() for node entities.

File

core/modules/node/tests/modules/node_test_exception/node_test_exception.module, line 13
A module implementing node related hooks to test API interaction.

Code

function node_test_exception_node_insert(NodeInterface $node) {
  if ($node
    ->getTitle() == 'testing_transaction_exception') {
    throw new Exception('Test exception for rollback.');
  }
}