mirror of
https://github.com/guzzle/guzzle.git
synced 2025-03-14 19:29:49 +01:00
Updating to use guzzle streams 3.0
This commit is contained in:
parent
18e2a5d4e5
commit
ef0c3c1d56
@ -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"
|
||||
},
|
||||
|
@ -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.
|
||||
*
|
||||
|
@ -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');
|
||||
}
|
||||
|
||||
|
@ -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"',
|
||||
|
Loading…
x
Reference in New Issue
Block a user