You are here

public function BatchApiTest::testExecuteBatch in TMGMT Translator Smartling 8.4

Same name and namespace in other branches
  1. 8.3 vendor/smartling/api-sdk-php/tests/unit/BatchApiTest.php \Smartling\Tests\Unit\BatchApiTest::testExecuteBatch()

@covers \Smartling\Batch\BatchApi::executeBatch

File

vendor/smartling/api-sdk-php/tests/unit/BatchApiTest.php, line 162

Class

BatchApiTest
Test class for Smartling\Batch\BatchApi.

Namespace

Smartling\Tests\Unit

Code

public function testExecuteBatch() {
  $batchId = 'test_batch_id';
  $endpointUrl = vsprintf('%s/%s/batches/%s', [
    BatchApi::ENDPOINT_URL,
    $this->projectId,
    $batchId,
  ]);
  $this->client
    ->expects(self::once())
    ->method('request')
    ->with('post', $endpointUrl, [
    'headers' => [
      'Accept' => 'application/json',
      'Authorization' => vsprintf('%s %s', [
        $this->authProvider
          ->getTokenType(),
        $this->authProvider
          ->getAccessToken(),
      ]),
    ],
    'exceptions' => FALSE,
    'json' => [
      'action' => BatchApi::ACTION_EXECUTE,
    ],
  ])
    ->willReturn($this->responseMock);
  $this->object
    ->executeBatch($batchId);
}