You are here

public function SmartlingTestBase::setUp in TMGMT Translator Smartling 8.4

Same name in this branch
  1. 8.4 tests/src/Functional/SmartlingTestBase.php \Drupal\Tests\tmgmt_smartling\Functional\SmartlingTestBase::setUp()
  2. 8.4 tests/src/Kernel/SmartlingTestBase.php \Drupal\Tests\tmgmt_smartling\Kernel\SmartlingTestBase::setUp()
Same name and namespace in other branches
  1. 8.3 tests/src/Functional/SmartlingTestBase.php \Drupal\Tests\tmgmt_smartling\Functional\SmartlingTestBase::setUp()

Overrides DrupalWebTestCase::setUp()

Overrides TMGMTTestBase::setUp

2 calls to SmartlingTestBase::setUp()
JobsTest::setUp in tests/src/Functional/JobsTest.php
Overrides DrupalWebTestCase::setUp()
LoggingTest::setUp in tests/src/Functional/LoggingTest.php
Overrides DrupalWebTestCase::setUp()
2 methods override SmartlingTestBase::setUp()
JobsTest::setUp in tests/src/Functional/JobsTest.php
Overrides DrupalWebTestCase::setUp()
LoggingTest::setUp in tests/src/Functional/LoggingTest.php
Overrides DrupalWebTestCase::setUp()

File

tests/src/Functional/SmartlingTestBase.php, line 83

Class

SmartlingTestBase
Basic tests for the Smartling translator.

Namespace

Drupal\Tests\tmgmt_smartling\Functional

Code

public function setUp() {
  parent::setUp();
  $settings_file_path = __DIR__ . '/../../../' . self::SETTINGS_FILE_NAME;

  // Include settings from external file.
  if (file_exists($settings_file_path) && empty($this->smartlingPluginProviderSettings)) {
    require_once $settings_file_path;

    // Fetch needed data.
    unset($settings['settings[export_format]']);
    $this->smartlingPluginProviderSettings = $settings;
    $test_node = Node::load($this->testNodeId);
    $this->testNodeTitle = $test_node
      ->get('title')->value;
    $this->testNodeBody = trim(strip_tags($test_node
      ->get('body')->value));
  }

  // Additional permission: access to "Recent log messages" page and
  // access for manual context sending.
  $this
    ->loginAsAdmin([
    'administer site configuration',
    'access administration pages',
    'access site reports',
    'send context smartling',
    'translate any entity',
    'bypass node access',
    'use text format basic_html',
  ]);
}