function ModerationStateTestBase::createContentTypeFromUi
Same name in other branches
- 8.9.x core/modules/content_moderation/tests/src/Functional/ModerationStateTestBase.php \Drupal\Tests\content_moderation\Functional\ModerationStateTestBase::createContentTypeFromUi()
- 10 core/modules/content_moderation/tests/src/Functional/ModerationStateTestBase.php \Drupal\Tests\content_moderation\Functional\ModerationStateTestBase::createContentTypeFromUi()
- 11.x core/modules/content_moderation/tests/src/Functional/ModerationStateTestBase.php \Drupal\Tests\content_moderation\Functional\ModerationStateTestBase::createContentTypeFromUi()
Creates a content-type from the UI.
Parameters
string $content_type_name: Content type human name.
string $content_type_id: Machine name.
bool $moderated: TRUE if should be moderated.
string $workflow_id: The workflow to attach to the bundle.
9 calls to ModerationStateTestBase::createContentTypeFromUi()
- DefaultModerationStateTest::setUp in core/
modules/ content_moderation/ tests/ src/ Functional/ DefaultModerationStateTest.php - Sets the test up.
- ModerationFormTest::setUp in core/
modules/ content_moderation/ tests/ src/ Functional/ ModerationFormTest.php - Sets the test up.
- ModerationLocaleTest::setUp in core/
modules/ content_moderation/ tests/ src/ Functional/ ModerationLocaleTest.php - Sets the test up.
- ModerationStateNodeTest::setUp in core/
modules/ content_moderation/ tests/ src/ Functional/ ModerationStateNodeTest.php - Sets the test up.
- ModerationStateNodeTypeTest::testEnablingOnExistingContent in core/
modules/ content_moderation/ tests/ src/ Functional/ ModerationStateNodeTypeTest.php - Tests enabling moderation on an existing node-type, with content.
File
-
core/
modules/ content_moderation/ tests/ src/ Functional/ ModerationStateTestBase.php, line 111
Class
- ModerationStateTestBase
- Defines a base class for moderation state tests.
Namespace
Drupal\Tests\content_moderation\FunctionalCode
protected function createContentTypeFromUi($content_type_name, $content_type_id, $moderated = FALSE, $workflow_id = 'editorial') {
$this->drupalGet('admin/structure/types');
$this->clickLink('Add content type');
$edit = [
'name' => $content_type_name,
'type' => $content_type_id,
];
$this->submitForm($edit, 'Save content type');
// Check the content type has been set to create new revisions.
$this->assertTrue(NodeType::load($content_type_id)->shouldCreateNewRevision());
if ($moderated) {
$this->enableModerationThroughUi($content_type_id, $workflow_id);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.