1
0
mirror of synced 2024-11-23 05:46:07 +03:00
api-client-php/tests/RetailCrm/Tests/ApiClientPacksTest.php
Alex Lushpai fdd7c3d4c8 V5 (#37)
* update tests
* update version to 5.0.0, combine methods for orders & customer, update status method for users, custom fields|dictionaries & task methods, segments & product groups list methods, orders payments
2017-06-12 23:58:56 +03:00

75 lines
1.9 KiB
PHP

<?php
/**
* PHP version 5.3
*
* API client packs test class
*
* @category RetailCrm
* @package RetailCrm
* @author RetailCrm <integration@retailcrm.ru>
* @license https://opensource.org/licenses/MIT MIT License
* @link http://www.retailcrm.ru/docs/Developers/ApiVersion5
*/
namespace RetailCrm\Tests;
use RetailCrm\Test\TestCase;
/**
* Class ApiClientPacksTest
*
* @category RetailCrm
* @package RetailCrm
* @author RetailCrm <integration@retailcrm.ru>
* @license https://opensource.org/licenses/MIT MIT License
* @link http://www.retailcrm.ru/docs/Developers/ApiVersion5
*/
class ApiClientPacksTest extends TestCase
{
/**
* Test packs history
*
* @group packs
* @return void
*/
public function testPacksHistory()
{
$client = static::getApiClient();
$response = $client->ordersPacksHistory();
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
static::assertEquals(200, $response->getStatusCode());
static::assertTrue($response->success);
static::assertTrue(
isset($response['history']),
'API returns orders assembly history'
);
static::assertTrue(
isset($response['generatedAt']),
'API returns generatedAt in orders assembly history'
);
}
/**
* Test packs failed create
*
* @group packs
* @return void
*/
public function testPacksCreateFailed()
{
$client = static::getApiClient();
$pack = array(
'itemId' => 12,
'store' => 'test',
'quantity' => 2
);
$response = $client->ordersPacksCreate($pack);
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
static::assertEquals(400, $response->getStatusCode());
static::assertFalse($response->success);
}
}