1
0
Fork 0
mirror of synced 2025-04-20 01:21:01 +00:00

add factory test

This commit is contained in:
Sergey Chazov 2020-09-01 15:45:21 +03:00
parent 8f56984fd9
commit 94296303e0

View file

@ -0,0 +1,34 @@
<?php
namespace Tests\Intaro\RetailCrm\Component\Factory;
use Intaro\RetailCrm\Component\ApiClient\ClientAdapter;
use Intaro\RetailCrm\Component\ConfigProvider;
use Intaro\RetailCrm\Component\Factory\ClientFactory;
use PHPUnit\Framework\TestCase;
class ClientFactoryTest extends TestCase
{
public function testCreacteClientAdapter(): void
{
$configProvider = $this->createMock(ConfigProvider::class);
$configProvider->method('getApiUrl')
->willReturn('http://test.ru');
$configProvider->method('getApiKey')
->willReturn('qwerty123');
$client = ClientFactory::creacteClientAdapter();
self::assertEquals(ClientAdapter::class, get_class($client));
$configProvider->method('getApiUrl')
->willReturn('');
$configProvider->method('getApiKey')
->willReturn('');
$client = ClientFactory::creacteClientAdapter();
self::assertEquals(null, $client);
}
}