2016-01-09 15:24:12 +03:00
|
|
|
<?php
|
|
|
|
|
2016-04-14 23:11:51 +03:00
|
|
|
/**
|
|
|
|
* 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
|
2017-06-12 23:58:56 +03:00
|
|
|
* @link http://www.retailcrm.ru/docs/Developers/ApiVersion5
|
2016-04-14 23:11:51 +03:00
|
|
|
*/
|
|
|
|
|
2016-01-09 15:24:12 +03:00
|
|
|
namespace RetailCrm\Tests;
|
|
|
|
|
|
|
|
use RetailCrm\Test\TestCase;
|
|
|
|
|
2016-04-14 23:11:51 +03:00
|
|
|
/**
|
|
|
|
* Class ApiClientPacksTest
|
|
|
|
*
|
|
|
|
* @category RetailCrm
|
|
|
|
* @package RetailCrm
|
|
|
|
* @author RetailCrm <integration@retailcrm.ru>
|
|
|
|
* @license https://opensource.org/licenses/MIT MIT License
|
2017-06-12 23:58:56 +03:00
|
|
|
* @link http://www.retailcrm.ru/docs/Developers/ApiVersion5
|
2016-04-14 23:11:51 +03:00
|
|
|
*/
|
2016-01-09 15:24:12 +03:00
|
|
|
class ApiClientPacksTest extends TestCase
|
|
|
|
{
|
|
|
|
/**
|
2016-04-14 23:11:51 +03:00
|
|
|
* Test packs history
|
|
|
|
*
|
2016-07-22 01:01:47 +03:00
|
|
|
* @group packs
|
2016-04-14 23:11:51 +03:00
|
|
|
* @return void
|
2016-01-09 15:24:12 +03:00
|
|
|
*/
|
2017-06-12 23:58:56 +03:00
|
|
|
public function testPacksHistory()
|
2016-01-09 15:24:12 +03:00
|
|
|
{
|
|
|
|
$client = static::getApiClient();
|
|
|
|
|
|
|
|
$response = $client->ordersPacksHistory();
|
2017-06-12 23:58:56 +03:00
|
|
|
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
|
|
|
static::assertEquals(200, $response->getStatusCode());
|
|
|
|
static::assertTrue($response->success);
|
|
|
|
static::assertTrue(
|
2016-01-09 15:24:12 +03:00
|
|
|
isset($response['history']),
|
|
|
|
'API returns orders assembly history'
|
|
|
|
);
|
2017-06-12 23:58:56 +03:00
|
|
|
static::assertTrue(
|
2016-01-09 15:24:12 +03:00
|
|
|
isset($response['generatedAt']),
|
|
|
|
'API returns generatedAt in orders assembly history'
|
|
|
|
);
|
|
|
|
}
|
2016-03-12 01:54:33 +03:00
|
|
|
|
|
|
|
/**
|
2016-04-14 23:11:51 +03:00
|
|
|
* Test packs failed create
|
|
|
|
*
|
2016-07-22 01:01:47 +03:00
|
|
|
* @group packs
|
2016-04-14 23:11:51 +03:00
|
|
|
* @return void
|
2016-03-12 01:54:33 +03:00
|
|
|
*/
|
2017-06-12 23:58:56 +03:00
|
|
|
public function testPacksCreateFailed()
|
2016-03-12 01:54:33 +03:00
|
|
|
{
|
|
|
|
$client = static::getApiClient();
|
|
|
|
$pack = array(
|
|
|
|
'itemId' => 12,
|
2016-07-22 01:01:47 +03:00
|
|
|
'store' => 'test',
|
2016-03-12 01:54:33 +03:00
|
|
|
'quantity' => 2
|
|
|
|
);
|
|
|
|
|
|
|
|
$response = $client->ordersPacksCreate($pack);
|
2017-06-12 23:58:56 +03:00
|
|
|
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
|
|
|
static::assertEquals(400, $response->getStatusCode());
|
|
|
|
static::assertFalse($response->success);
|
2016-03-12 01:54:33 +03:00
|
|
|
}
|
|
|
|
}
|