travis update, packs test update
This commit is contained in:
parent
546010b337
commit
d26f609e9f
@ -6,7 +6,7 @@
|
|||||||
colors="true"
|
colors="true"
|
||||||
verbose="true"
|
verbose="true"
|
||||||
processIsolation="false"
|
processIsolation="false"
|
||||||
stopOnFailure="true">
|
stopOnFailure="false">
|
||||||
|
|
||||||
<!-- Dummy values used to provide credentials. No need to change these. -->
|
<!-- Dummy values used to provide credentials. No need to change these. -->
|
||||||
<php>
|
<php>
|
||||||
|
@ -1,13 +1,52 @@
|
|||||||
<?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/ApiVersion3
|
||||||
|
*/
|
||||||
|
|
||||||
namespace RetailCrm\Tests;
|
namespace RetailCrm\Tests;
|
||||||
|
|
||||||
use RetailCrm\Test\TestCase;
|
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/ApiVersion3
|
||||||
|
*/
|
||||||
class ApiClientPacksTest extends TestCase
|
class ApiClientPacksTest extends TestCase
|
||||||
{
|
{
|
||||||
|
private $_packId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @group integration
|
* ApiClientPacksTest constructor.
|
||||||
|
*
|
||||||
|
* @param null|string $name name
|
||||||
|
* @param array $data data
|
||||||
|
* @param string $dataName dataName
|
||||||
|
*/
|
||||||
|
public function __construct($name = null, array $data = array(), $dataName = '')
|
||||||
|
{
|
||||||
|
parent::__construct($name, $data, $dataName);
|
||||||
|
$this->_packId = __DIR__ . '/../../../pack.tmp';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test packs history
|
||||||
|
*
|
||||||
|
* @group integration
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testOrdersPacksHistory()
|
public function testOrdersPacksHistory()
|
||||||
{
|
{
|
||||||
@ -28,7 +67,10 @@ class ApiClientPacksTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @group integration
|
* Test packs create
|
||||||
|
*
|
||||||
|
* @group integration
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testOrdersPacksCreate()
|
public function testOrdersPacksCreate()
|
||||||
{
|
{
|
||||||
@ -40,13 +82,17 @@ class ApiClientPacksTest extends TestCase
|
|||||||
);
|
);
|
||||||
|
|
||||||
$response = $client->ordersPacksCreate($pack);
|
$response = $client->ordersPacksCreate($pack);
|
||||||
|
file_put_contents($this->_packId, $response["id"]);
|
||||||
$this->assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
$this->assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
||||||
$this->assertEquals(201, $response->getStatusCode());
|
$this->assertEquals(201, $response->getStatusCode());
|
||||||
$this->assertTrue($response->success);
|
$this->assertTrue($response->success);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @group integration
|
* Test packs failed create
|
||||||
|
*
|
||||||
|
* @group integration
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testOrdersPacksCreateFailed()
|
public function testOrdersPacksCreateFailed()
|
||||||
{
|
{
|
||||||
@ -64,28 +110,37 @@ class ApiClientPacksTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @group integration
|
* Test packs get
|
||||||
|
*
|
||||||
|
* @group integration
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testOrdersPacksGet()
|
public function testOrdersPacksGet()
|
||||||
{
|
{
|
||||||
$client = static::getApiClient();
|
$client = static::getApiClient();
|
||||||
|
|
||||||
$response = $client->ordersPacksGet(1);
|
$packId = file_get_contents($this->_packId);
|
||||||
|
$response = $client->ordersPacksGet($packId);
|
||||||
$this->assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
$this->assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
||||||
$this->assertEquals(200, $response->getStatusCode());
|
$this->assertEquals(200, $response->getStatusCode());
|
||||||
$this->assertTrue($response->success);
|
$this->assertTrue($response->success);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @group integration
|
* Test packs delete
|
||||||
|
*
|
||||||
|
* @group integration
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testOrdersPacksDelete()
|
public function testOrdersPacksDelete()
|
||||||
{
|
{
|
||||||
$client = static::getApiClient();
|
$client = static::getApiClient();
|
||||||
|
|
||||||
$response = $client->ordersPacksDelete(1);
|
$packId = file_get_contents($this->_packId);
|
||||||
|
$response = $client->ordersPacksDelete($packId);
|
||||||
$this->assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
$this->assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
||||||
$this->assertEquals(200, $response->getStatusCode());
|
$this->assertEquals(200, $response->getStatusCode());
|
||||||
$this->assertTrue($response->success);
|
$this->assertTrue($response->success);
|
||||||
|
unlink($this->_packId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user