1
0
mirror of synced 2024-11-21 21:06:07 +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 \RetailCrm\Api\Model\Request\CustomerInteraction\CustomerInteractionCartClearRequest $request
* @param string|int $site
* *
* @return \RetailCrm\Api\Model\Response\SuccessResponse * @return \RetailCrm\Api\Model\Response\SuccessResponse
* @throws \RetailCrm\Api\Interfaces\ApiExceptionInterface * @throws \RetailCrm\Api\Interfaces\ApiExceptionInterface
@ -82,7 +82,7 @@ class CustomerInteraction extends AbstractApiResourceGroup
* @throws \RetailCrm\Api\Exception\Client\HandlerException * @throws \RetailCrm\Api\Exception\Client\HandlerException
* @throws \RetailCrm\Api\Exception\Client\HttpClientException * @throws \RetailCrm\Api\Exception\Client\HttpClientException
*/ */
public function cartClear($site, CustomerInteractionCartClearRequest $request): SuccessResponse public function cartClear(CustomerInteractionCartClearRequest $request, $site): SuccessResponse
{ {
/** @var SuccessResponse $response */ /** @var SuccessResponse $response */
$response = $this->sendRequest( $response = $this->sendRequest(
@ -144,8 +144,8 @@ class CustomerInteraction extends AbstractApiResourceGroup
* } * }
* ``` * ```
* *
* @param string|int $site
* @param \RetailCrm\Api\Model\Request\CustomerInteraction\CustomerInteractionCartSetRequest $request * @param \RetailCrm\Api\Model\Request\CustomerInteraction\CustomerInteractionCartSetRequest $request
* @param string|int $site
* *
* @return \RetailCrm\Api\Model\Response\SuccessResponse * @return \RetailCrm\Api\Model\Response\SuccessResponse
* @throws \RetailCrm\Api\Interfaces\ApiExceptionInterface * @throws \RetailCrm\Api\Interfaces\ApiExceptionInterface
@ -158,7 +158,7 @@ class CustomerInteraction extends AbstractApiResourceGroup
* @throws \RetailCrm\Api\Exception\Client\HandlerException * @throws \RetailCrm\Api\Exception\Client\HandlerException
* @throws \RetailCrm\Api\Exception\Client\HttpClientException * @throws \RetailCrm\Api\Exception\Client\HttpClientException
*/ */
public function cartSet($site, CustomerInteractionCartSetRequest $request): SuccessResponse public function cartSet(CustomerInteractionCartSetRequest $request, $site): SuccessResponse
{ {
/** @var SuccessResponse $response */ /** @var SuccessResponse $response */
$response = $this->sendRequest( $response = $this->sendRequest(

View File

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