You are here

public function FileApiTest::testSendRequest in TMGMT Translator Smartling 8.2

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

@covers \Smartling\File\FileApi::sendRequest @dataProvider sendRequestValidProvider

Parameters

string $uri:

array $requestData:

string $method:

array $params:

$paramsType:

File

vendor/smartling/api-sdk-php/tests/unit/FileApiTest.php, line 595

Class

FileApiTest
Test class for Smartling\File\FileApi.

Namespace

Smartling\Tests\Unit

Code

public function testSendRequest($uri, $requestData, $method, $params, $paramsType) {
  $defaultRequestData = $this
    ->invokeMethod($this->object, 'getDefaultRequestData', [
    $paramsType,
    $requestData,
  ]);
  $params['headers']['Authorization'] = vsprintf('%s %s', [
    $this->authProvider
      ->getTokenType(),
    $this->authProvider
      ->getAccessToken(),
  ]);
  $this->client
    ->expects($this
    ->once())
    ->method('request')
    ->with($method, FileApi::ENDPOINT_URL . '/' . $this->projectId . '/' . $uri, $params)
    ->willReturn($this->responseMock);
  $this
    ->invokeMethod($this->object, 'setBaseUrl', [
    FileApi::ENDPOINT_URL . '/' . $this->projectId,
  ]);
  $result = $this
    ->invokeMethod($this->object, 'sendRequest', [
    $uri,
    $defaultRequestData,
    $method,
  ]);
  self::assertEquals([
    'wordCount' => 1629,
    'stringCount' => 503,
    'overWritten' => false,
  ], $result);
}