public function BlockContentSaveTest::testBlockContentSaveOnInsert in Drupal 9
Same name and namespace in other branches
- 8 core/modules/block_content/tests/src/Functional/BlockContentSaveTest.php \Drupal\Tests\block_content\Functional\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/ tests/ src/ Functional/ BlockContentSaveTest.php, line 103
Class
- BlockContentSaveTest
- Tests $block_content->save() for saving content.
Namespace
Drupal\Tests\block_content\FunctionalCode
public function testBlockContentSaveOnInsert() {
// block_content_test_block_content_insert() triggers a save on insert if the
// title equals 'new'.
$block = $this
->createBlockContent('new');
$this
->assertEquals('BlockContent ' . $block
->id(), $block
->label(), 'Custom block saved on block insert.');
}