Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding failing test for zendframework/zf2#3033

  • Loading branch information...
commit 0c8554b59ea87a11478f5ec66a738458bde902f4 1 parent 72d29c0
@Ocramius authored
View
12 tests/ZendTest/Http/Client/SocketTest.php
@@ -11,6 +11,7 @@
namespace ZendTest\Http\Client;
use Zend\Http\Client\Adapter;
+use Zend\Uri\Uri;
/**
* This Testsuite includes all Zend_Http_Client that require a working web
@@ -250,6 +251,17 @@ public function testMultibyteChunkedResponseZF6218()
}
/**
+ * Verifies that writing on a socket is considered valid even if 0 bytes
+ * were written.
+ */
+ public function testAllowsZeroWrittenBytes()
+ {
+ $this->_adapter->connect('localhost');
+ require_once __DIR__ . '/_files/fwrite.php';
+ $this->_adapter->write('GET', new Uri('tcp://localhost:80/'), '1.1', array(), 'test body');
+ }
+
+ /**
* Data Providers
*/
View
22 tests/ZendTest/Http/Client/_files/fwrite.php
@@ -0,0 +1,22 @@
+<?php
+/**
+ * Zend Framework (http://framework.zend.com/)
+ *
+ * @link http://github.com/zendframework/zf2 for the canonical source repository
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @package Zend_Http
+ */
+
+namespace Zend\Http\Client\Adapter;
+
+/**
+ * This is a stub for PHP's `fwrite` function. It
+ * allows us to check that a write operation to a
+ * socket producing a returned "0 bytes" written
+ * is actually valid.
+ */
+function fwrite($socket, $request)
+{
+ return 0;
+}
Please sign in to comment.
Something went wrong with that request. Please try again.