From ddf46fd73d72058702273d926176e4dabaa76720 Mon Sep 17 00:00:00 2001 From: gwinn Date: Thu, 21 Jul 2016 16:37:41 +0300 Subject: [PATCH] update tests --- tests/RetailCrm/Tests/ApiClientPacksTest.php | 1 + tests/RetailCrm/Tests/ApiClientStoreTest.php | 23 +++++++++++++++++--- tests/RetailCrm/Tests/ApiClientTest.php | 11 ---------- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/tests/RetailCrm/Tests/ApiClientPacksTest.php b/tests/RetailCrm/Tests/ApiClientPacksTest.php index ac13585..3cf0965 100644 --- a/tests/RetailCrm/Tests/ApiClientPacksTest.php +++ b/tests/RetailCrm/Tests/ApiClientPacksTest.php @@ -75,6 +75,7 @@ class ApiClientPacksTest extends TestCase public function testOrdersPacksCreate() { $client = static::getApiClient(); + $pack = array( 'itemId' => $_SERVER['CRM_PACK_ITEM'], 'quantity' => $_SERVER['CRM_PACK_QUANTITY'], diff --git a/tests/RetailCrm/Tests/ApiClientStoreTest.php b/tests/RetailCrm/Tests/ApiClientStoreTest.php index 32b323c..1401bf6 100644 --- a/tests/RetailCrm/Tests/ApiClientStoreTest.php +++ b/tests/RetailCrm/Tests/ApiClientStoreTest.php @@ -10,6 +10,22 @@ use RetailCrm\Test\TestCase; */ class ApiClientStoreTest extends TestCase { + const SNAME = 'Test Store'; + const SCODE = 'test-store'; + + /** + * @group integration + */ + public function testStoreCreate() + { + $client = static::getApiClient(); + + $response = $client->storesEdit(array('name' => self::SNAME, 'code' => self::SCODE)); + $this->assertInstanceOf('RetailCrm\Response\ApiResponse', $response); + $this->assertTrue(in_array($response->getStatusCode(), array(200, 201))); + $this->assertTrue($response->success); + } + /** * @group integration */ @@ -52,7 +68,7 @@ class ApiClientStoreTest extends TestCase 'externalId' => $externalIdA, 'stores' => array( array( - 'code' => $_SERVER['CRM_STORE'], + 'code' => self::SCODE, 'available' => 10, 'purchasePrice' => 1700 ) @@ -62,17 +78,18 @@ class ApiClientStoreTest extends TestCase 'externalId' => $externalIdB, 'stores' => array( array( - 'code' => $_SERVER['CRM_STORE'], + 'code' => self::SCODE, 'available' => 20, 'purchasePrice' => 1500 ) ) ), )); + $this->assertInstanceOf('RetailCrm\Response\ApiResponse', $response); $this->assertTrue($response->isSuccessful()); } - + /** * @group integration */ diff --git a/tests/RetailCrm/Tests/ApiClientTest.php b/tests/RetailCrm/Tests/ApiClientTest.php index 38b535c..fe78cc1 100644 --- a/tests/RetailCrm/Tests/ApiClientTest.php +++ b/tests/RetailCrm/Tests/ApiClientTest.php @@ -15,15 +15,4 @@ class ApiClientTest extends TestCase $this->assertInstanceOf('RetailCrm\ApiClient', $client); } - - /** - * @group integration - */ - public function testStatisticUpdate() - { - $client = static::getApiClient(); - - $response = $client->statisticUpdate(); - $this->assertTrue($response->isSuccessful()); - } }