function BlockContentTestBase::createBlockContent
Same name in this branch
- 11.x core/modules/block_content/tests/src/Functional/BlockContentTestBase.php \Drupal\Tests\block_content\Functional\BlockContentTestBase::createBlockContent()
Same name in other branches
- 9 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/BlockContentTestBase.php \Drupal\Tests\block_content\Functional\BlockContentTestBase::createBlockContent()
- 8.9.x core/modules/block_content/src/Tests/Views/BlockContentTestBase.php \Drupal\block_content\Tests\Views\BlockContentTestBase::createBlockContent()
- 8.9.x core/modules/block_content/src/Tests/BlockContentTestBase.php \Drupal\block_content\Tests\BlockContentTestBase::createBlockContent()
- 8.9.x core/modules/block_content/tests/src/Functional/Views/BlockContentTestBase.php \Drupal\Tests\block_content\Functional\Views\BlockContentTestBase::createBlockContent()
- 8.9.x 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()
- 10 core/modules/block_content/tests/src/Functional/BlockContentTestBase.php \Drupal\Tests\block_content\Functional\BlockContentTestBase::createBlockContent()
Creates a content block.
Parameters
array $values: (optional) The values for the block_content entity.
Return value
\Drupal\block_content\Entity\BlockContent Created content block.
2 calls to BlockContentTestBase::createBlockContent()
- BlockContentFieldFilterTest::setUp in core/
modules/ block_content/ tests/ src/ Functional/ Views/ BlockContentFieldFilterTest.php - Sets up the test.
- BlockContentIntegrationTest::testBlockContentViewTypeArgument in core/
modules/ block_content/ tests/ src/ Functional/ Views/ BlockContentIntegrationTest.php - Tests basic block_content view with a block_content_type argument.
File
-
core/
modules/ block_content/ tests/ src/ Functional/ Views/ BlockContentTestBase.php, line 63
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, "Created block content {$block_content->label()}.");
return $block_content;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.