1
0
mirror of synced 2024-11-26 15:26:06 +03:00
api-client-php/tests/RetailCrm/Tests/Methods/Version5/ApiClientFilesTest.php
2019-08-30 14:10:52 +03:00

79 lines
2.0 KiB
PHP

<?php
/**
* PHP version 5.4
*
* API client prices test class
*
* @category RetailCrm
* @package RetailCrm
* @author RetailCrm <integration@retailcrm.ru>
* @license https://opensource.org/licenses/MIT MIT License
* @link https://help.retailcrm.ru/Developers/ApiVersion5
*/
namespace RetailCrm\Tests\Methods\Version5;
use RetailCrm\Test\TestCase;
/**
* Class ApiClientPricesTest
*
* @category RetailCrm
* @package RetailCrm
* @author RetailCrm <integration@retailcrm.ru>
* @license https://opensource.org/licenses/MIT MIT License
* @link https://help.retailcrm.ru/Developers/ApiVersion5
*/
class ApiClientFilesTest extends TestCase
{
/**
* @group files_v5
*/
public function testFilesList()
{
$client = static::getApiClient();
$response = $client->request->filesList();
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
static::assertEquals(200, $response->getStatusCode());
static::assertTrue($response->isSuccessful());
}
/**
* @group files_v5
*/
public function testFileUpload()
{
$client = static::getApiClient();
$response = $client->request->fileUpload(__DIR__ . '/../../../Tests/Resources/Report.pdf');
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
static::assertEquals(200, $response->getStatusCode());
static::assertTrue($response->isSuccessful());
sleep(1);
$fileId = $response['file']['id'];
$response = $client->request->fileGet($fileId);
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
static::assertEquals(200, $response->getStatusCode());
static::assertTrue($response->isSuccessful());
sleep(1);
$response = $client->request->fileDelete($fileId);
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
static::assertEquals(200, $response->getStatusCode());
static::assertTrue($response->isSuccessful());
sleep(1);
}
}