Test Failed
Pull Request — master (#20)
by Vladislav
03:31 queued 01:03
created

ReplaceOrderTest::testSuccessEndpoint()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 22
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 14
nc 1
nop 0
dl 0
loc 22
rs 9.7998
c 0
b 0
f 0
1
<?php
2
namespace Carpenstar\ByBitAPI\Derivatives\Contract\Order\ReplaceOrder\Tests;
3
4
use Carpenstar\ByBitAPI\BybitAPI;
5
use Carpenstar\ByBitAPI\Core\Interfaces\IResponseInterface;
0 ignored issues
show
Bug introduced by
The type Carpenstar\ByBitAPI\Core...aces\IResponseInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Carpenstar\ByBitAPI\Derivatives\Contract\Order\ReplaceOrder\ReplaceOrder;
7
use Carpenstar\ByBitAPI\Derivatives\Contract\Order\ReplaceOrder\Request\ReplaceOrderRequest;
8
use Carpenstar\ByBitAPI\Derivatives\Contract\Order\ReplaceOrder\Response\ReplaceOrderResponse;
9
use PHPUnit\Framework\TestCase;
10
11
class ReplaceOrderTest extends TestCase
12
{
13
    public function testSuccessEndpoint()
14
    {
15
        $bybitApi = (new BybitAPI())
0 ignored issues
show
Bug introduced by
The call to Carpenstar\ByBitAPI\BybitAPI::__construct() has too few arguments starting with host. ( Ignorable by Annotation )

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

15
        $bybitApi = (/** @scrutinizer ignore-call */ new BybitAPI())

This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
16
            ->setCredentials('https://api-testnet.bybit.com', 'fL02oi5qo8i2jDxlum', 'Ne1EE35XTprIWrId9vGEAc1ZYJTmodA4qFzZ');
0 ignored issues
show
Bug introduced by
The method setCredentials() does not exist on Carpenstar\ByBitAPI\BybitAPI. ( Ignorable by Annotation )

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

16
            ->/** @scrutinizer ignore-call */ setCredentials('https://api-testnet.bybit.com', 'fL02oi5qo8i2jDxlum', 'Ne1EE35XTprIWrId9vGEAc1ZYJTmodA4qFzZ');

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
17
18
        /** @var IResponseInterface $endpointResponse */
19
        $endpointResponse = $bybitApi->privateEndpoint(ReplaceOrder::class,
20
            (new ReplaceOrderRequest())
21
                ->setSymbol('BTCUSDT')
22
                ->setOrderId('4f279264-6d38-46c1-8216-7e5a2f110c11')
23
                ->setPrice(68100)
24
        )->execute();
25
26
        echo "Return code: {$endpointResponse->getReturnCode()} \n";
27
        echo "Return message: {$endpointResponse->getReturnMessage()} \n";
28
29
        /** @var ReplaceOrderResponse $orderInfo */
30
        $orderInfo = $endpointResponse->getResult();
31
        echo "Order ID: {$orderInfo->getOrderId()}\n";
32
        echo "Order Link ID: {$orderInfo->getOrderLinkId()}\n";
33
34
        $this->assertTrue(true);
35
    }
36
}