function BlockContentTestBase::createBlockContentType
Same name in this branch
- 8.9.x core/modules/block_content/src/Tests/Views/BlockContentTestBase.php \Drupal\block_content\Tests\Views\BlockContentTestBase::createBlockContentType()
- 8.9.x core/modules/block_content/src/Tests/BlockContentTestBase.php \Drupal\block_content\Tests\BlockContentTestBase::createBlockContentType()
- 8.9.x core/modules/block_content/tests/src/Functional/BlockContentTestBase.php \Drupal\Tests\block_content\Functional\BlockContentTestBase::createBlockContentType()
Same name in other branches
- 9 core/modules/block_content/tests/src/Functional/Views/BlockContentTestBase.php \Drupal\Tests\block_content\Functional\Views\BlockContentTestBase::createBlockContentType()
- 9 core/modules/block_content/tests/src/Functional/BlockContentTestBase.php \Drupal\Tests\block_content\Functional\BlockContentTestBase::createBlockContentType()
- 10 core/modules/block_content/tests/src/Functional/Views/BlockContentTestBase.php \Drupal\Tests\block_content\Functional\Views\BlockContentTestBase::createBlockContentType()
- 10 core/modules/block_content/tests/src/Functional/BlockContentTestBase.php \Drupal\Tests\block_content\Functional\BlockContentTestBase::createBlockContentType()
- 11.x core/modules/block_content/tests/src/Functional/Views/BlockContentTestBase.php \Drupal\Tests\block_content\Functional\Views\BlockContentTestBase::createBlockContentType()
- 11.x core/modules/block_content/tests/src/Functional/BlockContentTestBase.php \Drupal\Tests\block_content\Functional\BlockContentTestBase::createBlockContentType()
Creates a custom block type (bundle).
Parameters
array $values: An array of settings to change from the defaults.
Return value
\Drupal\block_content\Entity\BlockContentType Created custom block type.
2 calls to BlockContentTestBase::createBlockContentType()
- BlockContentIntegrationTest::testBlockContentViewTypeArgument in core/
modules/ block_content/ tests/ src/ Functional/ Views/ BlockContentIntegrationTest.php - Tests basic block_content view with a block_content_type argument.
- BlockContentTestBase::setUp in core/
modules/ block_content/ tests/ src/ Functional/ Views/ BlockContentTestBase.php
File
-
core/
modules/ block_content/ tests/ src/ Functional/ Views/ BlockContentTestBase.php, line 87
Class
- BlockContentTestBase
- Base class for all block_content tests.
Namespace
Drupal\Tests\block_content\Functional\ViewsCode
protected function createBlockContentType(array $values = []) {
// Find a non-existent random type name.
if (!isset($values['id'])) {
do {
$id = strtolower($this->randomMachineName(8));
} while (BlockContentType::load($id));
}
else {
$id = $values['id'];
}
$values += [
'id' => $id,
'label' => $id,
'revision' => FALSE,
];
$bundle = BlockContentType::create($values);
$status = $bundle->save();
block_content_add_body_field($bundle->id());
$this->assertEqual($status, SAVED_NEW, new FormattableMarkup('Created block content type %bundle.', [
'%bundle' => $bundle->id(),
]));
return $bundle;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.