File tree Expand file tree Collapse file tree 3 files changed +25
-2
lines changed
Expand file tree Collapse file tree 3 files changed +25
-2
lines changed Original file line number Diff line number Diff line change 11<?php
22
33return [
4- 'uri ' => env ('INDODAX_API_URI ' , 'https://indodax.com ' )
4+ 'uri ' => env ('INDODAX_API_URI ' , 'https://indodax.com ' ),
5+ 'connect_timeout ' => env ('INDODAX_API_CONNECT_TIMEOUT ' , 1 ),
6+ 'timeout ' => env ('INDODAX_API_TIMEOUT ' , 5 )
57];
Original file line number Diff line number Diff line change @@ -27,7 +27,9 @@ public static function request($url)
2727 private static function guzzle ()
2828 {
2929 return new GuzzleClient ([
30- 'base_uri ' => config ('indodax.uri ' )
30+ 'base_uri ' => config ('indodax.uri ' ),
31+ 'connect_timeout ' => config ('indodax.connect_timeout ' ),
32+ 'timeout ' => config ('indodax.timeout ' )
3133 ]);
3234 }
3335
Original file line number Diff line number Diff line change 44
55use Arispati \Indodax \Indodax ;
66use Arispati \Indodax \Tests \TestCase ;
7+ use Illuminate \Support \Facades \Config ;
78
89class IndodaxTest extends TestCase
910{
@@ -46,4 +47,22 @@ public function testGetDepth()
4647 {
4748 $ this ->assertIsObject (Indodax::getDepth ('btcidr ' ));
4849 }
50+
51+ public function testConnectionTimeout ()
52+ {
53+ $ this ->expectException (\GuzzleHttp \Exception \ConnectException::class);
54+
55+ Config::set ('indodax.uri ' , 'https://indodaxs.com ' );
56+
57+ Indodax::getServerTime ();
58+ }
59+
60+ public function testTimeout ()
61+ {
62+ $ this ->expectException (\GuzzleHttp \Exception \ConnectException::class);
63+
64+ Config::set ('indodax.timeout ' , 0.01 );
65+
66+ Indodax::getSummaries ();
67+ }
4968}
You can’t perform that action at this time.
0 commit comments