You are here

protected function LingotekTestBase::saveAndKeepPublishedNodeForm in Lingotek Translation 3.8.x

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveAndKeepPublishedNodeForm()
  2. 4.0.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveAndKeepPublishedNodeForm()
  3. 3.0.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveAndKeepPublishedNodeForm()
  4. 3.1.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveAndKeepPublishedNodeForm()
  5. 3.2.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveAndKeepPublishedNodeForm()
  6. 3.3.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveAndKeepPublishedNodeForm()
  7. 3.4.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveAndKeepPublishedNodeForm()
  8. 3.5.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveAndKeepPublishedNodeForm()
  9. 3.6.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveAndKeepPublishedNodeForm()
  10. 3.7.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveAndKeepPublishedNodeForm()
43 calls to LingotekTestBase::saveAndKeepPublishedNodeForm()
LingotekIntelligenceMetadataTranslationTest::testUpdateNodeWithContactEmailAsAuthorSetting in tests/src/Functional/LingotekIntelligenceMetadataTranslationTest.php
LingotekIntelligenceMetadataTranslationTest::testUpdateNodeWithDefaultSettings in tests/src/Functional/LingotekIntelligenceMetadataTranslationTest.php
LingotekIntelligenceMetadataTranslationTest::testUpdateNodeWithGeneralSettings in tests/src/Functional/LingotekIntelligenceMetadataTranslationTest.php
Tests that a node can be translated.
LingotekIntelligenceMetadataTranslationTest::testUpdateNodeWithNoSettings in tests/src/Functional/LingotekIntelligenceMetadataTranslationTest.php
LingotekIntelligenceMetadataTranslationTest::testUpdateNodeWithProfileOverride in tests/src/Functional/LingotekIntelligenceMetadataTranslationTest.php

... See full list

File

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

Class

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

Namespace

Drupal\Tests\lingotek\Functional

Code

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