You are here

public function ContextApiTest::testRenderContext in TMGMT Translator Smartling 8.2

Same name in this branch
  1. 8.2 api-sdk-php/tests/unit/ContextApiTest.php \Smartling\Tests\ContextApiTest::testRenderContext()
  2. 8.2 vendor/smartling/api-sdk-php/tests/unit/ContextApiTest.php \Smartling\Tests\ContextApiTest::testRenderContext()
Same name and namespace in other branches
  1. 8.4 vendor/smartling/api-sdk-php/tests/unit/ContextApiTest.php \Smartling\Tests\ContextApiTest::testRenderContext()
  2. 8.3 vendor/smartling/api-sdk-php/tests/unit/ContextApiTest.php \Smartling\Tests\ContextApiTest::testRenderContext()

@covers \Smartling\Context\ContextApi::renderContext

File

vendor/smartling/api-sdk-php/tests/unit/ContextApiTest.php, line 268

Class

ContextApiTest
Test class for Smartling\Context\ContextApi.

Namespace

Smartling\Tests

Code

public function testRenderContext() {
  $contextUid = 'someContextUid';
  $endpointUrl = vsprintf('%s/%s/contexts/%s/render', [
    ContextApi::ENDPOINT_URL,
    $this->projectId,
    $contextUid,
  ]);
  $this->client
    ->expects(self::once())
    ->method('request')
    ->with('post', $endpointUrl, [
    'headers' => [
      'Accept' => 'application/json',
      'Authorization' => vsprintf('%s %s', [
        $this->authProvider
          ->getTokenType(),
        $this->authProvider
          ->getAccessToken(),
      ]),
      'X-SL-Context-Source' => $this
        ->invokeMethod($this->object, 'getXSLContextSourceHeader'),
    ],
    'exceptions' => FALSE,
    'form_params' => [],
  ])
    ->willReturn($this->responseMock);
  $this->object
    ->renderContext($contextUid);
}