-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
62cfcab
commit 37bbbb0
Showing
3 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
|
||
namespace Adyen\Tests\Unit; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Adyen\Region; | ||
|
||
class RegionTest extends TestCase | ||
{ | ||
public function testValidRegions() | ||
{ | ||
$expected = [ | ||
"eu", | ||
"us", | ||
"au", | ||
"in", | ||
"apse", | ||
]; | ||
|
||
$this->assertEquals( | ||
$expected, | ||
Region::VALID_REGIONS, | ||
"VALID_REGIONS should match the expected regions." | ||
); | ||
} | ||
|
||
public function testTerminalApiEndpointsMapping() | ||
{ | ||
$expected = [ | ||
"eu" => "https://terminal-api-live.adyen.com", | ||
"us" => "https://terminal-api-live-us.adyen.com", | ||
"au" => "https://terminal-api-live-au.adyen.com", | ||
"in" => "https://terminal-api-live-in.adyen.com", | ||
"apse" => "https://terminal-api-live-apse.adyen.com", | ||
]; | ||
|
||
$this->assertEquals( | ||
$expected, | ||
Region::TERMINAL_API_ENDPOINTS_MAPPING, | ||
"TERMINAL_API_ENDPOINTS_MAPPING should match the expected mappings."); | ||
} | ||
|
||
public function testTerminalApiEndpointsExistsForAllRegions() | ||
{ | ||
$regionsWithEndpoints = array_keys(Region::TERMINAL_API_ENDPOINTS_MAPPING); | ||
$regions = Region::VALID_REGIONS; | ||
|
||
$expected = array_diff($regions, $regionsWithEndpoints); | ||
|
||
$this->assertEmpty( | ||
$expected, | ||
"Every region should be mapped to an endpoint." | ||
); | ||
} | ||
} |