2020-09-25 18:06:41 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* PHP version 7.4
|
|
|
|
*
|
2020-09-28 16:08:55 +03:00
|
|
|
* @category ClientFactoryTest
|
2020-09-25 18:06:41 +03:00
|
|
|
* @package Component
|
|
|
|
* @author RetailCRM <integration@retailcrm.ru>
|
|
|
|
* @license MIT
|
|
|
|
* @link http://retailcrm.ru
|
|
|
|
* @see http://help.retailcrm.ru
|
|
|
|
*/
|
|
|
|
namespace Component;
|
|
|
|
|
|
|
|
use PHPUnit\Framework\TestCase;
|
2020-09-28 16:08:55 +03:00
|
|
|
use RetailCrm\Component\Authenticator\TokenAuthenticator;
|
2020-09-28 13:27:19 +03:00
|
|
|
use RetailCrm\Component\Environment;
|
|
|
|
use RetailCrm\Factory\ClientFactory;
|
|
|
|
use RetailCrm\Factory\ContainerFactory;
|
2020-09-25 18:06:41 +03:00
|
|
|
use RetailCrm\TopClient\Client;
|
|
|
|
|
|
|
|
/**
|
2020-09-28 16:08:55 +03:00
|
|
|
* Class ClientFactoryTest
|
2020-09-25 18:06:41 +03:00
|
|
|
*
|
2020-09-28 16:08:55 +03:00
|
|
|
* @category ClientFactoryTest
|
2020-09-25 18:06:41 +03:00
|
|
|
* @package Component
|
|
|
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
|
|
|
* @license MIT
|
|
|
|
* @link http://retailcrm.ru
|
|
|
|
* @see https://help.retailcrm.ru
|
|
|
|
*/
|
2020-09-28 16:08:55 +03:00
|
|
|
class ClientFactoryTest extends TestCase
|
2020-09-25 18:06:41 +03:00
|
|
|
{
|
|
|
|
public function testCreateClient()
|
|
|
|
{
|
2020-09-28 13:27:19 +03:00
|
|
|
$client = ClientFactory::withContainer(
|
2020-09-28 16:08:55 +03:00
|
|
|
ContainerFactory::withEnv(Environment::DEV)
|
|
|
|
->withClient(new \GuzzleHttp\Client())
|
|
|
|
->create()
|
|
|
|
)->setServiceUrl(Client::OVERSEAS_ENDPOINT)
|
|
|
|
->setAuthenticator(new TokenAuthenticator('appKey', 'token'))
|
|
|
|
->create();
|
2020-09-25 18:06:41 +03:00
|
|
|
|
|
|
|
self::assertInstanceOf(Client::class, $client);
|
|
|
|
}
|
|
|
|
}
|