Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 518d102

Browse files
committed
Updated tests to reflect PSR-7 spec
- Request method MUST be a string; it CAN be empty. - Request MUST contain a UriInterface instance; the instance CAN be empty.
1 parent 0a9604a commit 518d102

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

test/RequestTest.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ public function setUp()
2626
$this->request = new Request();
2727
}
2828

29-
public function testMethodIsNullByDefault()
29+
public function testMethodIsEmptyByDefault()
3030
{
31-
$this->assertNull($this->request->getMethod());
31+
$this->assertSame('', $this->request->getMethod());
3232
}
3333

3434
public function testMethodMutatorReturnsCloneWithChangedMethod()
@@ -38,9 +38,18 @@ public function testMethodMutatorReturnsCloneWithChangedMethod()
3838
$this->assertEquals('GET', $request->getMethod());
3939
}
4040

41-
public function testUriIsNullByDefault()
41+
public function testReturnsUnpopulatedUriByDefault()
4242
{
43-
$this->assertNull($this->request->getUri());
43+
$uri = $this->request->getUri();
44+
$this->assertInstanceOf('Psr\Http\Message\UriInterface', $uri);
45+
$this->assertInstanceOf('Zend\Diactoros\Uri', $uri);
46+
$this->assertEmpty($uri->getScheme());
47+
$this->assertEmpty($uri->getUserInfo());
48+
$this->assertEmpty($uri->getHost());
49+
$this->assertNull($uri->getPort());
50+
$this->assertEmpty($uri->getPath());
51+
$this->assertEmpty($uri->getQuery());
52+
$this->assertEmpty($uri->getFragment());
4453
}
4554

4655
public function testConstructorRaisesExceptionForInvalidStream()

0 commit comments

Comments
 (0)