ldc-crm/tests/Client/CrmClientClientTest.php
Alexis Gousseau 303834bbca
Crm V4
- Make all tests pass Client (V4),CRMV2,CRMV4
- Simplify client submodule path
- Move App_url to .env.testing
2023-10-06 16:37:29 +02:00

58 lines
1.3 KiB
PHP

<?php
namespace Tests\Client;
use LDC\LDCCRM\CrmApiV4;
use LDC\LDCCRM\Enums\ApiStatus;
use LDC\LDCCRM\Enums\HttpMethods;
use LDC\LDCCRM\Exceptions\AccessError;
use LDC\LDCCRM\Models\Customer;
use LDC\LDCCRM\Transport\ApiInterface;
use LDC\LDCCRM\Transport\Request;
class CrmClientClientTest extends CrmClientTester
{
/**
* Test api interface.
*
* @return void
*/
public function testApiInterface()
{
$routes = $this->getClientRoutes();
$interface = new ApiInterface();
$request = new Request(
HttpMethods::make(\strtolower($routes['apiV4.ping']['methods'][0]), 'name'),
$routes['apiV4.ping']['uri']
);
$response = $interface->call($request);
$this->assertEquals(ApiStatus::OK->value(), $response->status->value());
}
/**
* Test ping.
*
* @return void
*/
public function testClientPing()
{
$api = new CrmApiV4();
$this->assertTrue($api->ping());
}
/**
* Set unknown attribute set
*
* @return void
*/
public function testCrmModelSetUnknownAttribute()
{
$this->expectException(AccessError::class);
$customer = new Customer();
$customer->unknownAttribute = 'totot';
}
}