<?php

/**
 * AccountApiTest
 * PHP version 8.1.
 *
 * @category Class
 *
 * @author   OpenAPI Generator team
 *
 * @see     https://openapi-generator.tech
 */

/**
 * Binance Derivatives Trading Portfolio Margin REST API.
 *
 * OpenAPI Specification for the Binance Derivatives Trading Portfolio Margin REST API
 *
 * The version of the OpenAPI document: 1.0.0
 * Generated by: https://openapi-generator.tech
 * Generator version: 7.12.0
 */

/**
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Please update the test case below to test the endpoint.
 */

namespace Binance\Client\DerivativesTradingPortfolioMargin\Test\Api;

use Binance\Client\DerivativesTradingPortfolioMargin\Api\AccountApi;
use Binance\Client\DerivativesTradingPortfolioMargin\Configuration;
use Binance\Client\DerivativesTradingPortfolioMargin\Model\BnbTransferRequest;
use Binance\Client\DerivativesTradingPortfolioMargin\Model\ChangeAutoRepayFuturesStatusRequest;
use Binance\Client\DerivativesTradingPortfolioMargin\Model\ChangeCmInitialLeverageRequest;
use Binance\Client\DerivativesTradingPortfolioMargin\Model\ChangeCmPositionModeRequest;
use Binance\Client\DerivativesTradingPortfolioMargin\Model\ChangeUmInitialLeverageRequest;
use Binance\Client\DerivativesTradingPortfolioMargin\Model\ChangeUmPositionModeRequest;
use Binance\Client\DerivativesTradingPortfolioMargin\Model\FundAutoCollectionRequest;
use Binance\Client\DerivativesTradingPortfolioMargin\Model\FundCollectionByAssetRequest;
use Binance\Client\DerivativesTradingPortfolioMargin\Model\RepayFuturesNegativeBalanceRequest;
use Binance\Common\Configuration\ClientConfiguration;
use Binance\Common\Configuration\SignatureConfiguration;
use Binance\Common\HttpClient;
use GuzzleHttp\Psr7\Utils;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\ResponseInterface;

/**
 * AccountApiTest Class Doc Comment.
 *
 * @category Class
 *
 * @author   OpenAPI Generator team
 *
 * @see     https://openapi-generator.tech
 *
 * @internal
 *
 * @coversNothing
 */
class AccountApiTest extends TestCase
{
    public function getApiMock(&$request)
    {
        $clientMock = $this->createMock(HttpClient::class);
        $signatureConfig = new SignatureConfiguration();
        $signatureConfig->setApiKey('apiKey');
        $signatureConfig->setSecretKey('secretKey');
        $clientConfig = new ClientConfiguration();
        $clientConfig->setUrl('http://localhost:8080');
        $clientConfig->setSignatureConfiguration($signatureConfig);
        $responseMock = $this->createMock(ResponseInterface::class);

        $responseMock->expects($this->any())
            ->method('getStatusCode')
            ->willReturn(200)
        ;

        $responseMock->expects($this->any())
            ->method('getBody')
            ->willReturn(Utils::streamFor('{}'))
        ;

        $clientMock->expects($this->once())
            ->method('send')
            ->will($this->returnCallback(function ($actualRequest) use (&$request, $responseMock) {
                $request = $actualRequest;

                return $responseMock;
            }))
        ;

        $apiMock = $this->getMockBuilder(AccountApi::class)
            ->setConstructorArgs([$clientConfig, $clientMock])
            ->onlyMethods(['getTimestamp'])
            ->getMock()
        ;

        $apiMock->method('getTimestamp')->willReturn('1736393892000');

        return $apiMock;
    }

    /**
     * Test case for accountBalance.
     *
     * Account Balance(USER_DATA).
     */
    public function testAccountBalance()
    {
        $asset = '';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->accountBalance($asset, $recvWindow);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/balance', $request->getUri()->getPath());
        self::assertEquals('2cdd1e484bce80021437bee6b762e6a276b1954c3a0c011a16f6f2f6a47aba75', $queryMap['signature']);
    }

