parent
0fad2158be
commit
8c583de05b
@ -5,7 +5,6 @@ cache:
|
|||||||
- $HOME/.composer/cache
|
- $HOME/.composer/cache
|
||||||
|
|
||||||
php:
|
php:
|
||||||
- '5.3'
|
|
||||||
- '5.4'
|
- '5.4'
|
||||||
- '5.5'
|
- '5.5'
|
||||||
- '5.6'
|
- '5.6'
|
||||||
|
@ -13,7 +13,8 @@
|
|||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=5.3.0",
|
"php": ">=5.3.0",
|
||||||
"ext-curl": "*"
|
"ext-curl": "*",
|
||||||
|
"phpunit/phpunit": "4.8.29"
|
||||||
},
|
},
|
||||||
"support": {
|
"support": {
|
||||||
"email": "support@retailcrm.pro"
|
"email": "support@retailcrm.pro"
|
||||||
|
@ -1754,6 +1754,32 @@ class ApiClient
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit marketplace configuration
|
||||||
|
*
|
||||||
|
* @param array $configuration
|
||||||
|
*
|
||||||
|
* @throws \RetailCrm\Exception\InvalidJsonException
|
||||||
|
* @throws \RetailCrm\Exception\CurlException
|
||||||
|
* @throws \InvalidArgumentException
|
||||||
|
*
|
||||||
|
* @return ApiResponse
|
||||||
|
*/
|
||||||
|
public function marketplaceSettingsEdit(array $configuration)
|
||||||
|
{
|
||||||
|
if (!count($configuration) || empty($configuration['code'])) {
|
||||||
|
throw new \InvalidArgumentException(
|
||||||
|
'Parameter `configuration` must contains a data & configuration `code` must be set'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->client->makeRequest(
|
||||||
|
sprintf('/marketplace/external/setting/%s/edit', $configuration['code']),
|
||||||
|
Client::METHOD_POST,
|
||||||
|
array('configuration' => json_encode($configuration))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update CRM basic statistic
|
* Update CRM basic statistic
|
||||||
*
|
*
|
||||||
|
@ -23,7 +23,7 @@ class TestCase extends \PHPUnit_Framework_TestCase
|
|||||||
$site ?: (isset($_SERVER['CRM_SITE']) ? $_SERVER['CRM_SITE'] : null)
|
$site ?: (isset($_SERVER['CRM_SITE']) ? $_SERVER['CRM_SITE'] : null)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return Client object
|
* Return Client object
|
||||||
*
|
*
|
||||||
|
44
tests/RetailCrm/Tests/ApiClientMarketplaceTest.php
Normal file
44
tests/RetailCrm/Tests/ApiClientMarketplaceTest.php
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHP version 5.3
|
||||||
|
*
|
||||||
|
* API client marketplace 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/ApiVersion4
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace RetailCrm\Tests;
|
||||||
|
|
||||||
|
use RetailCrm\Test\TestCase;
|
||||||
|
|
||||||
|
|
||||||
|
class ApiClientMarketplaceTest extends TestCase
|
||||||
|
{
|
||||||
|
const SNAME = 'Marketplace integration';
|
||||||
|
const SCODE = 'integration';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group marketplace
|
||||||
|
*/
|
||||||
|
public function testConfigurationEdit()
|
||||||
|
{
|
||||||
|
$client = static::getApiClient();
|
||||||
|
|
||||||
|
$response = $client->marketplaceSettingsEdit(
|
||||||
|
array(
|
||||||
|
'name' => self::SNAME,
|
||||||
|
'code' => self::SCODE,
|
||||||
|
'logo' => 'http://download.retailcrm.pro/logos/setup.svg',
|
||||||
|
'active' => 'true'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
||||||
|
$this->assertTrue(in_array($response->getStatusCode(), array(200, 201)));
|
||||||
|
$this->assertTrue($response->isSuccessful());
|
||||||
|
}
|
||||||
|
}
|
@ -77,16 +77,14 @@ class ApiClientReferenceTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
$response = $client->$method($params);
|
$response = $client->$method($params);
|
||||||
$this->assertEquals(201, $response->getStatusCode());
|
$this->assertTrue(in_array($response->getStatusCode(), array(200, 201)));
|
||||||
|
|
||||||
$response = $client->$method(array(
|
$response = $client->$method(array(
|
||||||
'code' => $code,
|
'code' => $code,
|
||||||
'name' => 'Bbb',
|
'name' => 'Bbb',
|
||||||
));
|
));
|
||||||
if ($response->getStatusCode() > 201) {
|
|
||||||
print_r($response);
|
$this->assertTrue(in_array($response->getStatusCode(), array(200, 201)));
|
||||||
}
|
|
||||||
$this->assertEquals(200, $response->getStatusCode());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -104,7 +104,7 @@ class ApiClientStoreTest extends TestCase
|
|||||||
));
|
));
|
||||||
|
|
||||||
$this->assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
$this->assertInstanceOf('RetailCrm\Response\ApiResponse', $response);
|
||||||
$this->assertTrue($response->isSuccessful());
|
$this->assertFalse($response->isSuccessful());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user