You are here

public function ContextApiFunctionalTest::testMatchContext in TMGMT Translator Smartling 8.4

Same name and namespace in other branches
  1. 8.2 api-sdk-php/tests/functional/ContextApiFunctionalTest.php \Smartling\Tests\Functional\ContextApiFunctionalTest::testMatchContext()
  2. 8.2 vendor/smartling/api-sdk-php/tests/functional/ContextApiFunctionalTest.php \Smartling\Tests\Functional\ContextApiFunctionalTest::testMatchContext()
  3. 8.3 vendor/smartling/api-sdk-php/tests/functional/ContextApiFunctionalTest.php \Smartling\Tests\Functional\ContextApiFunctionalTest::testMatchContext()

Test for match context.

File

vendor/smartling/api-sdk-php/tests/functional/ContextApiFunctionalTest.php, line 66

Class

ContextApiFunctionalTest
Test class for Project API examples.

Namespace

Smartling\Tests\Functional

Code

public function testMatchContext() {
  try {
    $fileUri = 'tests/resources/context.html';
    $params = new UploadContextParameters();
    $params
      ->setContent($fileUri);
    $params
      ->setName('test_context.html');
    $contextInfo = $this->contextApi
      ->uploadContext($params);
    $params = new MatchContextParameters();
    $params
      ->setContentFileUri($fileUri);
    $result = $this->contextApi
      ->matchContext($contextInfo['contextUid'], $params);
    $this
      ->assertArrayHasKey('matchId', $result);
  } catch (SmartlingApiException $e) {
    $this
      ->fail($e
      ->getMessage());
  }
}