@@ -80,7 +80,7 @@ public function testDynamicHttpMethodOnlyAffectsRequestsWithBody(array $config,
80
80
81
81
public function testCurlNobodyOptionIsResetAfterHeadRequest ()
82
82
{
83
- $ client = new \ Elastica \ Client ();
83
+ $ client = $ this -> _getClient ();
84
84
$ index = $ client ->getIndex ('curl_test ' );
85
85
$ index ->create (array (), true );
86
86
$ this ->_waitForAllocation ($ index );
@@ -106,7 +106,7 @@ public function testCurlNobodyOptionIsResetAfterHeadRequest()
106
106
107
107
public function testUnicodeData ()
108
108
{
109
- $ client = new \ Elastica \ Client ();
109
+ $ client = $ this -> _getClient ();
110
110
$ index = $ client ->getIndex ('curl_test ' );
111
111
$ index ->create (array (), true );
112
112
$ this ->_waitForAllocation ($ index );
@@ -138,9 +138,9 @@ public function testUnicodeData()
138
138
139
139
public function testWithEnvironmentalProxy ()
140
140
{
141
- putenv ('http_proxy=http://127.0.0.1:12345/ ' );
141
+ putenv ('http_proxy= ' . $ this -> _getProxyUrl () );
142
142
143
- $ client = new \ Elastica \ Client ();
143
+ $ client = $ this -> _getClient ();
144
144
$ transferInfo = $ client ->request ('/_nodes ' )->getTransferInfo ();
145
145
$ this ->assertEquals (200 , $ transferInfo ['http_code ' ]);
146
146
@@ -153,14 +153,14 @@ public function testWithEnvironmentalProxy()
153
153
154
154
public function testWithEnabledEnvironmentalProxy ()
155
155
{
156
- putenv ('http_proxy=http://127.0.0.1:12346/ ' );
156
+ putenv ('http_proxy= ' . $ this -> _getProxyUrl () );
157
157
158
- $ client = new \ Elastica \ Client ();
158
+ $ client = $ this -> _getClient ();
159
159
160
160
$ transferInfo = $ client ->request ('/_nodes ' )->getTransferInfo ();
161
161
$ this ->assertEquals (403 , $ transferInfo ['http_code ' ]);
162
162
163
- $ client = new \ Elastica \ Client ();
163
+ $ client = $ this -> _getClient ();
164
164
$ client ->getConnection ()->setProxy ('' );
165
165
$ transferInfo = $ client ->request ('/_nodes ' )->getTransferInfo ();
166
166
$ this ->assertEquals (200 , $ transferInfo ['http_code ' ]);
@@ -170,16 +170,16 @@ public function testWithEnabledEnvironmentalProxy()
170
170
171
171
public function testWithProxy ()
172
172
{
173
- $ client = new \ Elastica \ Client ();
174
- $ client ->getConnection ()->setProxy (' http://127.0.0.1:12345 ' );
173
+ $ client = $ this -> _getClient ();
174
+ $ client ->getConnection ()->setProxy ($ this -> _getProxyUrl () );
175
175
176
176
$ transferInfo = $ client ->request ('/_nodes ' )->getTransferInfo ();
177
177
$ this ->assertEquals (200 , $ transferInfo ['http_code ' ]);
178
178
}
179
179
180
180
public function testWithoutProxy ()
181
181
{
182
- $ client = new \ Elastica \ Client ();
182
+ $ client = $ this -> _getClient ();
183
183
$ client ->getConnection ()->setProxy ('' );
184
184
185
185
$ transferInfo = $ client ->request ('/_nodes ' )->getTransferInfo ();
0 commit comments