public function FileApiTest::testLastModifiedTimeZone in TMGMT Translator Smartling 8.3
Same name and namespace in other branches
- 8.4 vendor/smartling/api-sdk-php/tests/unit/FileApiTest.php \Smartling\Tests\Unit\FileApiTest::testLastModifiedTimeZone()
@covers \Smartling\File\FileApi::lastModified
File
- vendor/
smartling/ api-sdk-php/ tests/ unit/ FileApiTest.php, line 382
Class
- FileApiTest
- Test class for Smartling\File\FileApi.
Namespace
Smartling\Tests\UnitCode
public function testLastModifiedTimeZone() {
$this
->prepareClientResponseMock(false);
$this->client
->expects($this
->exactly(2))
->method('request')
->willReturn($this->responseMock);
$response = '{"response":{"code":"SUCCESS","messages":[], "data":{"totalCount":1629,"items": [{"localId": "locale-test","lastModified": "2018-01-01T00:00:00Z"}]}}}';
$this->responseMock
->expects(self::any())
->method('getBody')
->willReturn($response);
date_default_timezone_set('UTC');
$result_default_utc = $this->object
->lastModified('test.xml');
date_default_timezone_set('Pacific/Auckland');
$result_default_auckland = $this->object
->lastModified('test.xml');
$this
->assertEquals($result_default_utc['items'][0]['lastModified']
->getTimestamp(), $result_default_auckland['items'][0]['lastModified']
->getTimestamp());
$this
->assertEquals($result_default_utc['items'][0]['lastModified']
->getTimeZone()
->getName(), 'UTC');
$this
->assertEquals($result_default_auckland['items'][0]['lastModified']
->getTimeZone()
->getName(), 'UTC');
}