Test Failed
Pull Request — master (#22)
by Vladislav
02:33
created

testGetTradingFeeRateEndpoint()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 19
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 2
eloc 11
nc 2
nop 0
dl 0
loc 19
rs 9.9
c 2
b 0
f 0
1
<?php
2
3
namespace Carpenstar\ByBitAPI\Derivatives\Contract\Account\GetTradingFeeRate\Tests;
4
5
use Carpenstar\ByBitAPI\BybitAPI;
6
use Carpenstar\ByBitAPI\Derivatives\Contract\Account\GetTradingFeeRate\GetTradingFeeRate;
7
use Carpenstar\ByBitAPI\Derivatives\Contract\Account\GetTradingFeeRate\Request\GetTradingFeeRateRequest;
8
use Carpenstar\ByBitAPI\Derivatives\Contract\Account\GetTradingFeeRate\Response\GetTradingFeeRateResponseItem;
9
use PHPUnit\Framework\TestCase;
10
11
class GetTradingFeeRateTest extends TestCase
12
{
13
    public function testGetTradingFeeRateEndpoint()
14
    {
15
        $bybit = (new BybitAPI())
16
            ->setCredentials('https://api-testnet.bybit.com', 'fL02oi5qo8i2jDxlum', 'Ne1EE35XTprIWrId9vGEAc1ZYJTmodA4qFzZ');
17
18
        $feeRateData = $bybit->privateEndpoint(GetTradingFeeRate::class, (new GetTradingFeeRateRequest()))->execute();
19
20
        echo "Return code: {$feeRateData->getReturnCode()} \n";
21
        echo "Return message: {$feeRateData->getReturnMessage()} \n";
22
23
        /** @var GetTradingFeeRateResponseItem $feeRate */
24
        foreach (array_slice($feeRateData->getResult()->getFeeRates(), 0, 3) as $feeRate) {
0 ignored issues
show
Bug introduced by
The method getFeeRates() does not exist on Carpenstar\ByBitAPI\Core\Objects\AbstractResponse. It seems like you code against a sub-type of Carpenstar\ByBitAPI\Core\Objects\AbstractResponse such as Carpenstar\ByBitAPI\Deri...tTradingFeeRateResponse. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

24
        foreach (array_slice($feeRateData->getResult()->/** @scrutinizer ignore-call */ getFeeRates(), 0, 3) as $feeRate) {
Loading history...
25
            echo "---\n";
26
            echo "Symbol: {$feeRate->getSymbol()} \n";
27
            echo "Taker Fee Rate: {$feeRate->getTakerFeeRate()} \n";
28
            echo "Maker Fee Rate: {$feeRate->getMakerFeeRate()} \n";
29
        }
30
31
        $this->assertTrue(true);
32
    }
33
}
34