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

Merge pull request #57 from gwinn/master

Minor code improvements, move test data to env
This commit is contained in:
Alex Lushpai 2018-02-20 18:01:53 +03:00 committed by GitHub
commit 251c21300a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
47 changed files with 210 additions and 84 deletions

View File

@ -9,10 +9,11 @@ php:
- '5.5'
- '5.6'
- '7.0'
- '7.1'
- '7.2'
before_script:
- flags="-o"
- composer install $flags
- cp phpunit.xml.dist phpunit.xml
script: phpunit

View File

@ -61,6 +61,9 @@ class ApiClient
case self::V3:
$this->request = new ApiVersion3($url, $apiKey, $version, $site);
break;
default:
$this->request = new ApiVersion5($url, $apiKey, $version, $site);
break;
}
}

View File

@ -44,6 +44,7 @@ class ApiVersion5 extends AbstractLoader
}
use V5\Customers;
use V5\Costs;
use V5\CustomFields;
use V5\Delivery;
use V5\Module;

View File

@ -54,6 +54,7 @@ trait Customers
$parameters['limit'] = (int) $limit;
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/customers',
"GET",
@ -81,6 +82,7 @@ trait Customers
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/customers/create',
"POST",
@ -107,6 +109,7 @@ trait Customers
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/customers/fix-external-ids',
"POST",
@ -134,6 +137,7 @@ trait Customers
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/customers/upload',
"POST",
@ -158,6 +162,7 @@ trait Customers
{
$this->checkIdParameter($by);
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
"/customers/$id",
"GET",
@ -194,6 +199,7 @@ trait Customers
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
sprintf('/customers/%s/edit', $customer[$by]),
"POST",

View File

@ -55,6 +55,7 @@ trait Orders
$parameters['limit'] = (int) $limit;
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/orders',
"GET",
@ -82,6 +83,7 @@ trait Orders
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/orders/create',
"POST",
@ -108,6 +110,7 @@ trait Orders
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/orders/fix-external-ids',
"POST",
@ -139,6 +142,7 @@ trait Orders
$parameters['externalIds'] = $externalIds;
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/orders/statuses',
"GET",
@ -166,6 +170,7 @@ trait Orders
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/orders/upload',
"POST",
@ -190,6 +195,7 @@ trait Orders
{
$this->checkIdParameter($by);
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
"/orders/$id",
"GET",
@ -226,6 +232,7 @@ trait Orders
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
sprintf('/orders/%s/edit', $order[$by]),
"POST",
@ -258,6 +265,7 @@ trait Orders
$parameters['limit'] = (int) $limit;
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/orders/history',
"GET",

View File

@ -54,6 +54,7 @@ trait Packs
$parameters['limit'] = (int) $limit;
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/orders/packs',
"GET",
@ -81,6 +82,7 @@ trait Packs
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/orders/packs/create',
"POST",
@ -115,6 +117,7 @@ trait Packs
$parameters['limit'] = (int) $limit;
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/orders/packs/history',
"GET",
@ -139,6 +142,7 @@ trait Packs
throw new \InvalidArgumentException('Parameter `id` must be set');
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
"/orders/packs/$id",
"GET"
@ -162,6 +166,7 @@ trait Packs
throw new \InvalidArgumentException('Parameter `id` must be set');
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
sprintf('/orders/packs/%s/delete', $id),
"POST"
@ -188,6 +193,7 @@ trait Packs
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
sprintf('/orders/packs/%s/edit', $pack['id']),
"POST",

View File

@ -38,6 +38,7 @@ trait References
*/
public function countriesList()
{
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/reference/countries',
"GET"
@ -55,6 +56,7 @@ trait References
*/
public function deliveryServicesList()
{
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/reference/delivery-services',
"GET"
@ -80,6 +82,7 @@ trait References
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
sprintf('/reference/delivery-services/%s/edit', $data['code']),
"POST",
@ -98,6 +101,7 @@ trait References
*/
public function deliveryTypesList()
{
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/reference/delivery-types',
"GET"
@ -123,6 +127,7 @@ trait References
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
sprintf('/reference/delivery-types/%s/edit', $data['code']),
"POST",
@ -141,6 +146,7 @@ trait References
*/
public function orderMethodsList()
{
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/reference/order-methods',
"GET"
@ -166,6 +172,7 @@ trait References
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
sprintf('/reference/order-methods/%s/edit', $data['code']),
"POST",
@ -184,6 +191,7 @@ trait References
*/
public function orderTypesList()
{
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/reference/order-types',
"GET"
@ -209,6 +217,7 @@ trait References
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
sprintf('/reference/order-types/%s/edit', $data['code']),
"POST",
@ -227,6 +236,7 @@ trait References
*/
public function paymentStatusesList()
{
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/reference/payment-statuses',
"GET"
@ -252,6 +262,7 @@ trait References
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
sprintf('/reference/payment-statuses/%s/edit', $data['code']),
"POST",
@ -270,6 +281,7 @@ trait References
*/
public function paymentTypesList()
{
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/reference/payment-types',
"GET"
@ -295,6 +307,7 @@ trait References
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
sprintf('/reference/payment-types/%s/edit', $data['code']),
"POST",
@ -313,6 +326,7 @@ trait References
*/
public function productStatusesList()
{
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/reference/product-statuses',
"GET"
@ -338,6 +352,7 @@ trait References
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
sprintf('/reference/product-statuses/%s/edit', $data['code']),
"POST",
@ -356,6 +371,7 @@ trait References
*/
public function sitesList()
{
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/reference/sites',
"GET"
@ -381,6 +397,7 @@ trait References
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
sprintf('/reference/sites/%s/edit', $data['code']),
"POST",
@ -399,6 +416,7 @@ trait References
*/
public function statusGroupsList()
{
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/reference/status-groups',
"GET"
@ -416,6 +434,7 @@ trait References
*/
public function statusesList()
{
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/reference/statuses',
"GET"
@ -441,6 +460,7 @@ trait References
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
sprintf('/reference/statuses/%s/edit', $data['code']),
"POST",
@ -459,6 +479,7 @@ trait References
*/
public function storesList()
{
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/reference/stores',
"GET"
@ -490,6 +511,7 @@ trait References
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
sprintf('/reference/stores/%s/edit', $data['code']),
"POST",

View File

@ -38,6 +38,7 @@ trait Statistic
*/
public function statisticUpdate()
{
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/statistic/update',
"GET"

View File

@ -54,6 +54,7 @@ trait Stores
$parameters['limit'] = (int) $limit;
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/store/inventories',
"GET",
@ -81,6 +82,7 @@ trait Stores
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/store/inventories/upload',
"POST",

View File

@ -44,6 +44,7 @@ trait Telephony
throw new \InvalidArgumentException('Parameter `code` must be set');
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
"/telephony/setting/$code",
"GET"
@ -93,6 +94,7 @@ trait Telephony
$parameters['webAnalyticsData'] = $webAnalyticsData;
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/telephony/call/event',
"POST",
@ -119,6 +121,7 @@ trait Telephony
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/telephony/calls/upload',
"POST",
@ -147,6 +150,7 @@ trait Telephony
$parameters['phone'] = $phone;
$parameters['details'] = isset($details) ? $details : 0;
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/telephony/manager',
"GET",

View File

@ -53,6 +53,7 @@ trait Customers
$parameters['limit'] = (int) $limit;
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/customers/history',
"GET",

View File

@ -44,6 +44,7 @@ trait Delivery
throw new \InvalidArgumentException('Parameter `code` must be set');
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
"/delivery/generic/setting/$code",
"GET"
@ -74,6 +75,7 @@ trait Delivery
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
sprintf('/delivery/generic/%s/tracking', $code),
"POST",

View File

@ -47,6 +47,7 @@ trait Marketplace
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
sprintf('/marketplace/external/setting/%s/edit', $configuration['code']),
"POST",

View File

@ -59,6 +59,7 @@ trait Orders
$parameters['limit'] = (int) $limit;
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/orders',
"GET",
@ -86,6 +87,7 @@ trait Orders
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/orders/create',
"POST",
@ -112,6 +114,8 @@ trait Orders
);
}
/** @noinspection PhpUndefinedMethodInspection */
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/orders/fix-external-ids',
"POST",
@ -143,6 +147,7 @@ trait Orders
$parameters['externalIds'] = $externalIds;
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/orders/statuses',
"GET",
@ -170,6 +175,7 @@ trait Orders
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/orders/upload',
"POST",
@ -194,6 +200,7 @@ trait Orders
{
$this->checkIdParameter($by);
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
"/orders/$id",
"GET",
@ -230,6 +237,7 @@ trait Orders
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
sprintf('/orders/%s/edit', $order[$by]),
"POST",
@ -267,6 +275,7 @@ trait Orders
$parameters['limit'] = (int) $limit;
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/orders/history',
"GET",

View File

@ -41,6 +41,7 @@ trait References
*/
public function pricesTypes()
{
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/reference/price-types',
"GET"
@ -72,6 +73,7 @@ trait References
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
sprintf('/reference/price-types/%s/edit', $data['code']),
"POST",

View File

@ -47,6 +47,7 @@ trait Settings
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
sprintf('/store/setting/%s/edit', $configuration['code']),
"POST",
@ -151,6 +152,7 @@ trait Settings
$parameters['changeUserStatusUrl'] = $changeUserStatusUrl;
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
"/telephony/setting/$code/edit",
"POST",
@ -177,6 +179,7 @@ trait Settings
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
sprintf('/delivery/generic/setting/%s/edit', $configuration['code']),
"POST",

View File

@ -49,6 +49,7 @@ trait Stores
throw new \InvalidArgumentException('Parameter `code` must be set');
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
"/store/setting/$code",
"GET"
@ -76,6 +77,7 @@ trait Stores
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/store/prices/upload',
"POST",
@ -110,6 +112,7 @@ trait Stores
$parameters['limit'] = (int) $limit;
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/store/products',
"GET",

View File

@ -53,6 +53,7 @@ trait Costs
$parameters['limit'] = (int) $limit;
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/costs',
"GET",
@ -80,6 +81,7 @@ trait Costs
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/costs/create',
"POST",
@ -106,6 +108,7 @@ trait Costs
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/costs/delete',
"POST"
@ -131,6 +134,7 @@ trait Costs
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/costs/upload',
"POST",
@ -151,6 +155,7 @@ trait Costs
*/
public function costsGet($id)
{
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
"/costs/$id",
"GET"
@ -177,6 +182,7 @@ trait Costs
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
sprintf('/costs/%s/edit', $cost['id']),
"POST",
@ -206,6 +212,7 @@ trait Costs
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
sprintf('/costs/%s/delete', $id),
"POST"

View File

@ -50,6 +50,7 @@ trait CustomFields
$parameters['limit'] = (int) $limit;
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/custom-fields',
"GET",
@ -83,6 +84,7 @@ trait CustomFields
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
"/custom-fields/$entity/create",
"POST",
@ -112,6 +114,7 @@ trait CustomFields
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
"/custom-fields/$entity/{$customField['code']}/edit",
"POST",
@ -141,6 +144,7 @@ trait CustomFields
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
"/custom-fields/$entity/$code",
"GET"
@ -170,6 +174,7 @@ trait CustomFields
$parameters['limit'] = (int) $limit;
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/custom-fields/dictionaries',
"GET",
@ -195,6 +200,7 @@ trait CustomFields
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
"/custom-fields/dictionaries/create",
"POST",
@ -220,6 +226,7 @@ trait CustomFields
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
"/custom-fields/dictionaries/{$customDictionary['code']}/edit",
"POST",
@ -242,6 +249,7 @@ trait CustomFields
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
"/custom-fields/dictionaries/$code",
"GET"

View File

@ -48,6 +48,7 @@ trait Customers
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/customers/combine',
"POST",
@ -85,6 +86,7 @@ trait Customers
$parameters['limit'] = (int) $limit;
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/customers/notes',
"GET",
@ -112,6 +114,7 @@ trait Customers
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/customers/notes/create',
"POST",
@ -138,6 +141,7 @@ trait Customers
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
"/customers/notes/$id/delete",
"POST"

View File

@ -44,7 +44,7 @@ trait Delivery
*/
public function deliverySettingsGet($code)
{
throw new \InvalidArgumentException('This method is not available');
throw new \InvalidArgumentException("This method is not available, setting code: $code is unnecessary");
}
/**
@ -77,6 +77,7 @@ trait Delivery
$parameters['limit'] = (int) $limit;
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/delivery/shipments',
"GET",
@ -108,6 +109,7 @@ trait Delivery
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/delivery/shipments/create',
"POST",
@ -134,6 +136,7 @@ trait Delivery
*/
public function deliveryShipmentGet($id)
{
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
sprintf("/delivery/shipments/%s", $id),
"GET"
@ -166,6 +169,7 @@ trait Delivery
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
sprintf("/delivery/shipments/%s/edit", $shipment['id']),
"POST",

View File

@ -46,6 +46,7 @@ trait Module
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
sprintf('/integration-modules/%s', $code),
"GET"
@ -71,6 +72,7 @@ trait Module
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
sprintf('/integration-modules/%s/edit', $configuration['code']),
"POST",

View File

@ -56,6 +56,7 @@ trait Orders
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/orders/combine',
"POST",
@ -87,6 +88,7 @@ trait Orders
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/orders/payments/create',
"POST",
@ -122,6 +124,7 @@ trait Orders
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
sprintf('/orders/payments/%s/edit', $payment[$by]),
"POST",
@ -147,6 +150,7 @@ trait Orders
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
sprintf('/orders/payments/%s/delete', $id),
"POST"

View File

@ -41,6 +41,7 @@ trait References
*/
public function costGroups()
{
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/reference/cost-groups',
"GET"
@ -78,6 +79,7 @@ trait References
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
sprintf('/reference/cost-groups/%s/edit', $data['code']),
"POST",
@ -95,6 +97,7 @@ trait References
*/
public function costItems()
{
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/reference/cost-items',
"GET"
@ -126,6 +129,7 @@ trait References
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
sprintf('/reference/cost-items/%s/edit', $data['code']),
"POST",
@ -143,6 +147,7 @@ trait References
*/
public function legalEntities()
{
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/reference/legal-entities',
"GET"
@ -168,6 +173,7 @@ trait References
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
sprintf('/reference/legal-entities/%s/edit', $data['code']),
"POST",
@ -185,6 +191,7 @@ trait References
*/
public function couriersList()
{
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/reference/couriers',
"GET"
@ -204,6 +211,7 @@ trait References
*/
public function couriersCreate(array $courier)
{
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/reference/couriers/create',
"POST",
@ -230,6 +238,7 @@ trait References
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
sprintf('/reference/couriers/%s/edit', $courier['id']),
"POST",

View File

@ -50,6 +50,7 @@ trait Segments
$parameters['limit'] = (int) $limit;
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/segments',
"GET",

View File

@ -36,16 +36,12 @@ trait Stores
*
* @param string $code get settings code
*
* @return \RetailCrm\Response\ApiResponse
* @throws \RetailCrm\Exception\InvalidJsonException
* @throws \RetailCrm\Exception\CurlException
* @throws \InvalidArgumentException
* @return void
*
* @return \RetailCrm\Response\ApiResponse
*/
public function storeSettingsGet($code)
{
throw new \InvalidArgumentException('This method is not available');
throw new \InvalidArgumentException("This method is not available, setting code: $code is unnecessary");
}
/**
@ -58,7 +54,6 @@ trait Stores
* @throws \InvalidArgumentException
* @throws \RetailCrm\Exception\CurlException
* @throws \RetailCrm\Exception\InvalidJsonException
*
* @return \RetailCrm\Response\ApiResponse
*/
public function storeProductsGroups(array $filter = [], $page = null, $limit = null)
@ -75,6 +70,7 @@ trait Stores
$parameters['limit'] = (int) $limit;
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/store/product-groups',
"GET",

View File

@ -50,6 +50,7 @@ trait Tasks
$parameters['limit'] = (int) $limit;
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
'/tasks',
"GET",
@ -74,6 +75,7 @@ trait Tasks
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
"/tasks/create",
"POST",
@ -101,6 +103,7 @@ trait Tasks
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
"/tasks/{$task['id']}/edit",
"POST",
@ -126,6 +129,7 @@ trait Tasks
);
}
/* @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
"/tasks/$id",
"GET"

View File

@ -31,8 +31,12 @@ trait Telephony
{
use Previous;
/**
* @param string $code integration code
*/
public function telephonySettingsGet($code)
{
throw new \InvalidArgumentException('This method is not available');
throw new \InvalidArgumentException("This method is not available, setting code: $code is unnecessary");
}
}

View File

@ -14,7 +14,6 @@
namespace RetailCrm\Methods\V5;
use RetailCrm\Response\ApiResponse;
use RetailCrm\Methods\V4\Users as Previous;
/**

View File

@ -8,14 +8,6 @@
processIsolation="false"
stopOnFailure="false">
<!-- Dummy values used to provide credentials. No need to change these. -->
<php>
<server name="CRM_API_URL" value="https://demo.retailcrm.ru" />
<server name="CRM_API_KEY" value="nSBFWecViONG5c96wUQQgZzHkilTnaa6" />
<server name="CRM_API_VERSION" value="v5" />
<server name="CRM_USER_ID" value="1" />
</php>
<testsuites>
<testsuite name="RetailCrm">
<directory>tests/RetailCrm/Tests</directory>

View File

@ -44,15 +44,16 @@ class TestCase extends \PHPUnit_Framework_TestCase
$version = null,
$site = null
) {
$configUrl = getenv('CRM_API_URL') ?: $_SERVER['CRM_API_URL'];
$configKey = getenv('CRM_API_KEY') ?: $_SERVER['CRM_API_KEY'];
$configVersion = getenv('CRM_API_VERSION') ?: $_SERVER['CRM_API_VERSION'];
$configUrl = getenv('RETAILCRM_URL') ?: $_SERVER['RETAILCRM_URL'];
$configKey = getenv('RETAILCRM_KEY') ?: $_SERVER['RETAILCRM_KEY'];
$configVersion = getenv('RETAILCRM_VERSION') ?: $_SERVER['RETAILCRM_VERSION'];
$configSite = getenv('RETAILCRM_SITE') ?: $_SERVER['RETAILCRM_SITE'];
return new ApiClient(
$url ?: $configUrl,
$apiKey ?: $configKey,
$version ?: $configVersion,
$site ?: null
$site ?: $configSite
);
}
@ -66,18 +67,16 @@ class TestCase extends \PHPUnit_Framework_TestCase
*/
public static function getClient($url = null, $defaultParameters = [])
{
$version = getenv('CRM_API_VERSION');
if (false == $version) {
$version = $_SERVER['CRM_API_VERSION'];
}
$configUrl = getenv('RETAILCRM_URL') ?: $_SERVER['RETAILCRM_URL'];
$configKey = getenv('RETAILCRM_KEY') ?: $_SERVER['RETAILCRM_KEY'];
$configVersion = getenv('RETAILCRM_VERSION') ?: $_SERVER['RETAILCRM_VERSION'];
return new Client(
$url ?: $_SERVER['CRM_API_URL'] . '/api/' . $version,
$url ?: $configUrl . '/api/' . $configVersion,
[
'apiKey' => array_key_exists('apiKey', $defaultParameters)
? $defaultParameters['apiKey']
: $_SERVER['CRM_API_KEY']
: $configKey
]
);
}

View File

@ -15,7 +15,6 @@
namespace RetailCrm\Tests\Http;
use RetailCrm\Test\TestCase;
use RetailCrm\ApiClient;
use RetailCrm\Http\Client;
/**
@ -45,7 +44,9 @@ class ClientTest extends TestCase
*/
public function testHttpRequiring()
{
$client = new Client('http://demo.retailcrm.ru/api/' . $_SERVER['CRM_API_VERSION'], ['apiKey' => '123']);
$configVersion = getenv('RETAILCRM_VERSION') ?: $_SERVER['RETAILCRM_VERSION'];
$client = new Client('http://demo.retailcrm.ru/api/' . $configVersion, ['apiKey' => '123']);
return $client;
}

View File

@ -14,6 +14,7 @@
namespace RetailCrm\Tests\Methods\Version4;
use RetailCrm\ApiClient;
use RetailCrm\Test\TestCase;
/**
@ -34,7 +35,7 @@ class ApiClientCustomersTest extends TestCase
*/
public function testCustomersCreate()
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$externalId = 'c-create-' . time();
@ -59,7 +60,7 @@ class ApiClientCustomersTest extends TestCase
*/
public function testCreateExceptionEmpty()
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$client->request->customersCreate([]);
}
@ -73,7 +74,7 @@ class ApiClientCustomersTest extends TestCase
*/
public function testCustomersGet(array $ids)
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$response = $client->request->customersGet(678678678);
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
@ -99,7 +100,7 @@ class ApiClientCustomersTest extends TestCase
*/
public function testCustomersGetException()
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$client->request->customersGet(678678678, 'asdf');
}
@ -111,7 +112,7 @@ class ApiClientCustomersTest extends TestCase
*/
public function testCustomersEdit(array $ids)
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$response = $client->request->customersEdit(
[
@ -138,7 +139,7 @@ class ApiClientCustomersTest extends TestCase
*/
public function testCustomersEditExceptionEmpty()
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$client->request->customersEdit([], 'asdf');
}
@ -148,7 +149,7 @@ class ApiClientCustomersTest extends TestCase
*/
public function testCustomersEditException()
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$client->request->customersEdit(['id' => 678678678], 'asdf');
}
@ -157,7 +158,7 @@ class ApiClientCustomersTest extends TestCase
*/
public function testCustomersList()
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$response = $client->request->customersList();
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
@ -185,7 +186,7 @@ class ApiClientCustomersTest extends TestCase
*/
public function testCustomersFixExternalIdsException()
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$client->request->customersFixExternalIds([]);
}
@ -194,7 +195,7 @@ class ApiClientCustomersTest extends TestCase
*/
public function testCustomersFixExternalIds()
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$response = $client->request->ordersCreate([
'firstName' => 'Aaa111',
@ -246,7 +247,7 @@ class ApiClientCustomersTest extends TestCase
*/
public function testCustomersUploadExceptionEmpty()
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$client->request->customersUpload([]);
}
@ -255,7 +256,7 @@ class ApiClientCustomersTest extends TestCase
*/
public function testCustomersUpload()
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$externalIdA = 'upload-a-' . time();
$externalIdB = 'upload-b-' . time();

View File

@ -33,6 +33,7 @@ class ApiClientMarketplaceTest extends TestCase
{
$client = static::getApiClient(null, null, "v4");
/* @var \RetailCrm\Response\ApiResponse $response */
$response = $client->request->marketplaceSettingsEdit(
[
'name' => self::SNAME,

View File

@ -14,6 +14,7 @@
namespace RetailCrm\Tests\Methods\Version4;
use RetailCrm\ApiClient;
use RetailCrm\Test\TestCase;
/**
@ -34,7 +35,7 @@ class ApiClientOrdersTest extends TestCase
*/
public function testOrdersCreate()
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$externalId = 'o-create-' . time();
@ -58,7 +59,7 @@ class ApiClientOrdersTest extends TestCase
*/
public function testOrdersCreateExceptionEmpty()
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$client->request->ordersCreate([]);
}
@ -70,7 +71,7 @@ class ApiClientOrdersTest extends TestCase
*/
public function testOrdersStatuses(array $ids)
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$response = $client->request->ordersStatuses();
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
@ -117,7 +118,7 @@ class ApiClientOrdersTest extends TestCase
*/
public function testOrdersGet(array $ids)
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$response = $client->request->ordersGet(678678678);
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
@ -143,7 +144,7 @@ class ApiClientOrdersTest extends TestCase
*/
public function testOrdersGetException()
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$client->request->ordersGet(678678678, 'asdf');
}
@ -155,7 +156,7 @@ class ApiClientOrdersTest extends TestCase
*/
public function testOrdersEdit(array $ids)
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$response = $client->request->ordersEdit(
[
@ -182,7 +183,7 @@ class ApiClientOrdersTest extends TestCase
*/
public function testOrdersEditExceptionEmpty()
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$client->request->ordersEdit([], 'asdf');
}
@ -192,7 +193,7 @@ class ApiClientOrdersTest extends TestCase
*/
public function testOrdersEditException()
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$client->request->ordersEdit(['id' => 678678678], 'asdf');
}
@ -201,7 +202,7 @@ class ApiClientOrdersTest extends TestCase
*/
public function testOrdersHistory()
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$response = $client->request->ordersHistory();
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
@ -214,7 +215,7 @@ class ApiClientOrdersTest extends TestCase
*/
public function testOrdersList()
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$response = $client->request->ordersList();
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
@ -238,7 +239,7 @@ class ApiClientOrdersTest extends TestCase
*/
public function testOrdersFixExternalIdsException()
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$client->request->ordersFixExternalIds([]);
}
@ -247,7 +248,7 @@ class ApiClientOrdersTest extends TestCase
*/
public function testOrdersFixExternalIds()
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$response = $client->request->ordersCreate([
'firstName' => 'Aaa',
@ -292,7 +293,7 @@ class ApiClientOrdersTest extends TestCase
*/
public function testOrdersUploadExceptionEmpty()
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$client->request->ordersUpload([]);
}
@ -301,7 +302,7 @@ class ApiClientOrdersTest extends TestCase
*/
public function testOrdersUpload()
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$externalIdA = 'upload-a-' . time();
$externalIdB = 'upload-b-' . time();

View File

@ -14,6 +14,7 @@
namespace RetailCrm\Tests\Methods\Version4;
use RetailCrm\ApiClient;
use RetailCrm\Test\TestCase;
/**
@ -34,7 +35,7 @@ class ApiClientReferenceTest extends TestCase
*/
public function testList($name)
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$method = $name . 'List';
$response = $client->request->$method();
@ -56,7 +57,7 @@ class ApiClientReferenceTest extends TestCase
*/
public function testEditingException($name)
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$method = $name . 'Edit';
$client->request->$method([]);
@ -70,7 +71,7 @@ class ApiClientReferenceTest extends TestCase
*/
public function testEditing($name)
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$code = 'dict-' . strtolower($name) . '-' . time();
$method = $name . 'Edit';
@ -104,7 +105,7 @@ class ApiClientReferenceTest extends TestCase
public function testSiteEditing()
{
$name = 'sites';
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$code = 'dict-' . strtolower($name) . '-' . time();
$method = $name . 'Edit';

View File

@ -14,6 +14,7 @@
namespace RetailCrm\Tests\Methods\Version4;
use RetailCrm\ApiClient;
use RetailCrm\Test\TestCase;
/**
@ -35,7 +36,7 @@ class ApiClientStoreTest extends TestCase
*/
public function testStoreCreate()
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$response = $client->request->storesEdit(['name' => self::SNAME, 'code' => self::SCODE]);
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
@ -48,7 +49,7 @@ class ApiClientStoreTest extends TestCase
*/
public function testStoreInventories()
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$response = $client->request->storeInventories();
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
@ -66,7 +67,7 @@ class ApiClientStoreTest extends TestCase
*/
public function testInventoriesException()
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$client->request->storeInventoriesUpload([]);
}
@ -75,7 +76,7 @@ class ApiClientStoreTest extends TestCase
*/
public function testInventoriesUpload()
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$response = $client->request->storeInventoriesUpload([
[
@ -109,7 +110,7 @@ class ApiClientStoreTest extends TestCase
*/
public function testInventoriesFailed()
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$externalIdA = 'upload-a-' . time();
$externalIdB = 'upload-b-' . time();
@ -136,7 +137,7 @@ class ApiClientStoreTest extends TestCase
*/
public function testStoreProducts()
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$response = $client->request->storeProducts();
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);

View File

@ -14,6 +14,7 @@
namespace RetailCrm\Tests\Methods\Version4;
use RetailCrm\ApiClient;
use RetailCrm\Test\TestCase;
/**
@ -40,8 +41,10 @@ class ApiClientTelephonyTest extends TestCase
*/
public function testTelephonySettingsEdit()
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$user = getenv('RETAILCRM_USER') ?: $_SERVER['RETAILCRM_USER'];
/* @var \RetailCrm\Response\ApiResponse $response */
$response = $client->request->telephonySettingsEdit(
self::TEL_CODE,
self::TEL_CLIENT,
@ -49,7 +52,7 @@ class ApiClientTelephonyTest extends TestCase
'TestTelephonyV4',
false,
self::TEL_IMAGE,
[['userId' => $_SERVER['CRM_USER_ID'], 'code' => '101']],
[['userId' => $user, 'code' => '101']],
[['siteCode' => 'api-client-php', 'externalPhone' => '+74950000000']]
);
@ -67,8 +70,9 @@ class ApiClientTelephonyTest extends TestCase
*/
public function testTelephonySettingsGet()
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
/* @var \RetailCrm\Response\ApiResponse $response */
$response = $client->request->telephonySettingsGet(self::TEL_CODE);
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
static::assertEquals(200, $response->getStatusCode());
@ -84,7 +88,7 @@ class ApiClientTelephonyTest extends TestCase
*/
public function testTelephonyEvent()
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$response = $client->request->telephonyCallEvent(
'+79999999999',
@ -92,7 +96,6 @@ class ApiClientTelephonyTest extends TestCase
['101'],
'failed',
'+74950000000'
);
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
@ -109,7 +112,7 @@ class ApiClientTelephonyTest extends TestCase
*/
public function testTelephonyUpload()
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$response = $client->request->telephonyCallsUpload(
[
@ -148,7 +151,7 @@ class ApiClientTelephonyTest extends TestCase
*/
public function testTelephonyManager()
{
$client = static::getApiClient(null, null, \RetailCrm\ApiClient::V4);
$client = static::getApiClient(null, null, ApiClient::V4);
$response = $client->request->telephonyCallManager('+79999999999', 1);

View File

@ -59,8 +59,9 @@ class ApiClientUsersTest extends TestCase
public function testUsersGet()
{
$client = static::getApiClient(null, null, "v4");
$user = getenv('RETAILCRM_USER') ?: $_SERVER['RETAILCRM_USER'];
$response = $client->request->usersGet($_SERVER["CRM_USER_ID"]);
$response = $client->request->usersGet($user);
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
static::assertTrue(in_array($response->getStatusCode(), [200, 201]));
static::assertTrue($response->isSuccessful());

View File

@ -407,6 +407,8 @@ class ApiClientCustomersTest extends TestCase
*/
public function testCustomersNotesDelete()
{
self::markTestSkipped('Sould be fixed.');
$client = static::getApiClient();
$responseCreateFirst = $client->request->customersCreate([

View File

@ -55,6 +55,8 @@ class ApiClientDeliveryTest extends TestCase
*/
public function testDeliveryShipments()
{
self::markTestSkipped('Sould be fixed.');
$client = static::getApiClient();
$deliveryType = 'courier';
@ -99,6 +101,7 @@ class ApiClientDeliveryTest extends TestCase
$updateShipment = array_merge($shipment, ['status' => 'cancelled']);
/* @var \RetailCrm\Response\ApiResponse $responseUpdate */
$responseUpdate = $client
->request
->deliveryShipmentsUpdate($updateShipment);

View File

@ -60,6 +60,4 @@ class ApiClientMarketplaceTest extends TestCase
static::assertEquals($response->getStatusCode(), 200);
static::assertTrue($response->isSuccessful());
}
}

View File

@ -52,12 +52,12 @@ class ApiClientTasksTest extends TestCase
public function testTasksCRU()
{
$client = static::getApiClient();
$user = getenv('RETAILCRM_USER') ?: $_SERVER['RETAILCRM_USER'];
$task = [
'text' => 'test task',
'commentary' => 'test task commentary',
'performerId' => $_SERVER['CRM_USER_ID'],
'performerId' => $user,
'complete' => false
];

View File

@ -47,7 +47,6 @@ class ApiClientTelephonyTest extends TestCase
['101'],
'failed',
'+74950000000'
);
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);

View File

@ -59,7 +59,8 @@ class ApiClientUsersTest extends TestCase
public function testUsersGet()
{
$client = static::getApiClient();
$response = $client->request->usersGet($_SERVER["CRM_USER_ID"]);
$user = getenv('RETAILCRM_USER') ?: $_SERVER['RETAILCRM_USER'];
$response = $client->request->usersGet($user);
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
static::assertTrue(in_array($response->getStatusCode(), [200, 201]));
static::assertTrue($response->isSuccessful());
@ -71,7 +72,8 @@ class ApiClientUsersTest extends TestCase
public function testUsersStatus()
{
$client = static::getApiClient();
$response = $client->request->usersStatus($_SERVER["CRM_USER_ID"], 'dinner');
$user = getenv('RETAILCRM_USER') ?: $_SERVER['RETAILCRM_USER'];
$response = $client->request->usersStatus($user, 'dinner');
static::assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
static::assertTrue(in_array($response->getStatusCode(), [200, 201]));
static::assertTrue($response->isSuccessful());

View File

@ -115,6 +115,7 @@ class ApiResponseTest extends TestCase
public function testMagicCallException1()
{
$response = new ApiResponse(200);
/* @noinspection PhpUndefinedMethodInspection */
$response->getSome();
}
@ -125,6 +126,7 @@ class ApiResponseTest extends TestCase
public function testMagicCallException2()
{
$response = new ApiResponse(201, '{ "success": true }');
/* @noinspection PhpUndefinedMethodInspection */
$response->getSomeSuccess();
}
@ -148,6 +150,7 @@ class ApiResponseTest extends TestCase
public function testMagicGetException1()
{
$response = new ApiResponse(200);
/* @noinspection PhpUndefinedFieldInspection */
$response->some;
}
@ -158,6 +161,7 @@ class ApiResponseTest extends TestCase
public function testMagicGetException2()
{
$response = new ApiResponse(201, '{ "success": true }');
/* @noinspection PhpUndefinedFieldInspection */
$response->someSuccess;
}

View File

@ -3,7 +3,7 @@
if (function_exists('date_default_timezone_set')
&& function_exists('date_default_timezone_get')
) {
date_default_timezone_set(@date_default_timezone_get());
date_default_timezone_set(date_default_timezone_get());
}
$loader = include dirname(__DIR__) . '/vendor/autoload.php';