You are here

protected function SmartlingTestBase::deleteTestFile in TMGMT Translator Smartling 8.3

Same name and namespace in other branches
  1. 8.4 tests/src/Functional/SmartlingTestBase.php \Drupal\Tests\tmgmt_smartling\Functional\SmartlingTestBase::deleteTestFile()

Removes test file from Smartling dashboard.

Parameters

$fileName:

File

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

Class

SmartlingTestBase
Basic tests for the Smartling translator.

Namespace

Drupal\Tests\tmgmt_smartling\Functional

Code

protected function deleteTestFile($fileName) {
  try {
    $api_factory = Drupal::service('tmgmt_smartling.smartling_api_factory');
    $smartlingApi = $api_factory::create([
      'user_id' => $this->smartlingPluginProviderSettings['settings[user_id]'],
      'project_id' => $this->smartlingPluginProviderSettings['settings[project_id]'],
      'token_secret' => $this->smartlingPluginProviderSettings['settings[token_secret]'],
    ], 'file');
    $smartlingApi
      ->deleteFile($fileName);
  } catch (SmartlingApiException $e) {

    // File not found.
  }
}