From ef0c3c1d56d1ef724eb9f558e5de2728c668cafe Mon Sep 17 00:00:00 2001
From: Michael Dowling <mtdowling@gmail.com>
Date: Sun, 7 Sep 2014 20:12:34 -0700
Subject: [PATCH] Updating to use guzzle streams 3.0

---
 composer.json               |  5 +++--
 src/Post/PostBody.php       |  5 +++++
 src/Post/PostFile.php       |  5 +----
 tests/Post/PostFileTest.php | 10 ++--------
 4 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/composer.json b/composer.json
index c1ef1890..f1424b44 100644
--- a/composer.json
+++ b/composer.json
@@ -14,9 +14,10 @@
     ],
     "require": {
         "php": ">=5.4.0",
-        "guzzlehttp/streams": "~2.1",
-        "guzzlehttp/ring": "~0.1@dev"
+        "guzzlehttp/ring": "0.1.*@dev",
+        "guzzlehttp/streams": "3.0.*@dev"
     },
+    "minimum-stability": "dev",
     "suggest": {
         "ext-curl": "Guzzle will use specific adapters if cURL is present"
     },
diff --git a/src/Post/PostBody.php b/src/Post/PostBody.php
index 1fe1c3bf..32ab7fdb 100644
--- a/src/Post/PostBody.php
+++ b/src/Post/PostBody.php
@@ -205,6 +205,11 @@ class PostBody implements PostBodyInterface
         return false;
     }
 
+    public function getMetadata($key = null)
+    {
+        return $key ? null : [];
+    }
+
     /**
      * Return a stream object that is built from the POST fields and files.
      *
diff --git a/src/Post/PostFile.php b/src/Post/PostFile.php
index a2922e18..3803d2a5 100644
--- a/src/Post/PostFile.php
+++ b/src/Post/PostFile.php
@@ -2,7 +2,6 @@
 namespace GuzzleHttp\Post;
 
 use GuzzleHttp\Mimetypes;
-use GuzzleHttp\Stream\MetadataStreamInterface;
 use GuzzleHttp\Stream\StreamInterface;
 use GuzzleHttp\Stream\Stream;
 
@@ -92,9 +91,7 @@ class PostFile implements PostFileInterface
     {
         $this->filename = $filename;
 
-        if (!$this->filename &&
-            $this->content instanceof MetadataStreamInterface
-        ) {
+        if (!$this->filename) {
             $this->filename = $this->content->getMetadata('uri');
         }
 
diff --git a/tests/Post/PostFileTest.php b/tests/Post/PostFileTest.php
index 2dcdbc92..800cee50 100644
--- a/tests/Post/PostFileTest.php
+++ b/tests/Post/PostFileTest.php
@@ -1,6 +1,7 @@
 <?php
 namespace GuzzleHttp\Tests\Post;
 
+use GuzzleHttp\Post\MultipartBody;
 use GuzzleHttp\Post\PostFile;
 use GuzzleHttp\Stream\Stream;
 
@@ -36,14 +37,7 @@ class PostFileTest extends \PHPUnit_Framework_TestCase
 
     public function testCreatesFromMultipartFormData()
     {
-        $mp = $this->getMockBuilder('GuzzleHttp\Post\MultipartBody')
-            ->setMethods(['getBoundary'])
-            ->disableOriginalConstructor()
-            ->getMock();
-        $mp->expects($this->once())
-            ->method('getBoundary')
-            ->will($this->returnValue('baz'));
-
+        $mp = new MultipartBody([], [], 'baz');
         $p = new PostFile('foo', $mp);
         $this->assertEquals(
             'form-data; name="foo"',