You are here

public function ProgressTrackerApiTest::testUpdateRecord in TMGMT Translator Smartling 8.3

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

@covers \Smartling\ProgressTracker\ProgressTrackerApi::updateRecord

File

vendor/smartling/api-sdk-php/tests/unit/ProgressTrackerApiTest.php, line 131

Class

ProgressTrackerApiTest
Test class for Smartling\ProgressTracker\ProgressTrackerApi.

Namespace

Smartling\Tests\Unit

Code

public function testUpdateRecord() {
  $spaceId = "space";
  $objectId = "object";
  $recordId = "record";
  $ttl = 5;
  $data = [
    "foo" => "bar",
  ];
  $endpointUrl = vsprintf('%s/projects/%s/spaces/%s/objects/%s/records/%s', [
    ProgressTrackerApi::ENDPOINT_URL,
    $this->projectId,
    $spaceId,
    $objectId,
    $recordId,
  ]);
  $params = new RecordParameters();
  $params
    ->setTtl($ttl);
  $params
    ->setData($data);
  $this->client
    ->expects($this
    ->any())
    ->method('request')
    ->with('put', $endpointUrl, [
    'headers' => [
      'Accept' => 'application/json',
      'Authorization' => vsprintf('%s %s', [
        $this->authProvider
          ->getTokenType(),
        $this->authProvider
          ->getAccessToken(),
      ]),
    ],
    'exceptions' => false,
    'json' => [
      "ttl" => $ttl,
      "data" => $data,
    ],
  ])
    ->willReturn($this->responseMock);
  $this->object
    ->updateRecord($spaceId, $objectId, $recordId, $params);
}