mirror of
https://github.com/guzzle/guzzle.git
synced 2025-02-24 18:13:00 +01:00
Adding attach() to PostBody
This commit is contained in:
parent
46bead5c15
commit
acc07b324b
@ -2,6 +2,7 @@
|
|||||||
namespace GuzzleHttp\Post;
|
namespace GuzzleHttp\Post;
|
||||||
|
|
||||||
use GuzzleHttp\Message\RequestInterface;
|
use GuzzleHttp\Message\RequestInterface;
|
||||||
|
use GuzzleHttp\Stream\Exception\CannotAttachException;
|
||||||
use GuzzleHttp\Stream\StreamInterface;
|
use GuzzleHttp\Stream\StreamInterface;
|
||||||
use GuzzleHttp\Stream\Stream;
|
use GuzzleHttp\Stream\Stream;
|
||||||
use GuzzleHttp\Query;
|
use GuzzleHttp\Query;
|
||||||
@ -161,9 +162,9 @@ class PostBody implements PostBodyInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isDetached()
|
public function attach($stream)
|
||||||
{
|
{
|
||||||
return $this->detached;
|
throw new CannotAttachException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function eof()
|
public function eof()
|
||||||
|
@ -149,9 +149,7 @@ class PostBodyTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$b = new PostBody();
|
$b = new PostBody();
|
||||||
$b->setField('foo', 'bar');
|
$b->setField('foo', 'bar');
|
||||||
$this->assertFalse($b->isDetached());
|
|
||||||
$b->detach();
|
$b->detach();
|
||||||
$this->assertTrue($b->isDetached());
|
|
||||||
$b->close();
|
$b->close();
|
||||||
$this->assertEquals('', $b->read(10));
|
$this->assertEquals('', $b->read(10));
|
||||||
}
|
}
|
||||||
@ -162,7 +160,6 @@ class PostBodyTest extends \PHPUnit_Framework_TestCase
|
|||||||
$b->setField('foo', 'bar');
|
$b->setField('foo', 'bar');
|
||||||
$b->getContents();
|
$b->getContents();
|
||||||
$b->detach();
|
$b->detach();
|
||||||
$this->assertTrue($b->isDetached());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFlushAndMetadataPlaceholders()
|
public function testFlushAndMetadataPlaceholders()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user