You are here

public function BlockContentSaveTest::testBlockContentSaveOnInsert in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/block_content/src/Tests/BlockContentSaveTest.php \Drupal\block_content\Tests\BlockContentSaveTest::testBlockContentSaveOnInsert()

Tests saving a block on block insert.

This test ensures that a block has been fully saved when hook_block_content_insert() is invoked, so that the block can be saved again in a hook implementation without errors.

See also

block_test_block_insert()

File

core/modules/block_content/src/Tests/BlockContentSaveTest.php, line 100
Contains \Drupal\block_content\Tests\BlockContentSaveTest.

Class

BlockContentSaveTest
Tests $block_content->save() for saving content.

Namespace

Drupal\block_content\Tests

Code

public function testBlockContentSaveOnInsert() {

  // block_content_test_block_content_insert() triggers a save on insert if the
  // title equals 'new'.
  $block = $this
    ->createBlockContent('new');
  $this
    ->assertEqual($block
    ->label(), 'BlockContent ' . $block
    ->id(), 'Custom block saved on block insert.');
}