Skip to content

Commit

Permalink
Updated unit test with actual response data from successful API call.
Browse files Browse the repository at this point in the history
  • Loading branch information
DE-dylan-lauzon committed Nov 13, 2024
1 parent c45448e commit e2889ca
Showing 1 changed file with 32 additions and 3 deletions.
35 changes: 32 additions & 3 deletions tests/CrowdinApiClient/Api/SourceStringApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,37 @@ public function testDelete()
public function testBatch()
{
$this->mockRequest([

'path' => '/projects/2/strings',
'method' => 'patch',
'response' => '{
"data":[
{"data":
{
"id":2814,
"projectId": 2,
"branchId":null,
"identifier":"a.b.c",
"text":"new added string",
"type":"text",
"context":"a.b.c\ncontext for new string",
"maxLength":0,
"isHidden":false,
"isDuplicate":false,
"masterStringId":null,
"hasPlurals":false,
"isIcu":false,
"labelIds":[],
"webUrl":"https://example.crowdin.com/editor/1/all/en-pl?filter=basic&value=0&view=comfortable#2",
"createdAt":"2024-11-13T16:56:18+00:00",
"updatedAt":null,
"fileId":48,
"directoryId":null,
"revision":1
}
}
]
}
'
]);

$batchResult = $this->crowdin->sourceString->batch(2, [
Expand All @@ -182,16 +210,17 @@ public function testBatch()
'text' => 'new added string',
'identifier' => 'a.b.c',
'context' => 'context for new string',
'fileId' => 5,
'fileId' => 8,
'isHidden' => false
]
],
[
'op' => 'remove',
'path' => '/2815'
'path' => '/2814'
]
]);

fwrite(STDERR, print_r($batchResult->getData(), TRUE));
$this->assertInstanceOf(SourceString::class, $batchResult);
}
}

0 comments on commit e2889ca

Please sign in to comment.