public function JobsTest::tearDown in TMGMT Translator Smartling 8.4
Same name and namespace in other branches
- 8.3 tests/src/Functional/JobsTest.php \Drupal\Tests\tmgmt_smartling\Functional\JobsTest::tearDown()
Overrides BrowserTestBase::tearDown
File
- tests/
src/ Functional/ JobsTest.php, line 50
Class
- JobsTest
- Jobs tests.
Namespace
Drupal\Tests\tmgmt_smartling\FunctionalCode
public function tearDown() {
$api_wrapper = Drupal::service('tmgmt_smartling.smartling_api_wrapper');
$api_wrapper
->setSettings([
'user_id' => $this->smartlingPluginProviderSettings['settings[user_id]'],
'project_id' => $this->smartlingPluginProviderSettings['settings[project_id]'],
'token_secret' => $this->smartlingPluginProviderSettings['settings[token_secret]'],
]);
$jobs = $api_wrapper
->listJobs(NULL, [
JobStatus::AWAITING_AUTHORIZATION,
JobStatus::IN_PROGRESS,
]);
if (!empty($jobs['items'])) {
foreach ($jobs['items'] as $job) {
if (strpos($job['jobName'], 'Drupal TMGMT connector test') !== FALSE) {
$api_wrapper
->cancelJob($job['translationJobUid']);
}
}
}
parent::tearDown();
}