@@ -32,46 +32,46 @@ class OnlineTest extends \PHPUnit_Framework_TestCase
32
32
33
33
public function setUp ()
34
34
{
35
- if (!constant ('TESTS_ZEND_AUTH_ADAPTER_LDAP_ONLINE_ENABLED ' )) {
35
+ if (!getenv ('TESTS_ZEND_AUTH_ADAPTER_LDAP_ONLINE_ENABLED ' )) {
36
36
$ this ->markTestSkipped ('LDAP online tests are not enabled ' );
37
37
}
38
38
$ this ->options = array (
39
- 'host ' => TESTS_ZEND_LDAP_HOST ,
40
- 'username ' => TESTS_ZEND_LDAP_USERNAME ,
41
- 'password ' => TESTS_ZEND_LDAP_PASSWORD ,
42
- 'baseDn ' => TESTS_ZEND_LDAP_BASE_DN ,
39
+ 'host ' => getenv ( ' TESTS_ZEND_LDAP_HOST ' ) ,
40
+ 'username ' => getenv ( ' TESTS_ZEND_LDAP_USERNAME ' ) ,
41
+ 'password ' => getenv ( ' TESTS_ZEND_LDAP_PASSWORD ' ) ,
42
+ 'baseDn ' => getenv ( ' TESTS_ZEND_LDAP_BASE_DN ' ) ,
43
43
);
44
- if (defined ('TESTS_ZEND_LDAP_PORT ' )) {
45
- $ this ->options ['port ' ] = TESTS_ZEND_LDAP_PORT ;
44
+ if (getenv ('TESTS_ZEND_LDAP_PORT ' )) {
45
+ $ this ->options ['port ' ] = getenv ( ' TESTS_ZEND_LDAP_PORT ' ) ;
46
46
}
47
- if (defined ('TESTS_ZEND_LDAP_USE_START_TLS ' )) {
48
- $ this ->options ['useStartTls ' ] = TESTS_ZEND_LDAP_USE_START_TLS ;
47
+ if (getenv ('TESTS_ZEND_LDAP_USE_START_TLS ' )) {
48
+ $ this ->options ['useStartTls ' ] = getenv ( ' TESTS_ZEND_LDAP_USE_START_TLS ' ) ;
49
49
}
50
- if (defined ('TESTS_ZEND_LDAP_USE_SSL ' )) {
51
- $ this ->options ['useSsl ' ] = TESTS_ZEND_LDAP_USE_SSL ;
50
+ if (getenv ('TESTS_ZEND_LDAP_USE_SSL ' )) {
51
+ $ this ->options ['useSsl ' ] = getenv ( ' TESTS_ZEND_LDAP_USE_SSL ' ) ;
52
52
}
53
- if (defined ('TESTS_ZEND_LDAP_BIND_REQUIRES_DN ' )) {
54
- $ this ->options ['bindRequiresDn ' ] = TESTS_ZEND_LDAP_BIND_REQUIRES_DN ;
53
+ if (getenv ('TESTS_ZEND_LDAP_BIND_REQUIRES_DN ' )) {
54
+ $ this ->options ['bindRequiresDn ' ] = getenv ( ' TESTS_ZEND_LDAP_BIND_REQUIRES_DN ' ) ;
55
55
}
56
- if (defined ('TESTS_ZEND_LDAP_ACCOUNT_FILTER_FORMAT ' )) {
57
- $ this ->options ['accountFilterFormat ' ] = TESTS_ZEND_LDAP_ACCOUNT_FILTER_FORMAT ;
56
+ if (getenv ('TESTS_ZEND_LDAP_ACCOUNT_FILTER_FORMAT ' )) {
57
+ $ this ->options ['accountFilterFormat ' ] = getenv ( ' TESTS_ZEND_LDAP_ACCOUNT_FILTER_FORMAT ' ) ;
58
58
}
59
- if (defined ('TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME ' )) {
60
- $ this ->options ['accountDomainName ' ] = TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME ;
59
+ if (getenv ('TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME ' )) {
60
+ $ this ->options ['accountDomainName ' ] = getenv ( ' TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME ' ) ;
61
61
}
62
- if (defined ('TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME_SHORT ' )) {
63
- $ this ->options ['accountDomainNameShort ' ] = TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME_SHORT ;
62
+ if (getenv ('TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME_SHORT ' )) {
63
+ $ this ->options ['accountDomainNameShort ' ] = getenv ( ' TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME_SHORT ' ) ;
64
64
}
65
65
66
- if (defined ('TESTS_ZEND_LDAP_ALT_USERNAME ' )) {
67
- $ this ->names [Ldap \Ldap::ACCTNAME_FORM_USERNAME ] = TESTS_ZEND_LDAP_ALT_USERNAME ;
68
- if (defined ('TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME ' )) {
66
+ if (getenv ('TESTS_ZEND_LDAP_ALT_USERNAME ' )) {
67
+ $ this ->names [Ldap \Ldap::ACCTNAME_FORM_USERNAME ] = getenv ( ' TESTS_ZEND_LDAP_ALT_USERNAME ' ) ;
68
+ if (getenv ('TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME ' )) {
69
69
$ this ->names [Ldap \Ldap::ACCTNAME_FORM_PRINCIPAL ] =
70
- TESTS_ZEND_LDAP_ALT_USERNAME . '@ ' . TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME ;
70
+ getenv ( ' TESTS_ZEND_LDAP_ALT_USERNAME ' ) . '@ ' . getenv ( ' TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME ' ) ;
71
71
}
72
- if (defined ('TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME_SHORT ' )) {
72
+ if (getenv ('TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME_SHORT ' )) {
73
73
$ this ->names [Ldap \Ldap::ACCTNAME_FORM_BACKSLASH ] =
74
- TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME_SHORT . '\\' . TESTS_ZEND_LDAP_ALT_USERNAME ;
74
+ getenv ( ' TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME_SHORT ' ) . '\\' . getenv ( ' TESTS_ZEND_LDAP_ALT_USERNAME ' ) ;
75
75
}
76
76
}
77
77
}
@@ -80,8 +80,8 @@ public function testSimpleAuth()
80
80
{
81
81
$ adapter = new Adapter \Ldap (
82
82
array ($ this ->options ),
83
- TESTS_ZEND_LDAP_ALT_USERNAME ,
84
- TESTS_ZEND_LDAP_ALT_PASSWORD
83
+ getenv ( ' TESTS_ZEND_LDAP_ALT_USERNAME ' ) ,
84
+ getenv ( ' TESTS_ZEND_LDAP_ALT_PASSWORD ' )
85
85
);
86
86
87
87
$ result = $ adapter ->authenticate ();
@@ -103,7 +103,7 @@ public function testCanonAuth()
103
103
$ options = $ this ->options ;
104
104
$ options ['accountCanonicalForm ' ] = $ form ;
105
105
$ adapter = new Adapter \Ldap (array ($ options ));
106
- $ adapter ->setPassword (TESTS_ZEND_LDAP_ALT_PASSWORD );
106
+ $ adapter ->setPassword (getenv ( ' TESTS_ZEND_LDAP_ALT_PASSWORD ' ) );
107
107
foreach ($ this ->names as $ username ) {
108
108
$ adapter ->setUsername ($ username );
109
109
$ result = $ adapter ->authenticate ();
@@ -119,7 +119,7 @@ public function testInvalidPassAuth()
119
119
{
120
120
$ adapter = new Adapter \Ldap (
121
121
array ($ this ->options ),
122
- TESTS_ZEND_LDAP_ALT_USERNAME ,
122
+ getenv ( ' TESTS_ZEND_LDAP_ALT_USERNAME ' ) ,
123
123
'invalid '
124
124
);
125
125
@@ -166,24 +166,24 @@ public function testAccountObjectRetrieval()
166
166
{
167
167
$ adapter = new Adapter \Ldap (
168
168
array ($ this ->options ),
169
- TESTS_ZEND_LDAP_ALT_USERNAME ,
170
- TESTS_ZEND_LDAP_ALT_PASSWORD
169
+ getenv ( ' TESTS_ZEND_LDAP_ALT_USERNAME ' ) ,
170
+ getenv ( ' TESTS_ZEND_LDAP_ALT_PASSWORD ' )
171
171
);
172
172
173
173
$ result = $ adapter ->authenticate ();
174
174
$ account = $ adapter ->getAccountObject ();
175
175
176
176
//$this->assertTrue($result->isValid());
177
177
$ this ->assertInternalType ('object ' , $ account );
178
- $ this ->assertEquals (TESTS_ZEND_LDAP_ALT_DN , $ account ->dn );
178
+ $ this ->assertEquals (getenv ( ' TESTS_ZEND_LDAP_ALT_DN ' ) , $ account ->dn );
179
179
}
180
180
181
181
public function testAccountObjectRetrievalWithOmittedAttributes ()
182
182
{
183
183
$ adapter = new Adapter \Ldap (
184
184
array ($ this ->options ),
185
- TESTS_ZEND_LDAP_ALT_USERNAME ,
186
- TESTS_ZEND_LDAP_ALT_PASSWORD
185
+ getenv ( ' TESTS_ZEND_LDAP_ALT_USERNAME ' ) ,
186
+ getenv ( ' TESTS_ZEND_LDAP_ALT_PASSWORD ' )
187
187
);
188
188
189
189
$ result = $ adapter ->authenticate ();
0 commit comments