Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Commit d3c9780

Browse files
committed
Merge branch 'master' of git://github.com/zendframework/zf2 into useStatementFixes
28 parents 9c15ae8 + 66a4342 + 85c9491 + 8ec8384 + 004366f + 55a086d + ac7c7af + f02a226 + 00c4ac3 + 3f52720 + 5508474 + 49ed2f6 + d562686 + 67b42b2 + bdb1dae + 9809630 + 7304e37 + 752a5af + 8181c8f + 53bdac2 + c2f9414 + f6341e9 + 57cde95 + c750616 + 293054e + 7432649 + 4d278ac + 63f13f6 commit d3c9780

File tree

3 files changed

+41
-8
lines changed

3 files changed

+41
-8
lines changed

src/Response.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,9 @@ public function getReasonPhrase()
327327
/**
328328
* Set HTTP status code and (optionally) message
329329
*
330-
* @param numeric $code
331-
* @return Response
330+
* @param integer $code
331+
* @throws Exception\InvalidArgumentException
332+
* @return \Zend\Http\Response
332333
*/
333334
public function setStatusCode($code)
334335
{

test/Client/StaticTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,9 @@ public function testGetLastRawResponseWhenNotStoring()
342342
*/
343343
public function testInvalidPostContentType()
344344
{
345+
if (!constant('TESTS_ZEND_HTTP_CLIENT_ONLINE')) {
346+
$this->markTestSkipped('Zend\Http\Client online tests are not enabled');
347+
}
345348
$this->setExpectedException(
346349
'Zend\Http\Exception\RuntimeException',
347350
'Cannot handle content type \'x-foo/something-fake\' automatically');
@@ -359,6 +362,9 @@ public function testInvalidPostContentType()
359362
*/
360363
public function testSocketErrorException()
361364
{
365+
if (!constant('TESTS_ZEND_HTTP_CLIENT_ONLINE')) {
366+
$this->markTestSkipped('Zend\Http\Client online tests are not enabled');
367+
}
362368
$this->setExpectedException(
363369
'Zend\Http\Client\Adapter\Exception\RuntimeException',
364370
'Unable to Connect to tcp://255.255.255.255:80');
@@ -395,6 +401,9 @@ public function testSettingInvalidMethodThrowsException($method)
395401
*/
396402
public function testFormDataEncodingWithMultiArrayZF7038()
397403
{
404+
if (!constant('TESTS_ZEND_HTTP_CLIENT_ONLINE')) {
405+
$this->markTestSkipped('Zend\Http\Client online tests are not enabled');
406+
}
398407
$this->_client->setAdapter('Zend\Http\Client\Adapter\Test');
399408
$this->_client->setUri('http://example.com');
400409
$this->_client->setEncType(HTTPClient::ENC_FORMDATA);
@@ -439,6 +448,9 @@ public function testFormDataEncodingWithMultiArrayZF7038()
439448
*/
440449
public function testMultibyteRawPostDataZF2098()
441450
{
451+
if (!constant('TESTS_ZEND_HTTP_CLIENT_ONLINE')) {
452+
$this->markTestSkipped('Zend\Http\Client online tests are not enabled');
453+
}
442454
$this->_client->setAdapter('Zend\Http\Client\Adapter\Test');
443455
$this->_client->setUri('http://example.com');
444456

@@ -464,6 +476,9 @@ public function testMultibyteRawPostDataZF2098()
464476
*/
465477
public function testOpenTempStreamWithValidFileDoesntThrowsException()
466478
{
479+
if (!constant('TESTS_ZEND_HTTP_CLIENT_ONLINE')) {
480+
$this->markTestSkipped('Zend\Http\Client online tests are not enabled');
481+
}
467482
$url = 'http://www.example.com/';
468483
$config = array (
469484
'outputstream' => realpath(__DIR__ . '/_files/zend_http_client_stream.file'),
@@ -486,6 +501,9 @@ public function testOpenTempStreamWithValidFileDoesntThrowsException()
486501
*/
487502
public function testOpenTempStreamWithBogusFileClosesTheConnection()
488503
{
504+
if (!constant('TESTS_ZEND_HTTP_CLIENT_ONLINE')) {
505+
$this->markTestSkipped('Zend\Http\Client online tests are not enabled');
506+
}
489507
$this->setExpectedException(
490508
'Zend\Http\Exception\RuntimeException',
491509
'Could not open temp file /path/to/bogus/file.ext');
@@ -506,6 +524,9 @@ public function testOpenTempStreamWithBogusFileClosesTheConnection()
506524
*/
507525
public function testEncodedCookiesInRequestHeaders()
508526
{
527+
if (!constant('TESTS_ZEND_HTTP_CLIENT_ONLINE')) {
528+
$this->markTestSkipped('Zend\Http\Client online tests are not enabled');
529+
}
509530
$this->_client->addCookie('foo', 'bar=baz');
510531
$this->_client->send();
511532
$cookieValue = 'Cookie: foo='.urlencode('bar=baz');
@@ -520,6 +541,9 @@ public function testEncodedCookiesInRequestHeaders()
520541
*/
521542
public function testRawCookiesInRequestHeaders()
522543
{
544+
if (!constant('TESTS_ZEND_HTTP_CLIENT_ONLINE')) {
545+
$this->markTestSkipped('Zend\Http\Client online tests are not enabled');
546+
}
523547
$this->_client->setOptions(array('encodecookies' => false));
524548
$this->_client->addCookie('foo', 'bar=baz');
525549
$this->_client->send();

test/Client/UseCaseTest.php

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class UseCaseTest extends \PHPUnit_Framework_TestCase
2626
*
2727
* @var string
2828
*/
29-
protected $baseuri = 'http://www.google.com/';
29+
protected $baseuri;
3030

3131
/**
3232
* Common HTTP client
@@ -56,7 +56,15 @@ class UseCaseTest extends \PHPUnit_Framework_TestCase
5656
*/
5757
protected function setUp()
5858
{
59-
$this->client= new HTTPClient($this->baseuri);
59+
if (defined('TESTS_ZEND_HTTP_CLIENT_BASEURI')
60+
&& (TESTS_ZEND_HTTP_CLIENT_BASEURI != false)
61+
) {
62+
$this->baseuri = TESTS_ZEND_HTTP_CLIENT_BASEURI;
63+
$this->client = new HTTPClient($this->baseuri);
64+
} else {
65+
// Skip tests
66+
$this->markTestSkipped("Zend_Http_Client dynamic tests are not enabled in TestConfiguration.php");
67+
}
6068
}
6169

6270
/**
@@ -67,20 +75,20 @@ protected function tearDown()
6775
{
6876
$this->client = null;
6977
}
70-
78+
7179
public function testHttpGet()
7280
{
7381
$this->client->setMethod(Request::METHOD_GET);
7482
$response= $this->client->send();
7583
$this->assertTrue($response->isSuccess());
7684
}
77-
85+
7886
public function testStaticHttpGet()
7987
{
8088
// $response= HTTPClient::get($this->baseuri);
8189
// $this->assertTrue($response->isSuccess());
8290
}
83-
91+
8492
public function testRequestHttpGet()
8593
{
8694
$client= new HTTPClient();
@@ -90,5 +98,5 @@ public function testRequestHttpGet()
9098
$response= $client->send($request);
9199
$this->assertTrue($response->isSuccess());
92100
}
93-
101+
94102
}

0 commit comments

Comments
 (0)