1
0
mirror of synced 2024-11-22 21:36:06 +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
2016-07-22 01:01:47 +03:00
* @link http://www.retailcrm.ru/docs/Developers/ApiVersion4
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
2016-07-22 01:01:47 +03:00
* @link http://www.retailcrm.ru/docs/Developers/ApiVersion4
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 testOrdersPacksHistory()
{
$client = static::getApiClient();
$response = $client->ordersPacksHistory();
$this->assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
$this->assertEquals(200, $response->getStatusCode());
$this->assertTrue($response->success);
$this->assertTrue(
isset($response['history']),
'API returns orders assembly history'
);
$this->assertTrue(
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 testOrdersPacksCreateFailed()
{
$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);
$this->assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
$this->assertEquals(400, $response->getStatusCode());
$this->assertFalse($response->success);
}
}