1
0
mirror of synced 2024-11-21 12:56:08 +03:00

Change params, add matchPath to test

This commit is contained in:
Alex Komarichev 2024-08-01 12:26:50 +03:00
parent a7cffe45da
commit be71f22c65
2 changed files with 9 additions and 6 deletions

View File

@ -68,8 +68,8 @@ class CustomerInteraction extends AbstractApiResourceGroup
* }
* ```
*
* @param string|int $site
* @param \RetailCrm\Api\Model\Request\CustomerInteraction\CustomerInteractionCartClearRequest $request
* @param string|int $site
*
* @return \RetailCrm\Api\Model\Response\SuccessResponse
* @throws \RetailCrm\Api\Interfaces\ApiExceptionInterface
@ -82,7 +82,7 @@ class CustomerInteraction extends AbstractApiResourceGroup
* @throws \RetailCrm\Api\Exception\Client\HandlerException
* @throws \RetailCrm\Api\Exception\Client\HttpClientException
*/
public function cartClear($site, CustomerInteractionCartClearRequest $request): SuccessResponse
public function cartClear(CustomerInteractionCartClearRequest $request, $site): SuccessResponse
{
/** @var SuccessResponse $response */
$response = $this->sendRequest(
@ -144,8 +144,8 @@ class CustomerInteraction extends AbstractApiResourceGroup
* }
* ```
*
* @param string|int $site
* @param \RetailCrm\Api\Model\Request\CustomerInteraction\CustomerInteractionCartSetRequest $request
* @param string|int $site
*
* @return \RetailCrm\Api\Model\Response\SuccessResponse
* @throws \RetailCrm\Api\Interfaces\ApiExceptionInterface
@ -158,7 +158,7 @@ class CustomerInteraction extends AbstractApiResourceGroup
* @throws \RetailCrm\Api\Exception\Client\HandlerException
* @throws \RetailCrm\Api\Exception\Client\HttpClientException
*/
public function cartSet($site, CustomerInteractionCartSetRequest $request): SuccessResponse
public function cartSet(CustomerInteractionCartSetRequest $request, $site): SuccessResponse
{
/** @var SuccessResponse $response */
$response = $this->sendRequest(

View File

@ -39,12 +39,13 @@ EOF;
$mock = static::createApiMockBuilder('customer-interaction/testSite/cart/clear');
$mock->matchMethod(RequestMethod::POST)
->matchPath('/api/v5/customer-interaction/testSite/cart/clear')
->matchBody(static::encodeForm($request))
->reply(200)
->withBody($json);
$client = TestClientFactory::createClient($mock->getClient());
$response = $client->customerInteraction->cartClear('testSite', $request);
$response = $client->customerInteraction->cartClear($request, 'testSite');
self::assertModelEqualsToResponse($json, $response);
}
@ -76,12 +77,13 @@ EOF;
$mock = static::createApiMockBuilder('customer-interaction/testSite/cart/set');
$mock->matchMethod(RequestMethod::POST)
->matchPath('/api/v5/customer-interaction/testSite/cart/set')
->matchBody(static::encodeForm($request))
->reply(200)
->withBody($json);
$client = TestClientFactory::createClient($mock->getClient());
$response = $client->customerInteraction->cartSet('testSite', $request);
$response = $client->customerInteraction->cartSet($request, 'testSite');
self::assertModelEqualsToResponse($json, $response);
}
@ -123,6 +125,7 @@ EOF;
$mock = static::createApiMockBuilder('customer-interaction/testSite/cart/4770');
$mock->matchMethod(RequestMethod::GET)
->matchPath('/api/v5/customer-interaction/testSite/cart/4770')
->matchQuery(static::encodeFormArray($request))
->reply(200)
->withBody($json);