You are here

protected function LingotekTestBase::saveAndPublishNodeForm 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::saveAndPublishNodeForm()
  2. 4.0.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveAndPublishNodeForm()
  3. 3.0.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveAndPublishNodeForm()
  4. 3.1.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveAndPublishNodeForm()
  5. 3.2.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveAndPublishNodeForm()
  6. 3.3.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveAndPublishNodeForm()
  7. 3.4.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveAndPublishNodeForm()
  8. 3.5.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveAndPublishNodeForm()
  9. 3.7.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveAndPublishNodeForm()
  10. 3.8.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveAndPublishNodeForm()

Create and publish a node.

Parameters

array $edit: Field data in an associative array.

string $bundle: The bundle of the node to be created.

244 calls to LingotekTestBase::saveAndPublishNodeForm()
ChineseBulkTranslationTest::testNodeTranslationUsingLinks in tests/src/Functional/ChineseBulkTranslationTest.php
Tests that a node can be translated using the links on the management page.
LingotekBulkDeleteTest::testNodeBulkDelete in tests/src/Functional/LingotekBulkDeleteTest.php
Tests that a node can be deleted in the management page.
LingotekContentEntityGetProfileHookTest::testGetProfileWithoutParentProfile in tests/src/Functional/LingotekContentEntityGetProfileHookTest.php
Tests that a profile can be overridden before uploading.
LingotekContentEntityGetProfileHookTest::testProfileOverrideOnUploadTranslation in tests/src/Functional/LingotekContentEntityGetProfileHookTest.php
Tests that a profile can be overridden before uploading.
LingotekContentEntityGetProfileHookTest::testProfileWithNullProfile in tests/src/Functional/LingotekContentEntityGetProfileHookTest.php
Tests that a profile can be overridden before uploading.

... See full list

File

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

Class

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

Namespace

Drupal\Tests\lingotek\Functional

Code

protected function saveAndPublishNodeForm(array $edit, $bundle = 'article', $usePath = TRUE) {
  $path = NULL;
  if ($usePath) {
    $path = $bundle !== NULL ? "node/add/{$bundle}" : NULL;
  }
  $entity_definition = \Drupal::entityTypeManager()
    ->getDefinition('node');
  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'));
  }
}