You are here

public function FileApiTest::testLastModified in TMGMT Translator Smartling 8.3

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

@covers \Smartling\File\FileApi::lastModified

File

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

Class

FileApiTest
Test class for Smartling\File\FileApi.

Namespace

Smartling\Tests\Unit

Code

public function testLastModified() {
  $this
    ->prepareClientResponseMock(false);
  $endpointUrl = vsprintf('%s/%s/file/last-modified', [
    FileApi::ENDPOINT_URL,
    $this->projectId,
  ]);
  $this->client
    ->expects($this
    ->once())
    ->method('request')
    ->with('get', $endpointUrl, [
    'headers' => [
      'Accept' => 'application/json',
      'Authorization' => vsprintf('%s %s', [
        $this->authProvider
          ->getTokenType(),
        $this->authProvider
          ->getAccessToken(),
      ]),
    ],
    'exceptions' => false,
    'query' => [
      'fileUri' => 'test.xml',
    ],
  ])
    ->willReturn($this->responseMock);
  $response = '{"response":{"code":"SUCCESS","messages":[], "data":{"totalCount":1629,"items": [{"localId": "locale-test","lastModified": "1970-01-01T00:00:00Z"}]}}}';
  $this->responseMock
    ->expects(self::any())
    ->method('getBody')
    ->willReturn($response);
  $this->object
    ->lastModified('test.xml');
}