-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It is the rule of thumb to run tests in the strict types mode, because it may reveal subtle problems. See #154 for example. Updated the test suite to cast tarantool port (acquired from PRIMARY_PORT environment variable) from string to int. Aside of this, raise an error when the port is not set: it'll allow to fail fast and provide a good diagnostic when a configuration problem occurs.
- Loading branch information
1 parent
0a206c4
commit da8ecba
Showing
8 changed files
with
46 additions
and
6 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
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
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,24 @@ | ||
<?php | ||
|
||
/* | ||
* Set of utility functions for testing. | ||
*/ | ||
final class TestHelpers { | ||
/* | ||
* Get a port number, where tarantool expects binary protocol | ||
* clients. | ||
* | ||
* The source of information is PRIMARY_PORT environment | ||
* variable, which is set by the test-run.py script. | ||
* | ||
* If it is not set for some reason, the function will raise | ||
* an exception. | ||
*/ | ||
public static function getTarantoolPort() { | ||
$port = intval(getenv('PRIMARY_PORT')); | ||
if ($port == 0) | ||
throw new Exception( | ||
'Unable to parse PRIMARY_PORT environment variable as int'); | ||
return $port; | ||
} | ||
}; |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
<?php | ||
|
||
require __DIR__ . '/PhpUnitCompat.php'; | ||
require __DIR__ . '/TestHelpers.php'; |