public function FileApiTest::testAcceptResponse in TMGMT Translator Smartling 8.2
Same name in this branch
- 8.2 api-sdk-php/tests/unit/FileApiTest.php \Smartling\Tests\Unit\FileApiTest::testAcceptResponse()
- 8.2 vendor/smartling/api-sdk-php/tests/unit/FileApiTest.php \Smartling\Tests\Unit\FileApiTest::testAcceptResponse()
Same name and namespace in other branches
- 8.4 vendor/smartling/api-sdk-php/tests/unit/FileApiTest.php \Smartling\Tests\Unit\FileApiTest::testAcceptResponse()
- 8.3 vendor/smartling/api-sdk-php/tests/unit/FileApiTest.php \Smartling\Tests\Unit\FileApiTest::testAcceptResponse()
Test async response with ACCEPTED code.
It should not throw "Bad response format" exception.
File
- vendor/
smartling/ api-sdk-php/ tests/ unit/ FileApiTest.php, line 875
Class
- FileApiTest
- Test class for Smartling\File\FileApi.
Namespace
Smartling\Tests\UnitCode
public function testAcceptResponse() {
$responseMock = $this
->getMockBuilder('Guzzle\\Message\\ResponseInterface')
->setMethods(array_merge(self::$responseInterfaceMethods, self::$messageInterfaceMethods))
->disableOriginalConstructor()
->getMock();
$responseMock
->expects(self::any())
->method('getStatusCode')
->willReturn(202);
$responseMock
->expects(self::any())
->method('getBody')
->willReturn($this->responseAsync);
$responseMock
->expects(self::any())
->method('json')
->willReturn(json_decode($this->responseAsync, true));
$this->client
->expects(self::once())
->method('request')
->willReturn($responseMock);
// Just random api call to mock async response of 'send' method.
$this->object
->renameFile('test.xml', 'new_test.xml');
}