You are here

protected function LingotekTestBase::saveAndUnpublishNodeForm in Lingotek Translation 3.6.x

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveAndUnpublishNodeForm()
  2. 4.0.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveAndUnpublishNodeForm()
  3. 3.0.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveAndUnpublishNodeForm()
  4. 3.1.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveAndUnpublishNodeForm()
  5. 3.2.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveAndUnpublishNodeForm()
  6. 3.3.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveAndUnpublishNodeForm()
  7. 3.4.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveAndUnpublishNodeForm()
  8. 3.5.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveAndUnpublishNodeForm()
  9. 3.7.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveAndUnpublishNodeForm()
  10. 3.8.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveAndUnpublishNodeForm()
2 calls to LingotekTestBase::saveAndUnpublishNodeForm()
LingotekNodeNestedParagraphsTranslationTest::testParagraphRevisionsAreKeptWhenTranslating in tests/src/Functional/LingotekNodeNestedParagraphsTranslationTest.php
LingotekNodeParagraphsTranslationTest::testParagraphRevisionsAreKeptWhenTranslating in tests/src/Functional/LingotekNodeParagraphsTranslationTest.php

File

tests/src/Functional/LingotekTestBase.php, line 299

Class

LingotekTestBase
Base class for Lingotek test. Performs authorization of the account.

Namespace

Drupal\Tests\lingotek\Functional

Code

protected function saveAndUnpublishNodeForm(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]'] = 'draft';
    $this
      ->drupalPostForm($path, $edit, t('Save'));
  }
  else {
    $edit['status[value]'] = FALSE;
    $this
      ->drupalPostForm($path, $edit, t('Save'));
  }
}