class AuthApiTest in TMGMT Translator Smartling 8.2
Same name in this branch
- 8.2 api-sdk-php/tests/unit/AuthApiTest.php \Smartling\Tests\AuthApiTest
- 8.2 vendor/smartling/api-sdk-php/tests/unit/AuthApiTest.php \Smartling\Tests\AuthApiTest
Same name and namespace in other branches
- 8.4 vendor/smartling/api-sdk-php/tests/unit/AuthApiTest.php \Smartling\Tests\AuthApiTest
- 8.3 vendor/smartling/api-sdk-php/tests/unit/AuthApiTest.php \Smartling\Tests\AuthApiTest
Test class for Smartling\AuthApi\AuthTokenProvider.
Hierarchy
- class \Smartling\Tests\AuthApiTest extends \Smartling\Tests\Unit\ApiTestAbstract
Expanded class hierarchy of AuthApiTest
File
- vendor/
smartling/ api-sdk-php/ tests/ unit/ AuthApiTest.php, line 11
Namespace
Smartling\TestsView source
class AuthApiTest extends ApiTestAbstract {
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp() {
parent::setUp();
$this
->prepareAuthApiMock();
}
private function prepareAuthApiMock() {
$this->object = $this
->getMockBuilder('Smartling\\AuthApi\\AuthTokenProvider')
->setMethods(NULL)
->setConstructorArgs([
$this->userIdentifier,
$this->secretKey,
$this->client,
])
->getMock();
}
/**
* Test auth method.
*/
public function testAuthenticate() {
$endpointUrl = vsprintf('%s/authenticate', [
AuthTokenProvider::ENDPOINT_URL,
]);
$this->client
->expects(self::once())
->method('request')
->with('post', $endpointUrl, [
'headers' => [
'Accept' => 'application/json',
],
'exceptions' => false,
'json' => [
'userIdentifier' => 'SomeUserIdentifier',
'userSecret' => 'SomeSecretKey',
],
])
->willReturn($this->responseMock);
$this
->invokeMethod($this->object, 'authenticate');
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AuthApiTest:: |
private | function | ||
AuthApiTest:: |
protected | function | Sets up the fixture, for example, opens a network connection. This method is called before a test is executed. | |
AuthApiTest:: |
public | function | Test auth method. |