2017-06-22 00:55:08 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* PHP version 5.4
|
|
|
|
*
|
|
|
|
* API client users test class
|
|
|
|
*
|
|
|
|
* @category RetailCrm
|
|
|
|
* @package RetailCrm
|
|
|
|
* @author RetailCrm <integration@retailcrm.ru>
|
|
|
|
* @license https://opensource.org/licenses/MIT MIT License
|
2019-08-30 14:10:52 +03:00
|
|
|
* @link https://help.retailcrm.ru/Developers/ApiVersion5
|
2017-06-22 00:55:08 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
namespace RetailCrm\Tests\Methods\Version5;
|
|
|
|
|
|
|
|
use RetailCrm\Test\TestCase;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class ApiClientUsersTest
|
|
|
|
*
|
|
|
|
* @category RetailCrm
|
|
|
|
* @package RetailCrm
|
|
|
|
* @author RetailCrm <integration@retailcrm.ru>
|
|
|
|
* @license https://opensource.org/licenses/MIT MIT License
|
2019-08-30 14:10:52 +03:00
|
|
|
* @link https://help.retailcrm.ru/Developers/ApiVersion5
|
2017-06-22 00:55:08 +03:00
|
|
|
*/
|
|
|
|
class ApiClientUsersTest extends TestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @group users_v5
|
|
|
|
*/
|
|
|
|
public function testUsersGroups()
|
|
|
|
{
|
2017-06-22 16:42:42 +03:00
|
|
|
$client = static::getApiClient();
|
2017-06-22 00:55:08 +03:00
|
|
|
|
|
|
|
$response = $client->request->usersGroups();
|
|
|
|
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
|
|
|
static::assertTrue(in_array($response->getStatusCode(), [200, 201]));
|
|
|
|
static::assertTrue($response->isSuccessful());
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @group users_v5
|
|
|
|
*/
|
|
|
|
public function testUsersList()
|
|
|
|
{
|
2017-06-22 16:42:42 +03:00
|
|
|
$client = static::getApiClient();
|
2017-06-22 00:55:08 +03:00
|
|
|
|
|
|
|
$response = $client->request->usersList();
|
|
|
|
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
|
|
|
static::assertTrue(in_array($response->getStatusCode(), [200, 201]));
|
|
|
|
static::assertTrue($response->isSuccessful());
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @group users_v5
|
|
|
|
*/
|
|
|
|
public function testUsersGet()
|
|
|
|
{
|
2017-06-22 16:42:42 +03:00
|
|
|
$client = static::getApiClient();
|
2018-02-20 17:50:45 +03:00
|
|
|
$user = getenv('RETAILCRM_USER') ?: $_SERVER['RETAILCRM_USER'];
|
|
|
|
$response = $client->request->usersGet($user);
|
2017-06-22 00:55:08 +03:00
|
|
|
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
|
|
|
static::assertTrue(in_array($response->getStatusCode(), [200, 201]));
|
|
|
|
static::assertTrue($response->isSuccessful());
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @group users_v5
|
|
|
|
*/
|
|
|
|
public function testUsersStatus()
|
|
|
|
{
|
2017-06-22 16:42:42 +03:00
|
|
|
$client = static::getApiClient();
|
2018-02-20 17:50:45 +03:00
|
|
|
$user = getenv('RETAILCRM_USER') ?: $_SERVER['RETAILCRM_USER'];
|
|
|
|
$response = $client->request->usersStatus($user, 'dinner');
|
2017-06-22 00:55:08 +03:00
|
|
|
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
|
|
|
static::assertTrue(in_array($response->getStatusCode(), [200, 201]));
|
|
|
|
static::assertTrue($response->isSuccessful());
|
|
|
|
}
|
|
|
|
}
|