You are here

public function BaseApiAbstractTest::testClientIdAndClientVersionAndUserAgentExtensionsSpecified in TMGMT Translator Smartling 8.4

Same name and namespace in other branches
  1. 8.3 vendor/smartling/api-sdk-php/tests/unit/BaseApiAbstractTest.php \Smartling\Tests\Unit\BaseApiAbstractTest::testClientIdAndClientVersionAndUserAgentExtensionsSpecified()

Test custom client id, version and extension in user agent.

File

vendor/smartling/api-sdk-php/tests/unit/BaseApiAbstractTest.php, line 58

Class

BaseApiAbstractTest

Namespace

Smartling\Tests\Unit

Code

public function testClientIdAndClientVersionAndUserAgentExtensionsSpecified() {
  BaseApiAbstract::setCurrentClientId('php-connector');
  BaseApiAbstract::setCurrentClientVersion('1.2.3');
  BaseApiAbstract::setCurrentClientUserAgentExtension('dependency-1/version-1 dependency-2/version-2');
  $instance = FileApi::create($this->authProvider, 'test');
  $http_client = $this
    ->invokeMethod($instance, 'getHttpClient');
  $this
    ->assertTrue(strpos($http_client
    ->getConfig()['headers']['User-Agent'], 'php-connector/1.2.3 dependency-1/version-1 dependency-2/version-2 GuzzleHttp/6') !== FALSE);
}