Skip to content

Commit

Permalink
Add all travis ip to test suite. (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
OGKevin committed May 13, 2018
1 parent e434845 commit 11aeccb
Showing 1 changed file with 65 additions and 1 deletion.
66 changes: 65 additions & 1 deletion tests/BunqSdkTestBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use bunq\Util\BunqEnumApiEnvironmentType;
use bunq\Util\FileUtil;
use bunq\Util\InstallationUtil;
use GuzzleHttp\Client;
use PHPUnit\Framework\TestCase;

/**
Expand Down Expand Up @@ -105,7 +106,12 @@ protected static function createApiContext()
{
InstallationUtil::automaticInstall(
BunqEnumApiEnvironmentType::SANDBOX(),
self::FILE_PATH_CONTEXT_CONFIG
self::FILE_PATH_CONTEXT_CONFIG,
null,
array_merge(
static::getAllTravisIp(),
static::getCurrentIp()
)
);
}

Expand Down Expand Up @@ -282,4 +288,62 @@ protected function skipTestIfNeededDueToInsufficientBalance(): bool

return true;
}

/**
* @return string[]
*/
private static function getAllTravisIp(): array
{
return [
"104.154.113.151",
"104.154.120.187",
"104.197.236.150",
"146.148.51.141",
"146.148.58.237",
"147.75.192.163",
"207.254.16.35",
"207.254.16.36",
"207.254.16.37",
"207.254.16.38",
"207.254.16.39",
"34.233.56.198",
"34.234.4.53",
"35.184.226.236",
"35.184.48.144",
"35.184.96.71",
"35.188.1.99",
"35.188.184.134",
"35.188.73.34",
"35.192.136.167",
"35.192.187.174",
"35.192.19.50",
"35.192.217.12",
"35.192.85.2",
"35.193.203.142",
"35.193.211.2",
"35.193.7.13",
"35.202.145.110",
"35.202.68.136",
"35.202.78.106",
"35.224.112.202",
"35.226.126.204",
"52.3.55.28",
"52.45.185.117",
"52.45.220.64",
"52.54.31.11",
"52.54.40.118",
"54.208.31.17",
];
}

/**
* @return string[]
*/
private static function getCurrentIp(): array
{
$client = new Client();
$response = json_decode($client->get('http://ip-api.com/json')->getBody()->getContents(), true);

return [$response['query']];
}
}

0 comments on commit 11aeccb

Please sign in to comment.