1
0
mirror of synced 2024-11-23 05:46:07 +03:00
api-client-php/tests/RetailCrm/Tests/ApiClientPacksTest.php

75 lines
1.9 KiB
PHP
Raw Normal View History

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
* @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
* @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
*/
public function testPacksHistory()
2016-01-09 15:24:12 +03:00
{
$client = static::getApiClient();
$response = $client->ordersPacksHistory();
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'
);
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
*/
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);
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
static::assertEquals(400, $response->getStatusCode());
static::assertFalse($response->success);
2016-03-12 01:54:33 +03:00
}
}