diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..4d6ff60 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,17 @@ +language: php + +cache: + directories: + - $HOME/.composer/cache + +php: + - '5.3' + - '5.4' + - '5.5' + - '5.6' + +before_script: + - flags="--prefer-dist --no-dev" + - composer install $flags + +script: phpunit diff --git a/composer.json b/composer.json index 9bf2ea4..f7ef549 100644 --- a/composer.json +++ b/composer.json @@ -15,16 +15,6 @@ "php": ">=5.3.0", "ext-curl": "*" }, - "require-dev": { - "phpunit/phpunit": "5.2.*", - "phpunit/php-code-coverage": "3.3.0", - "phpunit/php-invoker": "1.1.4", - "phpmd/phpmd": "2.4.*", - "sebastian/phpcpd": "2.0.*", - "sebastian/phpdcd": "1.0.*", - "squizlabs/php_codesniffer": "2.5.*", - "apigen/apigen": "4.1.*" - }, "support": { "email": "support@retailcrm.pro" }, diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 6097b7b..e4bb52c 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -6,16 +6,16 @@ colors="true" verbose="true" processIsolation="false" - stopOnFailure="true"> + stopOnFailure="false"> - - - - - - + + + + + + diff --git a/tests/RetailCrm/Tests/ApiClientPacksTest.php b/tests/RetailCrm/Tests/ApiClientPacksTest.php index cc51764..ac13585 100644 --- a/tests/RetailCrm/Tests/ApiClientPacksTest.php +++ b/tests/RetailCrm/Tests/ApiClientPacksTest.php @@ -1,13 +1,52 @@ + * @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 + * @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); } }