update 1.0.8.0
Commits for version update
This commit is contained in:
42
vendor/guzzlehttp/psr7/tests/RequestTest.php
vendored
42
vendor/guzzlehttp/psr7/tests/RequestTest.php
vendored
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace GuzzleHttp\Tests\Psr7;
|
||||
|
||||
use GuzzleHttp\Psr7;
|
||||
use GuzzleHttp\Psr7\Request;
|
||||
use GuzzleHttp\Psr7\Uri;
|
||||
|
||||
@@ -27,15 +28,45 @@ class RequestTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testValidateRequestUri()
|
||||
{
|
||||
new Request('GET', true);
|
||||
new Request('GET', '///');
|
||||
}
|
||||
|
||||
public function testCanConstructWithBody()
|
||||
{
|
||||
$r = new Request('GET', '/', [], 'baz');
|
||||
$this->assertInstanceOf('Psr\Http\Message\StreamInterface', $r->getBody());
|
||||
$this->assertEquals('baz', (string) $r->getBody());
|
||||
}
|
||||
|
||||
public function testNullBody()
|
||||
{
|
||||
$r = new Request('GET', '/', [], null);
|
||||
$this->assertInstanceOf('Psr\Http\Message\StreamInterface', $r->getBody());
|
||||
$this->assertSame('', (string) $r->getBody());
|
||||
}
|
||||
|
||||
public function testFalseyBody()
|
||||
{
|
||||
$r = new Request('GET', '/', [], '0');
|
||||
$this->assertInstanceOf('Psr\Http\Message\StreamInterface', $r->getBody());
|
||||
$this->assertSame('0', (string) $r->getBody());
|
||||
}
|
||||
|
||||
public function testConstructorDoesNotReadStreamBody()
|
||||
{
|
||||
$streamIsRead = false;
|
||||
$body = Psr7\FnStream::decorate(Psr7\stream_for(''), [
|
||||
'__toString' => function () use (&$streamIsRead) {
|
||||
$streamIsRead = true;
|
||||
return '';
|
||||
}
|
||||
]);
|
||||
|
||||
$r = new Request('GET', '/', [], $body);
|
||||
$this->assertFalse($streamIsRead);
|
||||
$this->assertSame($body, $r->getBody());
|
||||
}
|
||||
|
||||
public function testCapitalizesMethod()
|
||||
{
|
||||
$r = new Request('get', '/');
|
||||
@@ -99,6 +130,12 @@ class RequestTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('/baz?bar=bam', $r1->getRequestTarget());
|
||||
}
|
||||
|
||||
public function testBuildsRequestTargetWithFalseyQuery()
|
||||
{
|
||||
$r1 = new Request('GET', 'http://foo.com/baz?0');
|
||||
$this->assertEquals('/baz?0', $r1->getRequestTarget());
|
||||
}
|
||||
|
||||
public function testHostIsAddedFirst()
|
||||
{
|
||||
$r = new Request('GET', 'http://foo.com/baz?bar=bam', ['Foo' => 'Bar']);
|
||||
@@ -135,10 +172,11 @@ class RequestTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testAggregatesHeaders()
|
||||
{
|
||||
$r = new Request('GET', 'http://foo.com', [
|
||||
$r = new Request('GET', '', [
|
||||
'ZOO' => 'zoobar',
|
||||
'zoo' => ['foobar', 'zoobar']
|
||||
]);
|
||||
$this->assertEquals(['ZOO' => ['zoobar', 'foobar', 'zoobar']], $r->getHeaders());
|
||||
$this->assertEquals('zoobar, foobar, zoobar', $r->getHeaderLine('zoo'));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user