2014-11-06 02:44:52 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace RetailCrm\Test;
|
|
|
|
|
|
|
|
use RetailCrm\ApiClient;
|
|
|
|
|
|
|
|
class TestCase extends \PHPUnit_Framework_TestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Return ApiClient object
|
|
|
|
*
|
|
|
|
* @param string $url (default: null)
|
|
|
|
* @param string $apiKey (default: null)
|
2014-11-27 11:23:44 +03:00
|
|
|
* @param string $site (default: null)
|
2014-11-06 02:44:52 +03:00
|
|
|
* @return ApiClient
|
|
|
|
*/
|
2014-11-27 11:23:44 +03:00
|
|
|
public static function getApiClient($url = null, $apiKey = null, $site = null)
|
2014-11-06 02:44:52 +03:00
|
|
|
{
|
2014-11-27 11:23:44 +03:00
|
|
|
return new ApiClient(
|
|
|
|
$url ?: $_SERVER['CRM_URL'],
|
|
|
|
$apiKey ?: $_SERVER['CRM_API_KEY'],
|
|
|
|
$site ?: (isset($_SERVER['CRM_SITE']) ? $_SERVER['CRM_SITE'] : null)
|
|
|
|
);
|
2014-11-06 02:44:52 +03:00
|
|
|
}
|
|
|
|
}
|