mirror of
https://github.com/php/php-src.git
synced 2024-12-03 23:05:57 +08:00
Modernize some connectors in tests to remove env key duplication
This commit is contained in:
parent
a12ebc295c
commit
e1afd9b213
@ -5,14 +5,14 @@ Default values are "localhost", "cn=Manager,dc=my-domain,dc=com", and password "
|
||||
Change the LDAP_TEST_* environment values if you want to use another configuration.
|
||||
*/
|
||||
|
||||
$host = getenv("LDAP_TEST_HOST") ? getenv("LDAP_TEST_HOST") : "localhost";
|
||||
$port = getenv("LDAP_TEST_PORT") ? getenv("LDAP_TEST_PORT") : 389;
|
||||
$base = getenv("LDAP_TEST_BASE") ? getenv("LDAP_TEST_BASE") : "dc=my-domain,dc=com";
|
||||
$user = getenv("LDAP_TEST_USER") ? getenv("LDAP_TEST_USER") : "cn=Manager,$base";
|
||||
$sasl_user = getenv("LDAP_TEST_SASL_USER") ? getenv("LDAP_TEST_SASL_USER") : "Manager";
|
||||
$passwd = getenv("LDAP_TEST_PASSWD") ? getenv("LDAP_TEST_PASSWD") : "secret";
|
||||
$protocol_version = getenv("LDAP_TEST_OPT_PROTOCOL_VERSION") ? getenv("LDAP_TEST_OPT_PROTOCOL_VERSION") : 3;
|
||||
$skip_on_bind_failure = getenv("LDAP_TEST_SKIP_BIND_FAILURE") ? getenv("LDAP_TEST_SKIP_BIND_FAILURE") : true;
|
||||
$host = getenv("LDAP_TEST_HOST") ?: "localhost";
|
||||
$port = getenv("LDAP_TEST_PORT") ?: 389;
|
||||
$base = getenv("LDAP_TEST_BASE") ?: "dc=my-domain,dc=com";
|
||||
$user = getenv("LDAP_TEST_USER") ?: "cn=Manager,$base";
|
||||
$sasl_user = getenv("LDAP_TEST_SASL_USER") ?: "Manager";
|
||||
$passwd = getenv("LDAP_TEST_PASSWD") ?: "secret";
|
||||
$protocol_version = getenv("LDAP_TEST_OPT_PROTOCOL_VERSION") ?: 3;
|
||||
$skip_on_bind_failure = getenv("LDAP_TEST_SKIP_BIND_FAILURE") ?: true;
|
||||
|
||||
function ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version) {
|
||||
$link = ldap_connect($host, $port);
|
||||
|
@ -8,15 +8,15 @@
|
||||
|
||||
$driver = new mysqli_driver;
|
||||
|
||||
$host = getenv("MYSQL_TEST_HOST") ? getenv("MYSQL_TEST_HOST") : "localhost";
|
||||
$port = getenv("MYSQL_TEST_PORT") ? getenv("MYSQL_TEST_PORT") : 3306;
|
||||
$user = getenv("MYSQL_TEST_USER") ? getenv("MYSQL_TEST_USER") : "root";
|
||||
$passwd = getenv("MYSQL_TEST_PASSWD") ? getenv("MYSQL_TEST_PASSWD") : "";
|
||||
$db = getenv("MYSQL_TEST_DB") ? getenv("MYSQL_TEST_DB") : "test";
|
||||
$engine = getenv("MYSQL_TEST_ENGINE") ? getenv("MYSQL_TEST_ENGINE") : "MyISAM";
|
||||
$socket = getenv("MYSQL_TEST_SOCKET") ? getenv("MYSQL_TEST_SOCKET") : null;
|
||||
$skip_on_connect_failure = getenv("MYSQL_TEST_SKIP_CONNECT_FAILURE") ? getenv("MYSQL_TEST_SKIP_CONNECT_FAILURE") : true;
|
||||
$connect_flags = getenv("MYSQL_TEST_CONNECT_FLAGS") ? (int)getenv("MYSQL_TEST_CONNECT_FLAGS") : 0;
|
||||
$host = getenv("MYSQL_TEST_HOST") ?: "localhost";
|
||||
$port = getenv("MYSQL_TEST_PORT") ?: 3306;
|
||||
$user = getenv("MYSQL_TEST_USER") ?: "root";
|
||||
$passwd = getenv("MYSQL_TEST_PASSWD") ?: "";
|
||||
$db = getenv("MYSQL_TEST_DB") ?: "test";
|
||||
$engine = getenv("MYSQL_TEST_ENGINE") ?: "MyISAM";
|
||||
$socket = getenv("MYSQL_TEST_SOCKET") ?: null;
|
||||
$skip_on_connect_failure = getenv("MYSQL_TEST_SKIP_CONNECT_FAILURE") ?: true;
|
||||
$connect_flags = (int)getenv("MYSQL_TEST_CONNECT_FLAGS") ?: 0;
|
||||
if ($socket) {
|
||||
ini_set('mysqli.default_socket', $socket);
|
||||
}
|
||||
|
@ -6,26 +6,26 @@ requests and 'private' community for write requests.
|
||||
Default timeout is 1000ms and there will be one request performed.
|
||||
*/
|
||||
|
||||
$hostname4 = getenv('SNMP_HOSTNAME') ? getenv('SNMP_HOSTNAME') : '127.0.0.1';
|
||||
$hostname6 = getenv('SNMP_HOSTNAME6') ? getenv('SNMP_HOSTNAME6') : '::1';
|
||||
$port = getenv('SNMP_PORT') ? getenv('SNMP_PORT') : '161';
|
||||
$hostname4 = getenv('SNMP_HOSTNAME') ?: '127.0.0.1';
|
||||
$hostname6 = getenv('SNMP_HOSTNAME6') ?: '::1';
|
||||
$port = getenv('SNMP_PORT') ?: '161';
|
||||
$hostname = "$hostname4:$port";
|
||||
$hostname6_port = "[$hostname6]:$port";
|
||||
$community = getenv('SNMP_COMMUNITY') ? getenv('SNMP_COMMUNITY') : 'public';
|
||||
$communityWrite = getenv('SNMP_COMMUNITY_WRITE')? getenv('SNMP_COMMUNITY_WRITE'):'private';
|
||||
$community = getenv('SNMP_COMMUNITY') ?: 'public';
|
||||
$communityWrite = getenv('SNMP_COMMUNITY_WRITE')?:'private';
|
||||
|
||||
$timeout = getenv('SNMP_TIMEOUT') ? getenv('SNMP_TIMEOUT') : -1;
|
||||
$retries = getenv('SNMP_RETRIES') ? getenv('SNMP_RETRIES') : 1;
|
||||
$timeout = getenv('SNMP_TIMEOUT') ?: -1;
|
||||
$retries = getenv('SNMP_RETRIES') ?: 1;
|
||||
|
||||
if (stristr(PHP_OS, "FreeBSD")) {
|
||||
$mibdir = getenv('SNMP_MIBDIR') ? getenv('SNMP_MIBDIR') : "/usr/local/share/snmp/mibs";
|
||||
$mibdir = getenv('SNMP_MIBDIR') ?: "/usr/local/share/snmp/mibs";
|
||||
} else {
|
||||
$mibdir = getenv('SNMP_MIBDIR') ? getenv('SNMP_MIBDIR') : "/usr/share/snmp/mibs";
|
||||
$mibdir = getenv('SNMP_MIBDIR') ?: "/usr/share/snmp/mibs";
|
||||
}
|
||||
|
||||
|
||||
$user_noauth = getenv('SNMP_USER_NOAUTH') ? getenv('SNMP_USER_NOAUTH') : 'noAuthUser';
|
||||
$user_auth_prefix = getenv('SNMP_USER_PREFIX') ? getenv('SNMP_USER_PREFIX') : 'admin';
|
||||
$rwuser = getenv('SNMP_RWUSER') ? getenv('SNMP_RWUSER') : ($user_auth_prefix . 'MD5AES');
|
||||
$auth_pass = getenv('SNMP_AUTH_PASS') ? getenv('SNMP_AUTH_PASS') : 'test1234';
|
||||
$priv_pass = getenv('SNMP_PRIV_PASS') ? getenv('SNMP_PRIV_PASS') : 'test1234';
|
||||
$user_noauth = getenv('SNMP_USER_NOAUTH') ?: 'noAuthUser';
|
||||
$user_auth_prefix = getenv('SNMP_USER_PREFIX') ?: 'admin';
|
||||
$rwuser = getenv('SNMP_RWUSER') ?: ($user_auth_prefix . 'MD5AES');
|
||||
$auth_pass = getenv('SNMP_AUTH_PASS') ?: 'test1234';
|
||||
$priv_pass = getenv('SNMP_PRIV_PASS') ?: 'test1234';
|
||||
|
Loading…
Reference in New Issue
Block a user