You are here

protected function LingotekTestBase::configureContentModeration in Lingotek Translation 8.2

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

Configure content moderation.

Parameters

string $workflow_id: The workflow id to be configured.

array $entities_map: The entities and bundles map that wants to be enabled for a given workflow. Array in the form: [entity_type => [bundle1, bundle2]].

2 calls to LingotekTestBase::configureContentModeration()
LingotekNodeContentModerationTranslationTest::setUp in tests/src/Functional/LingotekNodeContentModerationTranslationTest.php
LingotekNodeParagraphsTranslationTest::setUp in tests/src/Functional/LingotekNodeParagraphsTranslationTest.php

File

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

Class

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

Namespace

Drupal\Tests\lingotek\Functional

Code

protected function configureContentModeration($workflow_id, array $entities_map) {
  if (floatval(\Drupal::VERSION) >= 8.4) {
    foreach ($entities_map as $entity_type_id => $bundles) {
      $edit = [];
      foreach ($bundles as $bundle) {
        $edit["bundles[{$bundle}]"] = $bundle;
      }
      $this
        ->drupalPostForm("/admin/config/workflow/workflows/manage/{$workflow_id}/type/{$entity_type_id}", $edit, 'Save');
    }
  }
  else {
    if (isset($entities_map['node'])) {
      foreach ($entities_map['node'] as $bundle) {
        $this
          ->drupalPostForm("/admin/structure/types/manage/{$bundle}/moderation", [
          'workflow' => $workflow_id,
        ], t('Save'));
      }
    }
  }
}