From 11aeccbb081dbce64736f44b9cf78dd552a4a135 Mon Sep 17 00:00:00 2001 From: Kevin Hellemun Date: Sun, 13 May 2018 12:55:01 +0200 Subject: [PATCH] Add all travis ip to test suite. (bunq/sdk_php#126) --- tests/BunqSdkTestBase.php | 66 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) diff --git a/tests/BunqSdkTestBase.php b/tests/BunqSdkTestBase.php index 9e71da95..9296271d 100644 --- a/tests/BunqSdkTestBase.php +++ b/tests/BunqSdkTestBase.php @@ -15,6 +15,7 @@ use bunq\Util\BunqEnumApiEnvironmentType; use bunq\Util\FileUtil; use bunq\Util\InstallationUtil; +use GuzzleHttp\Client; use PHPUnit\Framework\TestCase; /** @@ -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() + ) ); } @@ -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']]; + } }