diff options
Diffstat (limited to 'server/vendor/guzzlehttp/psr7/tests')
| -rw-r--r-- | server/vendor/guzzlehttp/psr7/tests/FunctionsTest.php | 10 | ||||
| -rw-r--r-- | server/vendor/guzzlehttp/psr7/tests/UriTest.php | 34 |
2 files changed, 44 insertions, 0 deletions
diff --git a/server/vendor/guzzlehttp/psr7/tests/FunctionsTest.php b/server/vendor/guzzlehttp/psr7/tests/FunctionsTest.php index de5b5cb..65cb954 100644 --- a/server/vendor/guzzlehttp/psr7/tests/FunctionsTest.php +++ b/server/vendor/guzzlehttp/psr7/tests/FunctionsTest.php @@ -546,6 +546,16 @@ class FunctionsTest extends \PHPUnit_Framework_TestCase $this->assertEquals('www.foo.com', (string) $r2->getHeaderLine('host')); } + public function testCanModifyRequestWithUriAndPort() + { + $r1 = new Psr7\Request('GET', 'http://foo.com:8000'); + $r2 = Psr7\modify_request($r1, [ + 'uri' => new Psr7\Uri('http://www.foo.com:8000') + ]); + $this->assertEquals('http://www.foo.com:8000', (string) $r2->getUri()); + $this->assertEquals('www.foo.com:8000', (string) $r2->getHeaderLine('host')); + } + public function testCanModifyRequestWithCaseInsensitiveHeader() { $r1 = new Psr7\Request('GET', 'http://foo.com', ['User-Agent' => 'foo']); diff --git a/server/vendor/guzzlehttp/psr7/tests/UriTest.php b/server/vendor/guzzlehttp/psr7/tests/UriTest.php index 2776920..a63293c 100644 --- a/server/vendor/guzzlehttp/psr7/tests/UriTest.php +++ b/server/vendor/guzzlehttp/psr7/tests/UriTest.php @@ -244,4 +244,38 @@ class UriTest extends \PHPUnit_Framework_TestCase $this->assertEquals('foo', $uri->getPath()); $this->assertEquals('bar.com/foo', (string) $uri); } + + /** + * @dataProvider pathTestNoAuthority + */ + public function testNoAuthority($input) + { + $uri = new Uri($input); + + $this->assertEquals($input, (string) $uri); + } + + public function pathTestNoAuthority() + { + return [ + // path-rootless + ['urn:example:animal:ferret:nose'], + // path-absolute + ['urn:/example:animal:ferret:nose'], + ['urn:/'], + // path-empty + ['urn:'], + ['urn'], + ]; + } + + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Unable to parse URI + */ + public function testNoAuthorityWithInvalidPath() + { + $input = 'urn://example:animal:ferret:nose'; + $uri = new Uri($input); + } } |
