protected function LingotekTestBase::saveAndArchiveNodeForm in Lingotek Translation 3.7.x
Same name and namespace in other branches
- 4.0.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveAndArchiveNodeForm()
- 3.4.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveAndArchiveNodeForm()
- 3.5.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveAndArchiveNodeForm()
- 3.6.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveAndArchiveNodeForm()
- 3.8.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveAndArchiveNodeForm()
1 call to LingotekTestBase::saveAndArchiveNodeForm()
- LingotekNodeBulkFormWithContentModerationTest::testContentStateFilter in tests/
src/ Functional/ Form/ LingotekNodeBulkFormWithContentModerationTest.php - Tests if content state filter works correctly
File
- tests/
src/ Functional/ LingotekTestBase.php, line 319
Class
- LingotekTestBase
- Base class for Lingotek test. Performs authorization of the account.
Namespace
Drupal\Tests\lingotek\FunctionalCode
protected function saveAndArchiveNodeForm(array $edit, $nid, $usePath = TRUE) {
$path = NULL;
if ($usePath) {
$path = $nid !== NULL ? "node/{$nid}/edit" : NULL;
}
$entity_definition = \Drupal::entityTypeManager()
->getDefinition('node');
$node = Node::load($nid);
$bundle = $node
->bundle();
if (\Drupal::moduleHandler()
->moduleExists('content_moderation') && \Drupal::service('content_moderation.moderation_information')
->shouldModerateEntitiesOfBundle($entity_definition, $bundle)) {
$edit['moderation_state[0][state]'] = 'archived';
$this
->drupalPostForm($path, $edit, t('Save'));
}
else {
$edit['status[value]'] = FALSE;
$this
->drupalPostForm($path, $edit, t('Save'));
}
}