From 0e0d52c636e0134ee2ebe05e41f37794c4dbd074 Mon Sep 17 00:00:00 2001 From: XieBiao Date: Thu, 21 Mar 2019 11:26:47 +0800 Subject: [PATCH 1/3] fix tests with dataProvider --- composer.json | 2 +- tests/AccountTest.php | 85 ++++++++++++++----------------------- tests/CurrencyTest.php | 17 +++----- tests/DepositTest.php | 27 +++--------- tests/FillTest.php | 25 ++--------- tests/OrderTest.php | 44 ++++++------------- tests/SymbolTest.php | 31 ++++++-------- tests/TestCase.php | 37 +++++++++------- tests/TimeTest.php | 13 ++---- tests/WebSocketFeedTest.php | 29 +++---------- tests/WithdrawalTest.php | 29 +++---------- 11 files changed, 107 insertions(+), 232 deletions(-) diff --git a/composer.json b/composer.json index 8977b51..2526cf4 100644 --- a/composer.json +++ b/composer.json @@ -45,6 +45,6 @@ "secure-http": false }, "scripts": { - "test": "./vendor/bin/phpunit -c phpunit.xml --filter '/::test(New|Get)\\w+$/' --coverage-text --verbose" + "test": "./vendor/bin/phpunit -c phpunit.xml --filter '/::testGet\\w+/' --coverage-text --verbose" } } diff --git a/tests/AccountTest.php b/tests/AccountTest.php index e54bc52..e522725 100644 --- a/tests/AccountTest.php +++ b/tests/AccountTest.php @@ -3,35 +3,17 @@ namespace KuCoin\SDK\Tests; use KuCoin\SDK\ApiCode; -use KuCoin\SDK\Auth; use KuCoin\SDK\Exceptions\BusinessException; use KuCoin\SDK\PrivateApi\Account; class AccountTest extends TestCase { - public function testNewAuth() - { - $auth = new Auth($this->apiKey, $this->apiSecret, $this->apiPassPhrase); - $this->assertInstanceOf(Auth::class, $auth); - return $auth; - } + protected $apiClass = Account::class; + protected $apiWithAuth = true; /** - * @depends testNewAuth - * @param Auth $auth - * @return Account - */ - public function testNewAccount(Auth $auth) - { - $api = new Account($auth); - $this->assertInstanceOf(Account::class, $api); - return $api; - } - - /** - * @depends testNewAccount + * @dataProvider apiProvider * @param Account $api - * @return array|string * @throws BusinessException * @throws \KuCoin\SDK\Exceptions\HttpException * @throws \KuCoin\SDK\Exceptions\InvalidApiUriException @@ -48,13 +30,11 @@ public function testGetMainList(Account $api) $this->assertArrayHasKey('holds', $item); $this->assertArrayHasKey('type', $item); } - return $accounts; } /** - * @depends testNewAccount + * @dataProvider apiProvider * @param Account $api - * @return array|string * @throws BusinessException * @throws \KuCoin\SDK\Exceptions\HttpException * @throws \KuCoin\SDK\Exceptions\InvalidApiUriException @@ -71,60 +51,57 @@ public function testGetTradeList(Account $api) $this->assertArrayHasKey('holds', $item); $this->assertArrayHasKey('type', $item); } - return $accounts; } /** - * @depends testNewAccount + * @dataProvider apiProvider * @param Account $api - * @return array|string * @throws BusinessException * @throws \KuCoin\SDK\Exceptions\HttpException * @throws \KuCoin\SDK\Exceptions\InvalidApiUriException */ - public function testCreateAccount(Account $api) + public function testGetDetail(Account $api) { - try { - $data = $api->create('trade', 'ETH'); - $this->assertArrayHasKey('id', $data); - } catch (BusinessException $e) { - if ($e->getResponse()->getApiCode() != ApiCode::ACCOUNT_EXISTS) { //account already exists - throw $e; - } + $accounts = $api->getList(['type' => 'main']); + if (isset($accounts[0])) { + $account = $api->getDetail($accounts[0]['id']); + $this->assertArrayHasKey('currency', $account); + $this->assertArrayHasKey('balance', $account); + $this->assertArrayHasKey('available', $account); + $this->assertArrayHasKey('holds', $account); } } /** - * @depends testNewAccount - * @depends testGetMainList + * @dataProvider apiProvider * @param Account $api - * @param array $accounts + * @return array|string * @throws BusinessException * @throws \KuCoin\SDK\Exceptions\HttpException * @throws \KuCoin\SDK\Exceptions\InvalidApiUriException */ - public function testGetDetail(Account $api, array $accounts) + public function testCreateAccount(Account $api) { - if (isset($accounts[0])) { - $account = $api->getDetail($accounts[0]['id']); - $this->assertArrayHasKey('currency', $account); - $this->assertArrayHasKey('balance', $account); - $this->assertArrayHasKey('available', $account); - $this->assertArrayHasKey('holds', $account); + try { + $data = $api->create('trade', 'ETH'); + $this->assertArrayHasKey('id', $data); + } catch (BusinessException $e) { + if ($e->getResponse()->getApiCode() != ApiCode::ACCOUNT_EXISTS) { //account already exists + throw $e; + } } } /** - * @depends testNewAccount - * @depends testGetTradeList + * @dataProvider apiProvider * @param Account $api - * @param array $accounts * @throws BusinessException * @throws \KuCoin\SDK\Exceptions\HttpException * @throws \KuCoin\SDK\Exceptions\InvalidApiUriException */ - public function testGetLedgers(Account $api, array $accounts) + public function testGetLedgers(Account $api) { + $accounts = $api->getList(['type' => 'trade']); if (isset($accounts[0])) { $data = $api->getLedgers($accounts[0]['id'], [], ['currentPage' => 1, 'pageSize' => 10]); $this->assertPagination($data); @@ -142,7 +119,7 @@ public function testGetLedgers(Account $api, array $accounts) } /** - * @depends testNewAccount + * @dataProvider apiProvider * @param Account $api * @throws BusinessException * @throws \KuCoin\SDK\Exceptions\HttpException @@ -175,16 +152,16 @@ public function testInnerTransfer(Account $api) } /** - * @depends testNewAccount - * @depends testGetMainList + * @dataProvider apiProvider + * @depends testGetMainList * @param Account $api - * @param array $accounts * @throws BusinessException * @throws \KuCoin\SDK\Exceptions\HttpException * @throws \KuCoin\SDK\Exceptions\InvalidApiUriException */ - public function testGetHolds(Account $api, array $accounts) + public function testGetHolds(Account $api) { + $accounts = $api->getList(['type' => 'trade']); if (isset($accounts[0])) { $data = $api->getHolds($accounts[1]['id'], ['currentPage' => 1, 'pageSize' => 10]); $this->assertPagination($data); diff --git a/tests/CurrencyTest.php b/tests/CurrencyTest.php index eb7e48e..123a014 100644 --- a/tests/CurrencyTest.php +++ b/tests/CurrencyTest.php @@ -6,18 +6,11 @@ class CurrencyTest extends TestCase { - /** - * @return Currency - */ - public function testNewCurrency() - { - $api = new Currency(); - $this->assertInstanceOf(Currency::class, $api); - return $api; - } + protected $apiClass = Currency::class; + protected $apiWithAuth = true; /** - * @depends testNewCurrency + * @dataProvider apiProvider * @param Currency $api * @throws \KuCoin\SDK\Exceptions\BusinessException * @throws \KuCoin\SDK\Exceptions\HttpException @@ -40,7 +33,7 @@ public function testGetList(Currency $api) } /** - * @depends testNewCurrency + * @dataProvider apiProvider * @param Currency $api * @throws \KuCoin\SDK\Exceptions\BusinessException * @throws \KuCoin\SDK\Exceptions\HttpException @@ -61,7 +54,7 @@ public function testGetDetail(Currency $api) } /** - * @depends testNewCurrency + * @dataProvider apiProvider * @param Currency $api * @throws \KuCoin\SDK\Exceptions\BusinessException * @throws \KuCoin\SDK\Exceptions\HttpException diff --git a/tests/DepositTest.php b/tests/DepositTest.php index f8003dd..ea71c04 100644 --- a/tests/DepositTest.php +++ b/tests/DepositTest.php @@ -2,33 +2,16 @@ namespace KuCoin\SDK\Tests; -use KuCoin\SDK\Auth; use KuCoin\SDK\Exceptions\BusinessException; use KuCoin\SDK\PrivateApi\Deposit; class DepositTest extends TestCase { - public function testNewAuth() - { - $auth = new Auth($this->apiKey, $this->apiSecret, $this->apiPassPhrase); - $this->assertInstanceOf(Auth::class, $auth); - return $auth; - } - - /** - * @depends testNewAuth - * @param Auth $auth - * @return Deposit - */ - public function testNewDeposit(Auth $auth) - { - $api = new Deposit($auth); - $this->assertInstanceOf(Deposit::class, $api); - return $api; - } + protected $apiClass = Deposit::class; + protected $apiWithAuth = true; /** - * @depends testNewDeposit + * @dataProvider apiProvider * @param Deposit $api * @return array|string * @throws \KuCoin\SDK\Exceptions\BusinessException @@ -44,7 +27,7 @@ public function testCreateAddress(Deposit $api) } /** - * @depends testNewDeposit + * @dataProvider apiProvider * @param Deposit $api * @return array|string * @throws \KuCoin\SDK\Exceptions\BusinessException @@ -70,7 +53,7 @@ public function testGetAddress(Deposit $api) } /** - * @depends testNewDeposit + * @dataProvider apiProvider * @param Deposit $api * @return array|string * @throws \KuCoin\SDK\Exceptions\BusinessException diff --git a/tests/FillTest.php b/tests/FillTest.php index bb430d5..91329b2 100644 --- a/tests/FillTest.php +++ b/tests/FillTest.php @@ -2,32 +2,15 @@ namespace KuCoin\SDK\Tests; -use KuCoin\SDK\Auth; use KuCoin\SDK\PrivateApi\Fill; class FillTest extends TestCase { - public function testNewAuth() - { - $auth = new Auth($this->apiKey, $this->apiSecret, $this->apiPassPhrase); - $this->assertInstanceOf(Auth::class, $auth); - return $auth; - } - - /** - * @depends testNewAuth - * @param Auth $auth - * @return Fill - */ - public function testNewFill(Auth $auth) - { - $api = new Fill($auth); - $this->assertInstanceOf(Fill::class, $api); - return $api; - } + protected $apiClass = Fill::class; + protected $apiWithAuth = true; /** - * @depends testNewFill + * @dataProvider apiProvider * @param Fill $api * @throws \KuCoin\SDK\Exceptions\BusinessException * @throws \KuCoin\SDK\Exceptions\HttpException @@ -58,7 +41,7 @@ public function testGetList(Fill $api) } /** - * @depends testNewFill + * @dataProvider apiProvider * @param Fill $api * @throws \KuCoin\SDK\Exceptions\BusinessException * @throws \KuCoin\SDK\Exceptions\HttpException diff --git a/tests/OrderTest.php b/tests/OrderTest.php index 769b62c..82a8bb9 100644 --- a/tests/OrderTest.php +++ b/tests/OrderTest.php @@ -2,32 +2,15 @@ namespace KuCoin\SDK\Tests; -use KuCoin\SDK\Auth; use KuCoin\SDK\PrivateApi\Order; class OrderTest extends TestCase { - public function testNewAuth() - { - $auth = new Auth($this->apiKey, $this->apiSecret, $this->apiPassPhrase); - $this->assertInstanceOf(Auth::class, $auth); - return $auth; - } + protected $apiClass = Order::class; + protected $apiWithAuth = true; /** - * @depends testNewAuth - * @param Auth $auth - * @return Order - */ - public function testNewOrder(Auth $auth) - { - $api = new Order($auth); - $this->assertInstanceOf(Order::class, $api); - return $api; - } - - /** - * @depends testNewOrder + * @dataProvider apiProvider * @param Order $api * @return array|string * @throws \KuCoin\SDK\Exceptions\BusinessException @@ -53,7 +36,7 @@ public function testCreateLimit(Order $api) } /** - * @depends testNewOrder + * @dataProvider apiProvider * @param Order $api * @return array|string * @throws \KuCoin\SDK\Exceptions\BusinessException @@ -78,9 +61,8 @@ public function testCreateMarket(Order $api) } /** - * @depends testNewOrder + * @dataProvider apiProvider * @param Order $api - * @return array * @throws \KuCoin\SDK\Exceptions\BusinessException * @throws \KuCoin\SDK\Exceptions\HttpException * @throws \KuCoin\SDK\Exceptions\InvalidApiUriException @@ -116,20 +98,20 @@ public function testGetList(Order $api) $this->assertArrayHasKey('stop', $item); $this->assertArrayHasKey('cancelExist', $item); } - return $data['items']; } /** - * @depends testNewOrder - * @depends testGetList + * @dataProvider apiProvider * @param Order $api - * @param array $orders * @throws \KuCoin\SDK\Exceptions\BusinessException * @throws \KuCoin\SDK\Exceptions\HttpException * @throws \KuCoin\SDK\Exceptions\InvalidApiUriException */ - public function testGetDetail(Order $api, array $orders) + public function testGetDetail(Order $api) { + $data = $api->getList(['symbol' => 'BTC-USDT'], ['currentPage' => 1, 'pageSize' => 10]); + $this->assertPagination($data); + $orders = $data['items']; if (isset($orders[0])) { $order = $api->getDetail($orders[0]['id']); $this->assertArrayHasKey('symbol', $order); @@ -161,7 +143,7 @@ public function testGetDetail(Order $api, array $orders) } /** - * @depends testNewOrder + * @dataProvider apiProvider * @param Order $api * @throws \KuCoin\SDK\Exceptions\BusinessException * @throws \KuCoin\SDK\Exceptions\HttpException @@ -174,7 +156,7 @@ public function testCancel($api) } /** - * @depends testNewOrder + * @dataProvider apiProvider * @param Order $api * @throws \KuCoin\SDK\Exceptions\BusinessException * @throws \KuCoin\SDK\Exceptions\HttpException @@ -188,7 +170,7 @@ public function testCancelAll($api) } /** - * @depends testNewOrder + * @dataProvider apiProvider * @param Order $api * @throws \KuCoin\SDK\Exceptions\BusinessException * @throws \KuCoin\SDK\Exceptions\HttpException diff --git a/tests/SymbolTest.php b/tests/SymbolTest.php index f8de675..0091bbc 100644 --- a/tests/SymbolTest.php +++ b/tests/SymbolTest.php @@ -6,18 +6,11 @@ class SymbolTest extends TestCase { - /** - * @return Symbol - */ - public function testNewSymbol() - { - $api = new Symbol(); - $this->assertInstanceOf(Symbol::class, $api); - return $api; - } + protected $apiClass = Symbol::class; + protected $apiWithAuth = false; /** - * @depends testNewSymbol + * @dataProvider apiProvider * @param Symbol $api * @throws \KuCoin\SDK\Exceptions\BusinessException * @throws \KuCoin\SDK\Exceptions\HttpException @@ -44,7 +37,7 @@ public function testGetList(Symbol $api) } /** - * @depends testNewSymbol + * @dataProvider apiProvider * @param Symbol $api * @throws \KuCoin\SDK\Exceptions\BusinessException * @throws \KuCoin\SDK\Exceptions\HttpException @@ -65,7 +58,7 @@ public function testGetTicker(Symbol $api) } /** - * @depends testNewSymbol + * @dataProvider apiProvider * @param Symbol $api * @throws \KuCoin\SDK\Exceptions\BusinessException * @throws \KuCoin\SDK\Exceptions\HttpException @@ -91,7 +84,7 @@ public function testGetAllTickers(Symbol $api) } /** - * @depends testNewSymbol + * @dataProvider apiProvider * @param Symbol $api * @throws \KuCoin\SDK\Exceptions\BusinessException * @throws \KuCoin\SDK\Exceptions\HttpException @@ -108,7 +101,7 @@ public function testGetAggregatedPartOrderBook(Symbol $api) } /** - * @depends testNewSymbol + * @dataProvider apiProvider * @param Symbol $api * @throws \KuCoin\SDK\Exceptions\BusinessException * @throws \KuCoin\SDK\Exceptions\HttpException @@ -125,7 +118,7 @@ public function testGetAggregatedFullOrderBook(Symbol $api) } /** - * @depends testNewSymbol + * @dataProvider apiProvider * @param Symbol $api * @throws \KuCoin\SDK\Exceptions\BusinessException * @throws \KuCoin\SDK\Exceptions\HttpException @@ -143,7 +136,7 @@ public function testGetAtomicFullOrderBook(Symbol $api) /** - * @depends testNewSymbol + * @dataProvider apiProvider * @param Symbol $api * @throws \KuCoin\SDK\Exceptions\BusinessException * @throws \KuCoin\SDK\Exceptions\HttpException @@ -163,7 +156,7 @@ public function testGetHistories(Symbol $api) } /** - * @depends testNewSymbol + * @dataProvider apiProvider * @param Symbol $api * @throws \KuCoin\SDK\Exceptions\BusinessException * @throws \KuCoin\SDK\Exceptions\HttpException @@ -180,7 +173,7 @@ public function testGetKLines(Symbol $api) } /** - * @depends testNewSymbol + * @dataProvider apiProvider * @param Symbol $api * @throws \KuCoin\SDK\Exceptions\BusinessException * @throws \KuCoin\SDK\Exceptions\HttpException @@ -202,7 +195,7 @@ public function testGet24HStats(Symbol $api) } /** - * @depends testNewSymbol + * @dataProvider apiProvider * @param Symbol $api * @throws \KuCoin\SDK\Exceptions\BusinessException * @throws \KuCoin\SDK\Exceptions\HttpException diff --git a/tests/TestCase.php b/tests/TestCase.php index 6412df7..1fcd17d 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -2,29 +2,34 @@ namespace KuCoin\SDK\Tests; +use KuCoin\SDK\Auth; +use KuCoin\SDK\Http\GuzzleHttp; +use KuCoin\SDK\Http\SwooleHttp; use KuCoin\SDK\KuCoinApi; class TestCase extends \PHPUnit\Framework\TestCase { - protected $apiKey; - protected $apiSecret; - protected $apiPassPhrase; - protected $apiBaseUri; - protected $apiSkipVerifyTls; + protected $apiClass = 'Must be declared in the subclass'; + protected $apiWithAuth = false; - protected function setUp() + public function apiProvider() { - parent::setUp(); - - $this->apiKey = getenv('API_KEY'); - $this->apiSecret = getenv('API_SECRET'); - $this->apiPassPhrase = getenv('API_PASSPHRASE'); - $this->apiBaseUri = getenv('API_BASE_URI'); - $this->apiSkipVerifyTls = (bool)getenv('API_SKIP_VERIFY_TLS'); - KuCoinApi::setSkipVerifyTls($this->apiSkipVerifyTls); - if ($this->apiBaseUri) { - KuCoinApi::setBaseUri($this->apiBaseUri); + $apiKey = getenv('API_KEY'); + $apiSecret = getenv('API_SECRET'); + $apiPassPhrase = getenv('API_PASSPHRASE'); + $apiBaseUri = getenv('API_BASE_URI'); + $apiSkipVerifyTls = (bool)getenv('API_SKIP_VERIFY_TLS'); + KuCoinApi::setSkipVerifyTls($apiSkipVerifyTls); + if ($apiBaseUri) { + KuCoinApi::setBaseUri($apiBaseUri); } + + $auth = new Auth($apiKey, $apiSecret, $apiPassPhrase); + return [ + [new $this->apiClass($this->apiWithAuth ? $auth : null)], + [new $this->apiClass($this->apiWithAuth ? $auth : null, new GuzzleHttp(['skipVerifyTls' => $apiSkipVerifyTls]))], + //[new $this->apiClass($this->apiWithAuth ? $auth : null, new SwooleHttp(['skipVerifyTls' => $apiSkipVerifyTls]))], + ]; } protected function assertPagination($data) diff --git a/tests/TimeTest.php b/tests/TimeTest.php index df7a6b5..74cdab6 100644 --- a/tests/TimeTest.php +++ b/tests/TimeTest.php @@ -6,18 +6,11 @@ class TimeTest extends TestCase { - /** - * @return Time - */ - public function testNewTime() - { - $api = new Time(); - $this->assertInstanceOf(Time::class, $api); - return $api; - } + protected $apiClass = Time::class; + protected $apiWithAuth = false; /** - * @depends testNewTime + * @dataProvider apiProvider * @param Time $api * @throws \KuCoin\SDK\Exceptions\BusinessException * @throws \KuCoin\SDK\Exceptions\HttpException diff --git a/tests/WebSocketFeedTest.php b/tests/WebSocketFeedTest.php index bbfc0d5..9f70d98 100644 --- a/tests/WebSocketFeedTest.php +++ b/tests/WebSocketFeedTest.php @@ -2,34 +2,17 @@ namespace KuCoin\SDK\Tests; -use KuCoin\SDK\Auth; use KuCoin\SDK\PrivateApi\WebSocketFeed; use Ratchet\Client\WebSocket; use React\EventLoop\LoopInterface; class WebSocketFeedTest extends TestCase { - public function testNewAuth() - { - $auth = new Auth($this->apiKey, $this->apiSecret, $this->apiPassPhrase); - $this->assertInstanceOf(Auth::class, $auth); - return $auth; - } - - /** - * @depends testNewAuth - * @param Auth $auth - * @return WebSocketFeed - */ - public function testNewWebSocketFeed(Auth $auth) - { - $api = new WebSocketFeed($auth); - $this->assertInstanceOf(WebSocketFeed::class, $api); - return $api; - } + protected $apiClass = WebSocketFeed::class; + protected $apiWithAuth = true; /** - * @depends testNewWebSocketFeed + * @dataProvider apiProvider * @param WebSocketFeed $api * @throws \KuCoin\SDK\Exceptions\BusinessException * @throws \KuCoin\SDK\Exceptions\HttpException @@ -51,7 +34,7 @@ public function testGetPublicBullet(WebSocketFeed $api) } /** - * @depends testNewWebSocketFeed + * @dataProvider apiProvider * @param WebSocketFeed $api * @return array * @throws \KuCoin\SDK\Exceptions\BusinessException @@ -80,7 +63,7 @@ public function testGetPrivateBullet(WebSocketFeed $api) } /** - * @depends testNewWebSocketFeed + * @dataProvider apiProvider * @param WebSocketFeed $api * @throws \Exception|\Throwable */ @@ -115,7 +98,7 @@ public function testSubscribePublicChannel(WebSocketFeed $api) } /** - * @depends testNewWebSocketFeed + * @dataProvider apiProvider * @param WebSocketFeed $api * @throws \Exception|\Throwable */ diff --git a/tests/WithdrawalTest.php b/tests/WithdrawalTest.php index 1ccfea8..269167d 100644 --- a/tests/WithdrawalTest.php +++ b/tests/WithdrawalTest.php @@ -2,32 +2,15 @@ namespace KuCoin\SDK\Tests; -use KuCoin\SDK\Auth; use KuCoin\SDK\PrivateApi\Withdrawal; class WithdrawalTest extends TestCase { - public function testNewAuth() - { - $auth = new Auth($this->apiKey, $this->apiSecret, $this->apiPassPhrase); - $this->assertInstanceOf(Auth::class, $auth); - return $auth; - } - - /** - * @depends testNewAuth - * @param Auth $auth - * @return Withdrawal - */ - public function testNewWithdrawal(Auth $auth) - { - $api = new Withdrawal($auth); - $this->assertInstanceOf(Withdrawal::class, $api); - return $api; - } + protected $apiClass = Withdrawal::class; + protected $apiWithAuth = true; /** - * @depends testNewWithdrawal + * @dataProvider apiProvider * @param Withdrawal $api * @throws \KuCoin\SDK\Exceptions\BusinessException * @throws \KuCoin\SDK\Exceptions\HttpException @@ -50,7 +33,7 @@ public function testGetQuotas(Withdrawal $api) } /** - * @depends testNewWithdrawal + * @dataProvider apiProvider * @param Withdrawal $api * @throws \KuCoin\SDK\Exceptions\BusinessException * @throws \KuCoin\SDK\Exceptions\HttpException @@ -71,7 +54,7 @@ public function testApply(Withdrawal $api) /** - * @depends testNewWithdrawal + * @dataProvider apiProvider * @param Withdrawal $api * @return array * @throws \KuCoin\SDK\Exceptions\BusinessException @@ -106,7 +89,7 @@ public function testGetList(Withdrawal $api) } /** - * @depends testNewWithdrawal + * @dataProvider apiProvider * @param Withdrawal $api * @throws \KuCoin\SDK\Exceptions\BusinessException * @throws \KuCoin\SDK\Exceptions\HttpException From 82cd955a2ee3120cb6b188018299dbbaa3ee17c1 Mon Sep 17 00:00:00 2001 From: XieBiao Date: Thu, 21 Mar 2019 11:28:47 +0800 Subject: [PATCH 2/3] fix tests with dataProvider --- tests/CurrencyTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/CurrencyTest.php b/tests/CurrencyTest.php index 123a014..b6e1ee0 100644 --- a/tests/CurrencyTest.php +++ b/tests/CurrencyTest.php @@ -7,7 +7,7 @@ class CurrencyTest extends TestCase { protected $apiClass = Currency::class; - protected $apiWithAuth = true; + protected $apiWithAuth = false; /** * @dataProvider apiProvider From 6ba87852da339c59e795c327b6e4be4fead85b6f Mon Sep 17 00:00:00 2001 From: XieBiao Date: Thu, 21 Mar 2019 11:42:18 +0800 Subject: [PATCH 3/3] update markdown headers --- README.md | 10 +++++----- examples/GoTime.php | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 123694f..56e92d1 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ KuCoinApi::setBaseUri('https://openapi-sandbox.kucoin.com'); ### Examples > See the [test case](tests) for more examples. -- Example of API `without` authentication +#### Example of API `without` authentication ```php use KuCoin\SDK\PublicApi\Time; @@ -49,7 +49,7 @@ $timestamp = $api->timestamp(); var_dump($timestamp); ``` -- Example of API `with` authentication +#### Example of API `with` authentication ```php use KuCoin\SDK\Auth; @@ -70,7 +70,7 @@ try { } ``` -- Example of WebSocket feed +#### Example of WebSocket feed ```php use KuCoin\SDK\Auth; @@ -98,7 +98,7 @@ $api->subscribePublicChannel($query, $channel, function (array $message, WebSock }); ``` -- Coroutine HTTP client for asynchronous IO +#### ⚡️Coroutine HTTP client for asynchronous IO ```bash pecl install swoole @@ -112,7 +112,7 @@ use KuCoin\SDK\Http\SwooleHttp; // Require PHP 7.1+ and Swoole 2.1.2+ // Require running in cli mode go(function () { - $api = new Time(null, new SwooleHttp()); + $api = new Time(null, new SwooleHttp)); $timestamp = $api->timestamp(); var_dump($timestamp); }); diff --git a/examples/GoTime.php b/examples/GoTime.php index da2283a..5b841f9 100644 --- a/examples/GoTime.php +++ b/examples/GoTime.php @@ -12,7 +12,7 @@ // Require PHP 7.1+ and Swoole 2.1.2+ // Require running in cli mode go(function () { - $api = new Time(null, new SwooleHttp()); + $api = new Time(null, new SwooleHttp); $timestamp = $api->timestamp(); var_dump($timestamp); }); \ No newline at end of file