    /**
     * Test case for accountInformation.
     *
     * Account Information(USER_DATA).
     */
    public function testAccountInformation()
    {
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->accountInformation($recvWindow);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/account', $request->getUri()->getPath());
        self::assertEquals('2cdd1e484bce80021437bee6b762e6a276b1954c3a0c011a16f6f2f6a47aba75', $queryMap['signature']);
    }

    /**
     * Test case for bnbTransfer.
     *
     * BNB transfer (TRADE).
     */
    public function testBnbTransfer()
    {
        $bnbTransferRequest = new BnbTransferRequest();
        $bnbTransferRequest->setAmount(1.0);
        $bnbTransferRequest->setTransferSide('');

        $response = $this->getApiMock($request)->bnbTransfer($bnbTransferRequest);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/bnb-transfer', $request->getUri()->getPath());
        self::assertEquals('50d24733794b928836575c346769be26ee1fb5ffbf73f36933cd22c50116f74e', $queryMap['signature']);
    }

    /**
     * Test case for changeAutoRepayFuturesStatus.
     *
     * Change Auto-repay-futures Status(TRADE).
     */
    public function testChangeAutoRepayFuturesStatus()
    {
        $changeAutoRepayFuturesStatusRequest = new ChangeAutoRepayFuturesStatusRequest();
        $changeAutoRepayFuturesStatusRequest->setAutoRepay('');

        $response = $this->getApiMock($request)->changeAutoRepayFuturesStatus($changeAutoRepayFuturesStatusRequest);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/repay-futures-switch', $request->getUri()->getPath());
        self::assertEquals('da82fc30a786fb2fea807a0c84e13082bdf837e1bcdd4ec170d79b99f48d8386', $queryMap['signature']);
    }

    /**
     * Test case for changeCmInitialLeverage.
     *
     * Change CM Initial Leverage (TRADE).
     */
    public function testChangeCmInitialLeverage()
    {
        $changeCmInitialLeverageRequest = new ChangeCmInitialLeverageRequest();
        $changeCmInitialLeverageRequest->setSymbol('');
        $changeCmInitialLeverageRequest->setLeverage(1);

        $response = $this->getApiMock($request)->changeCmInitialLeverage($changeCmInitialLeverageRequest);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/cm/leverage', $request->getUri()->getPath());
        self::assertEquals('c4732c9aa613aa34fafed94623554e163fd7c8b28d8b2cefc5a265dc69f45056', $queryMap['signature']);
    }

    /**
     * Test case for changeCmPositionMode.
     *
     * Change CM Position Mode(TRADE).
     */
    public function testChangeCmPositionMode()
    {
        $changeCmPositionModeRequest = new ChangeCmPositionModeRequest();
        $changeCmPositionModeRequest->setDualSidePosition('');

        $response = $this->getApiMock($request)->changeCmPositionMode($changeCmPositionModeRequest);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/cm/positionSide/dual', $request->getUri()->getPath());
        self::assertEquals('bebef105cea3efc7f04654c618d2083229fcfc36b20173f0634e17be5042abd9', $queryMap['signature']);
    }

    /**
     * Test case for changeUmInitialLeverage.
     *
     * Change UM Initial Leverage(TRADE).
     */
    public function testChangeUmInitialLeverage()
    {
        $changeUmInitialLeverageRequest = new ChangeUmInitialLeverageRequest();
        $changeUmInitialLeverageRequest->setSymbol('');
        $changeUmInitialLeverageRequest->setLeverage(1);

        $response = $this->getApiMock($request)->changeUmInitialLeverage($changeUmInitialLeverageRequest);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/um/leverage', $request->getUri()->getPath());
        self::assertEquals('c4732c9aa613aa34fafed94623554e163fd7c8b28d8b2cefc5a265dc69f45056', $queryMap['signature']);
    }

    /**
     * Test case for changeUmPositionMode.
     *
     * Change UM Position Mode(TRADE).
     */
    public function testChangeUmPositionMode()
    {
        $changeUmPositionModeRequest = new ChangeUmPositionModeRequest();
        $changeUmPositionModeRequest->setDualSidePosition('');

        $response = $this->getApiMock($request)->changeUmPositionMode($changeUmPositionModeRequest);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/um/positionSide/dual', $request->getUri()->getPath());
        self::assertEquals('bebef105cea3efc7f04654c618d2083229fcfc36b20173f0634e17be5042abd9', $queryMap['signature']);
    }

    /**
     * Test case for cmNotionalAndLeverageBrackets.
     *
     * CM Notional and Leverage Brackets(USER_DATA).
     */
    public function testCmNotionalAndLeverageBrackets()
    {
        $symbol = '';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->cmNotionalAndLeverageBrackets($symbol, $recvWindow);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/cm/leverageBracket', $request->getUri()->getPath());
        self::assertEquals('2cdd1e484bce80021437bee6b762e6a276b1954c3a0c011a16f6f2f6a47aba75', $queryMap['signature']);
    }

    /**
     * Test case for fundAutoCollection.
     *
     * Fund Auto-collection(TRADE).
     */
    public function testFundAutoCollection()
    {
        $fundAutoCollectionRequest = new FundAutoCollectionRequest();

        $response = $this->getApiMock($request)->fundAutoCollection($fundAutoCollectionRequest);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/auto-collection', $request->getUri()->getPath());
        self::assertEquals('dc0def720e795be0f84b02a8fa211ecc3a27dd06ffdbd287a679f1321807f820', $queryMap['signature']);
    }

    /**
     * Test case for fundCollectionByAsset.
     *
     * Fund Collection by Asset(TRADE).
     */
    public function testFundCollectionByAsset()
    {
        $fundCollectionByAssetRequest = new FundCollectionByAssetRequest();
        $fundCollectionByAssetRequest->setAsset('');

        $response = $this->getApiMock($request)->fundCollectionByAsset($fundCollectionByAssetRequest);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/asset-collection', $request->getUri()->getPath());
        self::assertEquals('2979a51ce4c44a35c65db4a87fdd907b27c5f1cb4e786af718af1c6bceff4ce0', $queryMap['signature']);
    }

    /**
     * Test case for getAutoRepayFuturesStatus.
     *
     * Get Auto-repay-futures Status(USER_DATA).
     */
    public function testGetAutoRepayFuturesStatus()
    {
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->getAutoRepayFuturesStatus($recvWindow);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/repay-futures-switch', $request->getUri()->getPath());
        self::assertEquals('2cdd1e484bce80021437bee6b762e6a276b1954c3a0c011a16f6f2f6a47aba75', $queryMap['signature']);
    }

    /**
     * Test case for getCmAccountDetail.
     *
     * Get CM Account Detail(USER_DATA).
     */
    public function testGetCmAccountDetail()
    {
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->getCmAccountDetail($recvWindow);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/cm/account', $request->getUri()->getPath());
        self::assertEquals('2cdd1e484bce80021437bee6b762e6a276b1954c3a0c011a16f6f2f6a47aba75', $queryMap['signature']);
    }

    /**
     * Test case for getCmCurrentPositionMode.
     *
     * Get CM Current Position Mode(USER_DATA).
     */
    public function testGetCmCurrentPositionMode()
    {
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->getCmCurrentPositionMode($recvWindow);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/cm/positionSide/dual', $request->getUri()->getPath());
        self::assertEquals('2cdd1e484bce80021437bee6b762e6a276b1954c3a0c011a16f6f2f6a47aba75', $queryMap['signature']);
    }

    /**
     * Test case for getCmIncomeHistory.
     *
     * Get CM Income History(USER_DATA).
     */
    public function testGetCmIncomeHistory()
    {
        $symbol = '';
        $incomeType = '';
        $startTime = 1623319461670;
        $endTime = 1641782889000;
        $page = null;
        $limit = 100;
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->getCmIncomeHistory($symbol, $incomeType, $startTime, $endTime, $page, $limit, $recvWindow);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/cm/income', $request->getUri()->getPath());
        self::assertEquals('23689f3330f331d9db9c46c9dc87d2217486442f1746adfdda02c10e3dbde13e', $queryMap['signature']);
    }

    /**
     * Test case for getDownloadIdForUmFuturesOrderHistory.
     *
     * Get Download Id For UM Futures Order History (USER_DATA).
     */
    public function testGetDownloadIdForUmFuturesOrderHistory()
    {
        $startTime = 1623319461670;
        $endTime = 1641782889000;
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->getDownloadIdForUmFuturesOrderHistory($startTime, $endTime, $recvWindow);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/um/order/asyn', $request->getUri()->getPath());
        self::assertEquals('812caedbe8f349196a4532c2050ff706ed2569fed185039c7b60a78cd84bc718', $queryMap['signature']);
    }

    /**
     * Test case for getDownloadIdForUmFuturesTradeHistory.
     *
     * Get Download Id For UM Futures Trade History (USER_DATA).
     */
    public function testGetDownloadIdForUmFuturesTradeHistory()
    {
        $startTime = 1623319461670;
        $endTime = 1641782889000;
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->getDownloadIdForUmFuturesTradeHistory($startTime, $endTime, $recvWindow);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/um/trade/asyn', $request->getUri()->getPath());
        self::assertEquals('812caedbe8f349196a4532c2050ff706ed2569fed185039c7b60a78cd84bc718', $queryMap['signature']);
    }

    /**
     * Test case for getDownloadIdForUmFuturesTransactionHistory.
     *
     * Get Download Id For UM Futures Transaction History (USER_DATA).
     */
    public function testGetDownloadIdForUmFuturesTransactionHistory()
    {
        $startTime = 1623319461670;
        $endTime = 1641782889000;
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->getDownloadIdForUmFuturesTransactionHistory($startTime, $endTime, $recvWindow);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/um/income/asyn', $request->getUri()->getPath());
        self::assertEquals('812caedbe8f349196a4532c2050ff706ed2569fed185039c7b60a78cd84bc718', $queryMap['signature']);
    }

    /**
     * Test case for getMarginBorrowLoanInterestHistory.
     *
     * Get Margin Borrow/Loan Interest History(USER_DATA).
     */
    public function testGetMarginBorrowLoanInterestHistory()
    {
        $asset = '';
        $startTime = 1623319461670;
        $endTime = 1641782889000;
        $current = 1;
        $size = 10;
        $archived = '';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->getMarginBorrowLoanInterestHistory($asset, $startTime, $endTime, $current, $size, $archived, $recvWindow);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/margin/marginInterestHistory', $request->getUri()->getPath());
        self::assertEquals('2ecc0415a3bdb2963e8030cdf6cf00de6f49d21b71ff939dda42e5756eb8ba66', $queryMap['signature']);
    }

    /**
     * Test case for getUmAccountDetail.
     *
     * Get UM Account Detail(USER_DATA).
     */
    public function testGetUmAccountDetail()
    {
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->getUmAccountDetail($recvWindow);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/um/account', $request->getUri()->getPath());
        self::assertEquals('2cdd1e484bce80021437bee6b762e6a276b1954c3a0c011a16f6f2f6a47aba75', $queryMap['signature']);
    }

    /**
     * Test case for getUmAccountDetailV2.
     *
     * Get UM Account Detail V2(USER_DATA).
     */
    public function testGetUmAccountDetailV2()
    {
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->getUmAccountDetailV2($recvWindow);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v2/um/account', $request->getUri()->getPath());
        self::assertEquals('2cdd1e484bce80021437bee6b762e6a276b1954c3a0c011a16f6f2f6a47aba75', $queryMap['signature']);
    }

    /**
     * Test case for getUmCurrentPositionMode.
     *
     * Get UM Current Position Mode(USER_DATA).
     */
    public function testGetUmCurrentPositionMode()
    {
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->getUmCurrentPositionMode($recvWindow);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/um/positionSide/dual', $request->getUri()->getPath());
        self::assertEquals('2cdd1e484bce80021437bee6b762e6a276b1954c3a0c011a16f6f2f6a47aba75', $queryMap['signature']);
    }

    /**
     * Test case for getUmFuturesOrderDownloadLinkById.
     *
     * Get UM Futures Order Download Link by Id(USER_DATA).
     */
    public function testGetUmFuturesOrderDownloadLinkById()
    {
        $downloadId = '1';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->getUmFuturesOrderDownloadLinkById($downloadId, $recvWindow);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/um/order/asyn/id', $request->getUri()->getPath());
        self::assertEquals('4947fe463a17e3ec0b50fc22b21afc2aafddf3da892fa0c8dfd1b9c50af87349', $queryMap['signature']);
    }

    /**
     * Test case for getUmFuturesTradeDownloadLinkById.
     *
     * Get UM Futures Trade Download Link by Id(USER_DATA).
     */
    public function testGetUmFuturesTradeDownloadLinkById()
    {
        $downloadId = '1';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->getUmFuturesTradeDownloadLinkById($downloadId, $recvWindow);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/um/trade/asyn/id', $request->getUri()->getPath());
        self::assertEquals('4947fe463a17e3ec0b50fc22b21afc2aafddf3da892fa0c8dfd1b9c50af87349', $queryMap['signature']);
    }

    /**
     * Test case for getUmFuturesTransactionDownloadLinkById.
     *
     * Get UM Futures Transaction Download Link by Id(USER_DATA).
     */
    public function testGetUmFuturesTransactionDownloadLinkById()
    {
        $downloadId = '1';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->getUmFuturesTransactionDownloadLinkById($downloadId, $recvWindow);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/um/income/asyn/id', $request->getUri()->getPath());
        self::assertEquals('4947fe463a17e3ec0b50fc22b21afc2aafddf3da892fa0c8dfd1b9c50af87349', $queryMap['signature']);
    }

    /**
     * Test case for getUmIncomeHistory.
     *
     * Get UM Income History(USER_DATA).
     */
    public function testGetUmIncomeHistory()
    {
        $symbol = '';
        $incomeType = '';
        $startTime = 1623319461670;
        $endTime = 1641782889000;
        $page = null;
        $limit = 100;
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->getUmIncomeHistory($symbol, $incomeType, $startTime, $endTime, $page, $limit, $recvWindow);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/um/income', $request->getUri()->getPath());
        self::assertEquals('23689f3330f331d9db9c46c9dc87d2217486442f1746adfdda02c10e3dbde13e', $queryMap['signature']);
    }

    /**
     * Test case for getUserCommissionRateForCm.
     *
     * Get User Commission Rate for CM(USER_DATA).
     */
    public function testGetUserCommissionRateForCm()
    {
        $symbol = '';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->getUserCommissionRateForCm($symbol, $recvWindow);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/cm/commissionRate', $request->getUri()->getPath());
        self::assertEquals('db1a455af0a2e82b4ec79595d994eb2e7f6b8a93c91a67a2aa59e2b2eae4bc68', $queryMap['signature']);
    }

    /**
     * Test case for getUserCommissionRateForUm.
     *
     * Get User Commission Rate for UM(USER_DATA).
     */
    public function testGetUserCommissionRateForUm()
    {
        $symbol = '';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->getUserCommissionRateForUm($symbol, $recvWindow);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/um/commissionRate', $request->getUri()->getPath());
        self::assertEquals('db1a455af0a2e82b4ec79595d994eb2e7f6b8a93c91a67a2aa59e2b2eae4bc68', $queryMap['signature']);
    }

    /**
     * Test case for marginMaxBorrow.
     *
     * Margin Max Borrow(USER_DATA).
     */
    public function testMarginMaxBorrow()
    {
        $asset = '';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->marginMaxBorrow($asset, $recvWindow);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/margin/maxBorrowable', $request->getUri()->getPath());
        self::assertEquals('a8610b861691761550acea81c71e6fe676ac39bd2020c66ff1115710eaf265a4', $queryMap['signature']);
    }

    /**
     * Test case for portfolioMarginUmTradingQuantitativeRulesIndicators.
     *
     * Portfolio Margin UM Trading Quantitative Rules Indicators(USER_DATA).
     */
    public function testPortfolioMarginUmTradingQuantitativeRulesIndicators()
    {
        $symbol = '';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->portfolioMarginUmTradingQuantitativeRulesIndicators($symbol, $recvWindow);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/um/apiTradingStatus', $request->getUri()->getPath());
        self::assertEquals('2cdd1e484bce80021437bee6b762e6a276b1954c3a0c011a16f6f2f6a47aba75', $queryMap['signature']);
    }

    /**
     * Test case for queryCmPositionInformation.
     *
     * Query CM Position Information(USER_DATA).
     */
    public function testQueryCmPositionInformation()
    {
        $marginAsset = '';
        $pair = '';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->queryCmPositionInformation($marginAsset, $pair, $recvWindow);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/cm/positionRisk', $request->getUri()->getPath());
        self::assertEquals('2cdd1e484bce80021437bee6b762e6a276b1954c3a0c011a16f6f2f6a47aba75', $queryMap['signature']);
    }

    /**
     * Test case for queryMarginLoanRecord.
     *
     * Query Margin Loan Record(USER_DATA).
     */
    public function testQueryMarginLoanRecord()
    {
        $asset = '';
        $txId = 1;
        $startTime = 1623319461670;
        $endTime = 1641782889000;
        $current = 1;
        $size = 10;
        $archived = '';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->queryMarginLoanRecord($asset, $txId, $startTime, $endTime, $current, $size, $archived, $recvWindow);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/margin/marginLoan', $request->getUri()->getPath());
        self::assertEquals('59f0f04efabbb0c09c2340ad8cbecf5e7ed32f5186090bad45d13bb148e0c472', $queryMap['signature']);
    }

    /**
     * Test case for queryMarginMaxWithdraw.
     *
     * Query Margin Max Withdraw(USER_DATA).
     */
    public function testQueryMarginMaxWithdraw()
    {
        $asset = '';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->queryMarginMaxWithdraw($asset, $recvWindow);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/margin/maxWithdraw', $request->getUri()->getPath());
        self::assertEquals('a8610b861691761550acea81c71e6fe676ac39bd2020c66ff1115710eaf265a4', $queryMap['signature']);
    }

    /**
     * Test case for queryMarginRepayRecord.
     *
     * Query Margin repay Record(USER_DATA).
     */
    public function testQueryMarginRepayRecord()
    {
        $asset = '';
        $txId = 1;
        $startTime = 1623319461670;
        $endTime = 1641782889000;
        $current = 1;
        $size = 10;
        $archived = '';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->queryMarginRepayRecord($asset, $txId, $startTime, $endTime, $current, $size, $archived, $recvWindow);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/margin/repayLoan', $request->getUri()->getPath());
        self::assertEquals('59f0f04efabbb0c09c2340ad8cbecf5e7ed32f5186090bad45d13bb148e0c472', $queryMap['signature']);
    }

    /**
     * Test case for queryPortfolioMarginNegativeBalanceInterestHistory.
     *
     * Query Portfolio Margin Negative Balance Interest History(USER_DATA).
     */
    public function testQueryPortfolioMarginNegativeBalanceInterestHistory()
    {
        $asset = '';
        $startTime = 1623319461670;
        $endTime = 1641782889000;
        $size = 10;
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->queryPortfolioMarginNegativeBalanceInterestHistory($asset, $startTime, $endTime, $size, $recvWindow);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/portfolio/interest-history', $request->getUri()->getPath());
        self::assertEquals('61a296b6ab8d4cc785e344506d988c939cdbed5c43f133c27db572231eaac2e1', $queryMap['signature']);
    }

    /**
     * Test case for queryUmPositionInformation.
     *
     * Query UM Position Information(USER_DATA).
     */
    public function testQueryUmPositionInformation()
    {
        $symbol = '';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->queryUmPositionInformation($symbol, $recvWindow);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/um/positionRisk', $request->getUri()->getPath());
        self::assertEquals('2cdd1e484bce80021437bee6b762e6a276b1954c3a0c011a16f6f2f6a47aba75', $queryMap['signature']);
    }

    /**
     * Test case for queryUserNegativeBalanceAutoExchangeRecord.
     *
     * Query User Negative Balance Auto Exchange Record (USER_DATA).
     */
    public function testQueryUserNegativeBalanceAutoExchangeRecord()
    {
        $startTime = 1623319461670;
        $endTime = 1641782889000;
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->queryUserNegativeBalanceAutoExchangeRecord($startTime, $endTime, $recvWindow);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/portfolio/negative-balance-exchange-record', $request->getUri()->getPath());
        self::assertEquals('812caedbe8f349196a4532c2050ff706ed2569fed185039c7b60a78cd84bc718', $queryMap['signature']);
    }

    /**
     * Test case for queryUserRateLimit.
     *
     * Query User Rate Limit (USER_DATA).
     */
    public function testQueryUserRateLimit()
    {
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->queryUserRateLimit($recvWindow);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/rateLimit/order', $request->getUri()->getPath());
        self::assertEquals('2cdd1e484bce80021437bee6b762e6a276b1954c3a0c011a16f6f2f6a47aba75', $queryMap['signature']);
    }

    /**
     * Test case for repayFuturesNegativeBalance.
     *
     * Repay futures Negative Balance(USER_DATA).
     */
    public function testRepayFuturesNegativeBalance()
    {
        $repayFuturesNegativeBalanceRequest = new RepayFuturesNegativeBalanceRequest();

        $response = $this->getApiMock($request)->repayFuturesNegativeBalance($repayFuturesNegativeBalanceRequest);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/repay-futures-negative-balance', $request->getUri()->getPath());
        self::assertEquals('dc0def720e795be0f84b02a8fa211ecc3a27dd06ffdbd287a679f1321807f820', $queryMap['signature']);
    }

    /**
     * Test case for umFuturesAccountConfiguration.
     *
     * UM Futures Account Configuration(USER_DATA).
     */
    public function testUmFuturesAccountConfiguration()
    {
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->umFuturesAccountConfiguration($recvWindow);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/um/accountConfig', $request->getUri()->getPath());
        self::assertEquals('2cdd1e484bce80021437bee6b762e6a276b1954c3a0c011a16f6f2f6a47aba75', $queryMap['signature']);
    }

    /**
     * Test case for umFuturesSymbolConfiguration.
     *
     * UM Futures Symbol Configuration(USER_DATA).
     */
    public function testUmFuturesSymbolConfiguration()
    {
        $symbol = '';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->umFuturesSymbolConfiguration($symbol, $recvWindow);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/um/symbolConfig', $request->getUri()->getPath());
        self::assertEquals('2cdd1e484bce80021437bee6b762e6a276b1954c3a0c011a16f6f2f6a47aba75', $queryMap['signature']);
    }

    /**
     * Test case for umNotionalAndLeverageBrackets.
     *
     * UM Notional and Leverage Brackets (USER_DATA).
     */
    public function testUmNotionalAndLeverageBrackets()
    {
        $symbol = '';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->umNotionalAndLeverageBrackets($symbol, $recvWindow);

        parse_str($request->getUri(), $queryMap);

        self::assertEquals(200, $response->getStatusCode());
        self::assertEquals('/papi/v1/um/leverageBracket', $request->getUri()->getPath());
        self::assertEquals('2cdd1e484bce80021437bee6b762e6a276b1954c3a0c011a16f6f2f6a47aba75', $queryMap['signature']);
    }
}
