protected function BlockContentTestBase::createBlockContent in Drupal 10
Same name in this branch
- 10 core/modules/block_content/tests/src/Functional/BlockContentTestBase.php \Drupal\Tests\block_content\Functional\BlockContentTestBase::createBlockContent()
- 10 core/modules/block_content/tests/src/Functional/Views/BlockContentTestBase.php \Drupal\Tests\block_content\Functional\Views\BlockContentTestBase::createBlockContent()
Same name and namespace in other branches
- 8 core/modules/block_content/tests/src/Functional/Views/BlockContentTestBase.php \Drupal\Tests\block_content\Functional\Views\BlockContentTestBase::createBlockContent()
- 9 core/modules/block_content/tests/src/Functional/Views/BlockContentTestBase.php \Drupal\Tests\block_content\Functional\Views\BlockContentTestBase::createBlockContent()
Creates a custom block.
Parameters
array $values: (optional) The values for the block_content entity.
Return value
\Drupal\block_content\Entity\BlockContent Created custom block.
3 calls to BlockContentTestBase::createBlockContent()
- BlockContentFieldFilterTest::setUp in core/
modules/ block_content/ tests/ src/ Functional/ Views/ BlockContentFieldFilterTest.php - BlockContentIntegrationTest::testBlockContentViewTypeArgument in core/
modules/ block_content/ tests/ src/ Functional/ Views/ BlockContentIntegrationTest.php - Tests basic block_content view with a block_content_type argument.
- FieldTypeTest::testFieldType in core/
modules/ block_content/ tests/ src/ Functional/ Views/ FieldTypeTest.php
File
- core/
modules/ block_content/ tests/ src/ Functional/ Views/ BlockContentTestBase.php, line 59
Class
- BlockContentTestBase
- Base class for all block_content tests.
Namespace
Drupal\Tests\block_content\Functional\ViewsCode
protected function createBlockContent(array $values = []) {
$status = 0;
$values += [
'info' => $this
->randomMachineName(),
'type' => 'basic',
'langcode' => 'en',
];
if ($block_content = BlockContent::create($values)) {
$status = $block_content
->save();
}
$this
->assertEquals(SAVED_NEW, $status, new FormattableMarkup('Created block content %info.', [
'%info' => $block_content
->label(),
]));
return $block_content;
}