1
0
mirror of synced 2024-11-21 21:06:07 +03:00

travis update, packs test update

This commit is contained in:
Alex Lushpai 2016-04-14 23:11:51 +03:00
parent 546010b337
commit d26f609e9f
2 changed files with 63 additions and 8 deletions

View File

@ -6,7 +6,7 @@
colors="true"
verbose="true"
processIsolation="false"
stopOnFailure="true">
stopOnFailure="false">
<!-- Dummy values used to provide credentials. No need to change these. -->
<php>

View File

@ -1,13 +1,52 @@
<?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;
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
{
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()
{
@ -28,7 +67,10 @@ class ApiClientPacksTest extends TestCase
}
/**
* @group integration
* Test packs create
*
* @group integration
* @return void
*/
public function testOrdersPacksCreate()
{
@ -40,13 +82,17 @@ class ApiClientPacksTest extends TestCase
);
$response = $client->ordersPacksCreate($pack);
file_put_contents($this->_packId, $response["id"]);
$this->assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
$this->assertEquals(201, $response->getStatusCode());
$this->assertTrue($response->success);
}
/**
* @group integration
* Test packs failed create
*
* @group integration
* @return void
*/
public function testOrdersPacksCreateFailed()
{
@ -64,28 +110,37 @@ class ApiClientPacksTest extends TestCase
}
/**
* @group integration
* Test packs get
*
* @group integration
* @return void
*/
public function testOrdersPacksGet()
{
$client = static::getApiClient();
$response = $client->ordersPacksGet(1);
$packId = file_get_contents($this->_packId);
$response = $client->ordersPacksGet($packId);
$this->assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
$this->assertEquals(200, $response->getStatusCode());
$this->assertTrue($response->success);
}
/**
* @group integration
* Test packs delete
*
* @group integration
* @return void
*/
public function testOrdersPacksDelete()
{
$client = static::getApiClient();
$response = $client->ordersPacksDelete(1);
$packId = file_get_contents($this->_packId);
$response = $client->ordersPacksDelete($packId);
$this->assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
$this->assertEquals(200, $response->getStatusCode());
$this->assertTrue($response->success);
unlink($this->_packId);
}
}