1
0
mirror of synced 2024-11-26 23:36:06 +03:00
api-client-php/tests/RetailCrm/Tests/Methods/Version5/ApiClientPacksTest.php

64 lines
1.5 KiB
PHP
Raw Normal View History

<?php
/**
* PHP version 5.4
*
* API client packs test class
*
* @category RetailCrm
* @package RetailCrm
*/
namespace RetailCrm\Tests\Methods\Version5;
use RetailCrm\Test\TestCase;
/**
* Class ApiClientPacksTest
*
* @category RetailCrm
* @package RetailCrm
*/
class ApiClientPacksTest extends TestCase
{
/**
* @group packs_v5
*/
public function testPacksHistory()
{
2017-06-22 16:42:42 +03:00
$client = static::getApiClient();
$response = $client->request->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'
);
}
/**
* @group packs_v5
*/
public function testPacksCreateFailed()
{
2017-06-22 16:42:42 +03:00
$client = static::getApiClient();
$pack = [
'itemId' => 12,
'store' => 'test',
'quantity' => 2
];
$response = $client->request->ordersPacksCreate($pack);
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
static::assertEquals(400, $response->getStatusCode());
static::assertFalse($response->success);
}
}