add factory test
This commit is contained in:
parent
8f56984fd9
commit
94296303e0
1 changed files with 34 additions and 0 deletions
34
tests/lib/component/factory/ClientFactoryTest.php
Normal file
34
tests/lib/component/factory/ClientFactoryTest.php
Normal 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);
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue