<?php

/**
 * TradeApiTest
 * 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\TradeApi;
use Binance\Client\DerivativesTradingPortfolioMargin\Model\AutoCloseType;
use Binance\Client\DerivativesTradingPortfolioMargin\Model\MarginAccountBorrowRequest;
use Binance\Client\DerivativesTradingPortfolioMargin\Model\MarginAccountNewOcoRequest;
use Binance\Client\DerivativesTradingPortfolioMargin\Model\MarginAccountRepayDebtRequest;
use Binance\Client\DerivativesTradingPortfolioMargin\Model\MarginAccountRepayRequest;
use Binance\Client\DerivativesTradingPortfolioMargin\Model\ModifyCmOrderRequest;
use Binance\Client\DerivativesTradingPortfolioMargin\Model\ModifyUmOrderRequest;
use Binance\Client\DerivativesTradingPortfolioMargin\Model\NewCmConditionalOrderRequest;
use Binance\Client\DerivativesTradingPortfolioMargin\Model\NewCmOrderRequest;
use Binance\Client\DerivativesTradingPortfolioMargin\Model\NewMarginOrderRequest;
use Binance\Client\DerivativesTradingPortfolioMargin\Model\NewUmConditionalOrderRequest;
use Binance\Client\DerivativesTradingPortfolioMargin\Model\NewUmOrderRequest;
use Binance\Client\DerivativesTradingPortfolioMargin\Model\Side;
use Binance\Client\DerivativesTradingPortfolioMargin\Model\StrategyType;
use Binance\Client\DerivativesTradingPortfolioMargin\Model\ToggleBnbBurnOnUmFuturesTradeRequest;
use Binance\Client\DerivativesTradingPortfolioMargin\Model\Type;
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;

/**
 * TradeApiTest Class Doc Comment.
 *
 * @category Class
 *
 * @author   OpenAPI Generator team
 *
 * @see     https://openapi-generator.tech
 *
 * @internal
 *
 * @coversNothing
 */
class TradeApiTest 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(TradeApi::class)
            ->setConstructorArgs([$clientConfig, $clientMock])
            ->onlyMethods(['getTimestamp'])
            ->getMock()
        ;

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

        return $apiMock;
    }

    /**
     * Test case for cancelAllCmOpenConditionalOrders.
     *
     * Cancel All CM Open Conditional Orders(TRADE).
     */
    public function testCancelAllCmOpenConditionalOrders()
    {
        $symbol = '';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->cancelAllCmOpenConditionalOrders($symbol, $recvWindow);

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

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

    /**
     * Test case for cancelAllCmOpenOrders.
     *
     * Cancel All CM Open Orders(TRADE).
     */
    public function testCancelAllCmOpenOrders()
    {
        $symbol = '';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->cancelAllCmOpenOrders($symbol, $recvWindow);

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

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

    /**
     * Test case for cancelAllUmOpenConditionalOrders.
     *
     * Cancel All UM Open Conditional Orders (TRADE).
     */
    public function testCancelAllUmOpenConditionalOrders()
    {
        $symbol = '';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->cancelAllUmOpenConditionalOrders($symbol, $recvWindow);

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

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

    /**
     * Test case for cancelAllUmOpenOrders.
     *
     * Cancel All UM Open Orders(TRADE).
     */
    public function testCancelAllUmOpenOrders()
    {
        $symbol = '';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->cancelAllUmOpenOrders($symbol, $recvWindow);

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

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

    /**
     * Test case for cancelCmConditionalOrder.
     *
     * Cancel CM Conditional Order(TRADE).
     */
    public function testCancelCmConditionalOrder()
    {
        $symbol = '';
        $strategyId = 1;
        $newClientStrategyId = '1';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->cancelCmConditionalOrder($symbol, $strategyId, $newClientStrategyId, $recvWindow);

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

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

    /**
     * Test case for cancelCmOrder.
     *
     * Cancel CM Order(TRADE).
     */
    public function testCancelCmOrder()
    {
        $symbol = '';
        $orderId = 1;
        $origClientOrderId = '1';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->cancelCmOrder($symbol, $orderId, $origClientOrderId, $recvWindow);

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

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

    /**
     * Test case for cancelMarginAccountAllOpenOrdersOnASymbol.
     *
     * Cancel Margin Account All Open Orders on a Symbol(TRADE).
     */
    public function testCancelMarginAccountAllOpenOrdersOnASymbol()
    {
        $symbol = '';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->cancelMarginAccountAllOpenOrdersOnASymbol($symbol, $recvWindow);

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

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

    /**
     * Test case for cancelMarginAccountOcoOrders.
     *
     * Cancel Margin Account OCO Orders(TRADE).
     */
    public function testCancelMarginAccountOcoOrders()
    {
        $symbol = '';
        $orderListId = 1;
        $listClientOrderId = '1';
        $newClientOrderId = '1';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->cancelMarginAccountOcoOrders($symbol, $orderListId, $listClientOrderId, $newClientOrderId, $recvWindow);

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

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

    /**
     * Test case for cancelMarginAccountOrder.
     *
     * Cancel Margin Account Order(TRADE).
     */
    public function testCancelMarginAccountOrder()
    {
        $symbol = '';
        $orderId = 1;
        $origClientOrderId = '1';
        $newClientOrderId = '1';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->cancelMarginAccountOrder($symbol, $orderId, $origClientOrderId, $newClientOrderId, $recvWindow);

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

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

    /**
     * Test case for cancelUmConditionalOrder.
     *
     * Cancel UM Conditional Order(TRADE).
     */
    public function testCancelUmConditionalOrder()
    {
        $symbol = '';
        $strategyId = 1;
        $newClientStrategyId = '1';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->cancelUmConditionalOrder($symbol, $strategyId, $newClientStrategyId, $recvWindow);

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

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

    /**
     * Test case for cancelUmOrder.
     *
     * Cancel UM Order(TRADE).
     */
    public function testCancelUmOrder()
    {
        $symbol = '';
        $orderId = 1;
        $origClientOrderId = '1';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->cancelUmOrder($symbol, $orderId, $origClientOrderId, $recvWindow);

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

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

    /**
     * Test case for cmAccountTradeList.
     *
     * CM Account Trade List(USER_DATA).
     */
    public function testCmAccountTradeList()
    {
        $symbol = '';
        $pair = '';
        $startTime = 1623319461670;
        $endTime = 1641782889000;
        $fromId = 1;
        $limit = 100;
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->cmAccountTradeList($symbol, $pair, $startTime, $endTime, $fromId, $limit, $recvWindow);

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

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

    /**
     * Test case for cmPositionAdlQuantileEstimation.
     *
     * CM Position ADL Quantile Estimation(USER_DATA).
     */
    public function testCmPositionAdlQuantileEstimation()
    {
        $symbol = '';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->cmPositionAdlQuantileEstimation($symbol, $recvWindow);

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

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

    /**
     * Test case for getUmFuturesBnbBurnStatus.
     *
     * Get UM Futures BNB Burn Status (USER_DATA).
     */
    public function testGetUmFuturesBnbBurnStatus()
    {
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->getUmFuturesBnbBurnStatus($recvWindow);

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

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

    /**
     * Test case for marginAccountBorrow.
     *
     * Margin Account Borrow(MARGIN).
     */
    public function testMarginAccountBorrow()
    {
        $marginAccountBorrowRequest = new MarginAccountBorrowRequest();
        $marginAccountBorrowRequest->setAsset('');
        $marginAccountBorrowRequest->setAmount(1.0);

        $response = $this->getApiMock($request)->marginAccountBorrow($marginAccountBorrowRequest);

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

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

    /**
     * Test case for marginAccountNewOco.
     *
     * Margin Account New OCO(TRADE).
     */
    public function testMarginAccountNewOco()
    {
        $marginAccountNewOcoRequest = new MarginAccountNewOcoRequest();
        $marginAccountNewOcoRequest->setSymbol('');
        $marginAccountNewOcoRequest->setSide(Side::BUY);
        $marginAccountNewOcoRequest->setQuantity(1.0);
        $marginAccountNewOcoRequest->setPrice(1.0);
        $marginAccountNewOcoRequest->setStopPrice(1.0);

        $response = $this->getApiMock($request)->marginAccountNewOco($marginAccountNewOcoRequest);

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

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

    /**
     * Test case for marginAccountRepay.
     *
     * Margin Account Repay(MARGIN).
     */
    public function testMarginAccountRepay()
    {
        $marginAccountRepayRequest = new MarginAccountRepayRequest();
        $marginAccountRepayRequest->setAsset('');
        $marginAccountRepayRequest->setAmount(1.0);

        $response = $this->getApiMock($request)->marginAccountRepay($marginAccountRepayRequest);

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

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

    /**
     * Test case for marginAccountRepayDebt.
     *
     * Margin Account Repay Debt(TRADE).
     */
    public function testMarginAccountRepayDebt()
    {
        $marginAccountRepayDebtRequest = new MarginAccountRepayDebtRequest();
        $marginAccountRepayDebtRequest->setAsset('');

        $response = $this->getApiMock($request)->marginAccountRepayDebt($marginAccountRepayDebtRequest);

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

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

    /**
     * Test case for marginAccountTradeList.
     *
     * Margin Account Trade List (USER_DATA).
     */
    public function testMarginAccountTradeList()
    {
        $symbol = '';
        $orderId = 1;
        $startTime = 1623319461670;
        $endTime = 1641782889000;
        $fromId = 1;
        $limit = 100;
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->marginAccountTradeList($symbol, $orderId, $startTime, $endTime, $fromId, $limit, $recvWindow);

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

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

    /**
     * Test case for modifyCmOrder.
     *
     * Modify CM Order(TRADE).
     */
    public function testModifyCmOrder()
    {
        $modifyCmOrderRequest = new ModifyCmOrderRequest();
        $modifyCmOrderRequest->setSymbol('');
        $modifyCmOrderRequest->setSide(Side::BUY);
        $modifyCmOrderRequest->setQuantity(1.0);
        $modifyCmOrderRequest->setPrice(1.0);

        $response = $this->getApiMock($request)->modifyCmOrder($modifyCmOrderRequest);

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

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

    /**
     * Test case for modifyUmOrder.
     *
     * Modify UM Order(TRADE).
     */
    public function testModifyUmOrder()
    {
        $modifyUmOrderRequest = new ModifyUmOrderRequest();
        $modifyUmOrderRequest->setSymbol('');
        $modifyUmOrderRequest->setSide(Side::BUY);
        $modifyUmOrderRequest->setQuantity(1.0);
        $modifyUmOrderRequest->setPrice(1.0);

        $response = $this->getApiMock($request)->modifyUmOrder($modifyUmOrderRequest);

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

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

    /**
     * Test case for newCmConditionalOrder.
     *
     * New CM Conditional Order(TRADE).
     */
    public function testNewCmConditionalOrder()
    {
        $newCmConditionalOrderRequest = new NewCmConditionalOrderRequest();
        $newCmConditionalOrderRequest->setSymbol('');
        $newCmConditionalOrderRequest->setSide(Side::BUY);
        $newCmConditionalOrderRequest->setStrategyType(StrategyType::STOP);

        $response = $this->getApiMock($request)->newCmConditionalOrder($newCmConditionalOrderRequest);

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

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

    /**
     * Test case for newCmOrder.
     *
     * New CM Order(TRADE).
     */
    public function testNewCmOrder()
    {
        $newCmOrderRequest = new NewCmOrderRequest();
        $newCmOrderRequest->setSymbol('');
        $newCmOrderRequest->setSide(Side::BUY);
        $newCmOrderRequest->setType(Type::LIMIT);

        $response = $this->getApiMock($request)->newCmOrder($newCmOrderRequest);

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

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

    /**
     * Test case for newMarginOrder.
     *
     * New Margin Order(TRADE).
     */
    public function testNewMarginOrder()
    {
        $newMarginOrderRequest = new NewMarginOrderRequest();
        $newMarginOrderRequest->setSymbol('');
        $newMarginOrderRequest->setSide(Side::BUY);
        $newMarginOrderRequest->setType(Type::LIMIT);

        $response = $this->getApiMock($request)->newMarginOrder($newMarginOrderRequest);

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

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

    /**
     * Test case for newUmConditionalOrder.
     *
     * New UM Conditional Order (TRADE).
     */
    public function testNewUmConditionalOrder()
    {
        $newUmConditionalOrderRequest = new NewUmConditionalOrderRequest();
        $newUmConditionalOrderRequest->setSymbol('');
        $newUmConditionalOrderRequest->setSide(Side::BUY);
        $newUmConditionalOrderRequest->setStrategyType(StrategyType::STOP);

        $response = $this->getApiMock($request)->newUmConditionalOrder($newUmConditionalOrderRequest);

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

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

    /**
     * Test case for newUmOrder.
     *
     * New UM Order (TRADE).
     */
    public function testNewUmOrder()
    {
        $newUmOrderRequest = new NewUmOrderRequest();
        $newUmOrderRequest->setSymbol('');
        $newUmOrderRequest->setSide(Side::BUY);
        $newUmOrderRequest->setType(Type::LIMIT);

        $response = $this->getApiMock($request)->newUmOrder($newUmOrderRequest);

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

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

    /**
     * Test case for queryAllCmConditionalOrders.
     *
     * Query All CM Conditional Orders(USER_DATA).
     */
    public function testQueryAllCmConditionalOrders()
    {
        $symbol = '';
        $strategyId = 1;
        $startTime = 1623319461670;
        $endTime = 1641782889000;
        $limit = 100;
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->queryAllCmConditionalOrders($symbol, $strategyId, $startTime, $endTime, $limit, $recvWindow);

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

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

    /**
     * Test case for queryAllCmOrders.
     *
     * Query All CM Orders (USER_DATA).
     */
    public function testQueryAllCmOrders()
    {
        $symbol = '';
        $pair = '';
        $orderId = 1;
        $startTime = 1623319461670;
        $endTime = 1641782889000;
        $limit = 100;
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->queryAllCmOrders($symbol, $pair, $orderId, $startTime, $endTime, $limit, $recvWindow);

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

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

    /**
     * Test case for queryAllCurrentCmOpenConditionalOrders.
     *
     * Query All Current CM Open Conditional Orders (USER_DATA).
     */
    public function testQueryAllCurrentCmOpenConditionalOrders()
    {
        $symbol = '';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->queryAllCurrentCmOpenConditionalOrders($symbol, $recvWindow);

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

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

    /**
     * Test case for queryAllCurrentCmOpenOrders.
     *
     * Query All Current CM Open Orders(USER_DATA).
     */
    public function testQueryAllCurrentCmOpenOrders()
    {
        $symbol = '';
        $pair = '';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->queryAllCurrentCmOpenOrders($symbol, $pair, $recvWindow);

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

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

    /**
     * Test case for queryAllCurrentUmOpenConditionalOrders.
     *
     * Query All Current UM Open Conditional Orders(USER_DATA).
     */
    public function testQueryAllCurrentUmOpenConditionalOrders()
    {
        $symbol = '';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->queryAllCurrentUmOpenConditionalOrders($symbol, $recvWindow);

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

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

    /**
     * Test case for queryAllCurrentUmOpenOrders.
     *
     * Query All Current UM Open Orders(USER_DATA).
     */
    public function testQueryAllCurrentUmOpenOrders()
    {
        $symbol = '';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->queryAllCurrentUmOpenOrders($symbol, $recvWindow);

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

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

    /**
     * Test case for queryAllMarginAccountOrders.
     *
     * Query All Margin Account Orders (USER_DATA).
     */
    public function testQueryAllMarginAccountOrders()
    {
        $symbol = '';
        $orderId = 1;
        $startTime = 1623319461670;
        $endTime = 1641782889000;
        $limit = 100;
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->queryAllMarginAccountOrders($symbol, $orderId, $startTime, $endTime, $limit, $recvWindow);

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

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

    /**
     * Test case for queryAllUmConditionalOrders.
     *
     * Query All UM Conditional Orders(USER_DATA).
     */
    public function testQueryAllUmConditionalOrders()
    {
        $symbol = '';
        $strategyId = 1;
        $startTime = 1623319461670;
        $endTime = 1641782889000;
        $limit = 100;
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->queryAllUmConditionalOrders($symbol, $strategyId, $startTime, $endTime, $limit, $recvWindow);

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

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

    /**
     * Test case for queryAllUmOrders.
     *
     * Query All UM Orders(USER_DATA).
     */
    public function testQueryAllUmOrders()
    {
        $symbol = '';
        $orderId = 1;
        $startTime = 1623319461670;
        $endTime = 1641782889000;
        $limit = 100;
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->queryAllUmOrders($symbol, $orderId, $startTime, $endTime, $limit, $recvWindow);

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

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

    /**
     * Test case for queryCmConditionalOrderHistory.
     *
     * Query CM Conditional Order History(USER_DATA).
     */
    public function testQueryCmConditionalOrderHistory()
    {
        $symbol = '';
        $strategyId = 1;
        $newClientStrategyId = '1';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->queryCmConditionalOrderHistory($symbol, $strategyId, $newClientStrategyId, $recvWindow);

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

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

    /**
     * Test case for queryCmModifyOrderHistory.
     *
     * Query CM Modify Order History(TRADE).
     */
    public function testQueryCmModifyOrderHistory()
    {
        $symbol = '';
        $orderId = 1;
        $origClientOrderId = '1';
        $startTime = 1623319461670;
        $endTime = 1641782889000;
        $limit = 100;
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->queryCmModifyOrderHistory($symbol, $orderId, $origClientOrderId, $startTime, $endTime, $limit, $recvWindow);

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

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

    /**
     * Test case for queryCmOrder.
     *
     * Query CM Order(USER_DATA).
     */
    public function testQueryCmOrder()
    {
        $symbol = '';
        $orderId = 1;
        $origClientOrderId = '1';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->queryCmOrder($symbol, $orderId, $origClientOrderId, $recvWindow);

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

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

    /**
     * Test case for queryCurrentCmOpenConditionalOrder.
     *
     * Query Current CM Open Conditional Order(USER_DATA).
     */
    public function testQueryCurrentCmOpenConditionalOrder()
    {
        $symbol = '';
        $strategyId = 1;
        $newClientStrategyId = '1';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->queryCurrentCmOpenConditionalOrder($symbol, $strategyId, $newClientStrategyId, $recvWindow);

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

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

    /**
     * Test case for queryCurrentCmOpenOrder.
     *
     * Query Current CM Open Order (USER_DATA).
     */
    public function testQueryCurrentCmOpenOrder()
    {
        $symbol = '';
        $orderId = 1;
        $origClientOrderId = '1';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->queryCurrentCmOpenOrder($symbol, $orderId, $origClientOrderId, $recvWindow);

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

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

    /**
     * Test case for queryCurrentMarginOpenOrder.
     *
     * Query Current Margin Open Order (USER_DATA).
     */
    public function testQueryCurrentMarginOpenOrder()
    {
        $symbol = '';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->queryCurrentMarginOpenOrder($symbol, $recvWindow);

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

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

    /**
     * Test case for queryCurrentUmOpenConditionalOrder.
     *
     * Query Current UM Open Conditional Order(USER_DATA).
     */
    public function testQueryCurrentUmOpenConditionalOrder()
    {
        $symbol = '';
        $strategyId = 1;
        $newClientStrategyId = '1';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->queryCurrentUmOpenConditionalOrder($symbol, $strategyId, $newClientStrategyId, $recvWindow);

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

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

    /**
     * Test case for queryCurrentUmOpenOrder.
     *
     * Query Current UM Open Order(USER_DATA).
     */
    public function testQueryCurrentUmOpenOrder()
    {
        $symbol = '';
        $orderId = 1;
        $origClientOrderId = '1';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->queryCurrentUmOpenOrder($symbol, $orderId, $origClientOrderId, $recvWindow);

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

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

    /**
     * Test case for queryMarginAccountOrder.
     *
     * Query Margin Account Order (USER_DATA).
     */
    public function testQueryMarginAccountOrder()
    {
        $symbol = '';
        $orderId = 1;
        $origClientOrderId = '1';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->queryMarginAccountOrder($symbol, $orderId, $origClientOrderId, $recvWindow);

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

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

    /**
     * Test case for queryMarginAccountsAllOco.
     *
     * Query Margin Account's all OCO (USER_DATA).
     */
    public function testQueryMarginAccountsAllOco()
    {
        $fromId = 1;
        $startTime = 1623319461670;
        $endTime = 1641782889000;
        $limit = 100;
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->queryMarginAccountsAllOco($fromId, $startTime, $endTime, $limit, $recvWindow);

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

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

    /**
     * Test case for queryMarginAccountsOco.
     *
     * Query Margin Account's OCO (USER_DATA).
     */
    public function testQueryMarginAccountsOco()
    {
        $orderListId = 1;
        $origClientOrderId = '1';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->queryMarginAccountsOco($orderListId, $origClientOrderId, $recvWindow);

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

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

    /**
     * Test case for queryMarginAccountsOpenOco.
     *
     * Query Margin Account's Open OCO (USER_DATA).
     */
    public function testQueryMarginAccountsOpenOco()
    {
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->queryMarginAccountsOpenOco($recvWindow);

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

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

    /**
     * Test case for queryUmConditionalOrderHistory.
     *
     * Query UM Conditional Order History(USER_DATA).
     */
    public function testQueryUmConditionalOrderHistory()
    {
        $symbol = '';
        $strategyId = 1;
        $newClientStrategyId = '1';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->queryUmConditionalOrderHistory($symbol, $strategyId, $newClientStrategyId, $recvWindow);

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

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

    /**
     * Test case for queryUmModifyOrderHistory.
     *
     * Query UM Modify Order History(TRADE).
     */
    public function testQueryUmModifyOrderHistory()
    {
        $symbol = '';
        $orderId = 1;
        $origClientOrderId = '1';
        $startTime = 1623319461670;
        $endTime = 1641782889000;
        $limit = 100;
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->queryUmModifyOrderHistory($symbol, $orderId, $origClientOrderId, $startTime, $endTime, $limit, $recvWindow);

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

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

    /**
     * Test case for queryUmOrder.
     *
     * Query UM Order (USER_DATA).
     */
    public function testQueryUmOrder()
    {
        $symbol = '';
        $orderId = 1;
        $origClientOrderId = '1';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->queryUmOrder($symbol, $orderId, $origClientOrderId, $recvWindow);

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

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

    /**
     * Test case for queryUsersCmForceOrders.
     *
     * Query User's CM Force Orders(USER_DATA).
     */
    public function testQueryUsersCmForceOrders()
    {
        $symbol = '';
        $autoCloseType = AutoCloseType::LIQUIDATION;
        $startTime = 1623319461670;
        $endTime = 1641782889000;
        $limit = 100;
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->queryUsersCmForceOrders($symbol, $autoCloseType, $startTime, $endTime, $limit, $recvWindow);

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

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

    /**
     * Test case for queryUsersMarginForceOrders.
     *
     * Query User's Margin Force Orders(USER_DATA).
     */
    public function testQueryUsersMarginForceOrders()
    {
        $startTime = 1623319461670;
        $endTime = 1641782889000;
        $current = 1;
        $size = 10;
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->queryUsersMarginForceOrders($startTime, $endTime, $current, $size, $recvWindow);

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

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

    /**
     * Test case for queryUsersUmForceOrders.
     *
     * Query User's UM Force Orders (USER_DATA).
     */
    public function testQueryUsersUmForceOrders()
    {
        $symbol = '';
        $autoCloseType = AutoCloseType::LIQUIDATION;
        $startTime = 1623319461670;
        $endTime = 1641782889000;
        $limit = 100;
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->queryUsersUmForceOrders($symbol, $autoCloseType, $startTime, $endTime, $limit, $recvWindow);

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

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

    /**
     * Test case for toggleBnbBurnOnUmFuturesTrade.
     *
     * Toggle BNB Burn On UM Futures Trade (TRADE).
     */
    public function testToggleBnbBurnOnUmFuturesTrade()
    {
        $toggleBnbBurnOnUmFuturesTradeRequest = new ToggleBnbBurnOnUmFuturesTradeRequest();
        $toggleBnbBurnOnUmFuturesTradeRequest->setFeeBurn('');

        $response = $this->getApiMock($request)->toggleBnbBurnOnUmFuturesTrade($toggleBnbBurnOnUmFuturesTradeRequest);

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

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

    /**
     * Test case for umAccountTradeList.
     *
     * UM Account Trade List(USER_DATA).
     */
    public function testUmAccountTradeList()
    {
        $symbol = '';
        $startTime = 1623319461670;
        $endTime = 1641782889000;
        $fromId = 1;
        $limit = 100;
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->umAccountTradeList($symbol, $startTime, $endTime, $fromId, $limit, $recvWindow);

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

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

    /**
     * Test case for umPositionAdlQuantileEstimation.
     *
     * UM Position ADL Quantile Estimation(USER_DATA).
     */
    public function testUmPositionAdlQuantileEstimation()
    {
        $symbol = '';
        $recvWindow = 5000;
        $response = $this->getApiMock($request)->umPositionAdlQuantileEstimation($symbol, $recvWindow);

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

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