diff --git a/phpunit.xml.dist b/phpunit.xml.dist index a8b949e..e4bb52c 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -6,7 +6,7 @@ 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); } }