You are here

public function SmartlingTest::setUp in TMGMT Translator Smartling 8

Overrides DrupalWebTestCase::setUp()

Overrides TMGMTTestBase::setUp

File

src/Tests/SmartlingTest.php, line 81
Contains \Drupal\tmgmt_smartling\Tests\SmartlingTest.

Class

SmartlingTest
Basic tests for the Smartling translator.

Namespace

Drupal\tmgmt_smartling\Tests

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.
    $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([
    'access site reports',
    'send context smartling',
  ]);
}