function NodeCreationTest::testNodeCreateExceptionHandling

Tests exception handling when saving a node through the form.

File

core/modules/node/tests/src/Functional/NodeCreationTest.php, line 316

Class

NodeCreationTest
Create a node and test saving it.

Namespace

Drupal\Tests\node\Functional

Code

public function testNodeCreateExceptionHandling() : void {
  $this->drupalGet('node/add/page');
  $this->submitForm([
    'title[0][value]' => 'testing_transaction_exception',
    'body[0][value]' => $this->randomMachineName(16),
  ], 'Save');
  $this->assertSession()
    ->pageTextNotContains('The website encountered an unexpected error.');
  $this->assertSession()
    ->pageTextContains('The content could not be saved. Contact the site administrator if the problem persists.');
}

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