You are here

protected function ApiTestAbstract::prepareClientResponseMock in TMGMT Translator Smartling 8.4

Same name and namespace in other branches
  1. 8.2 api-sdk-php/tests/unit/ApiTestAbstract.php \Smartling\Tests\Unit\ApiTestAbstract::prepareClientResponseMock()
  2. 8.2 vendor/smartling/api-sdk-php/tests/unit/ApiTestAbstract.php \Smartling\Tests\Unit\ApiTestAbstract::prepareClientResponseMock()
  3. 8.3 vendor/smartling/api-sdk-php/tests/unit/ApiTestAbstract.php \Smartling\Tests\Unit\ApiTestAbstract::prepareClientResponseMock()
27 calls to ApiTestAbstract::prepareClientResponseMock()
ApiTestAbstract::setUp in vendor/smartling/api-sdk-php/tests/unit/ApiTestAbstract.php
Sets up the fixture, for example, opens a network connection. This method is called before a test is executed.
FileApiTest::testAcceptResponse in vendor/smartling/api-sdk-php/tests/unit/FileApiTest.php
Test async response with ACCEPTED code.
FileApiTest::testBadJsonFormatInErrorMessageSendRequest in vendor/smartling/api-sdk-php/tests/unit/FileApiTest.php
@covers \Smartling\File\FileApi::sendRequest @expectedException \Smartling\Exceptions\SmartlingApiException @expectedExceptionMessage Bad response format from Smartling
FileApiTest::testBadJsonFormatSendRequest in vendor/smartling/api-sdk-php/tests/unit/FileApiTest.php
@covers \Smartling\File\FileApi::sendRequest @expectedException \Smartling\Exceptions\SmartlingApiException @expectedExceptionMessage Bad response format from Smartling
FileApiTest::testConstructor in vendor/smartling/api-sdk-php/tests/unit/FileApiTest.php
Tests constructor.

... See full list

File

vendor/smartling/api-sdk-php/tests/unit/ApiTestAbstract.php, line 218

Class

ApiTestAbstract
Class ApiTestAbstract @package Smartling\Tests

Namespace

Smartling\Tests\Unit

Code

protected function prepareClientResponseMock($setDefaultResponse = true) {
  $this->responseMock = $this
    ->getMockBuilder('GuzzleHttp\\Psr7\\Response')
    ->setMethods(array_merge(self::$responseInterfaceMethods, self::$messageInterfaceMethods))
    ->disableOriginalConstructor()
    ->getMock();
  if (true === $setDefaultResponse) {
    $this->responseMock
      ->expects(self::any())
      ->method('json')
      ->willReturn(json_decode($this->validResponse, self::JSON_OBJECT_AS_ARRAY));
    $this->responseMock
      ->expects(self::any())
      ->method('getBody')
      ->willReturn($this->validResponse);
  }
  $this->responseMock
    ->expects($this
    ->any())
    ->method('getStatusCode')
    ->willReturn(200);
}