public function ProgressTrackerApiTest::testCreateRecord in TMGMT Translator Smartling 8.3
Same name and namespace in other branches
- 8.4 vendor/smartling/api-sdk-php/tests/unit/ProgressTrackerApiTest.php \Smartling\Tests\Unit\ProgressTrackerApiTest::testCreateRecord()
@covers \Smartling\ProgressTracker\ProgressTrackerApi::createRecord
File
- vendor/
smartling/ api-sdk-php/ tests/ unit/ ProgressTrackerApiTest.php, line 48
Class
- ProgressTrackerApiTest
- Test class for Smartling\ProgressTracker\ProgressTrackerApi.
Namespace
Smartling\Tests\UnitCode
public function testCreateRecord() {
$spaceId = "space";
$objectId = "object";
$ttl = 5;
$data = [
"foo" => "bar",
];
$endpointUrl = vsprintf('%s/projects/%s/spaces/%s/objects/%s/records', [
ProgressTrackerApi::ENDPOINT_URL,
$this->projectId,
$spaceId,
$objectId,
]);
$params = new RecordParameters();
$params
->setTtl($ttl);
$params
->setData($data);
$this->client
->expects($this
->any())
->method('request')
->with('post', $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
->createRecord($spaceId, $objectId, $params);
}