diff --git a/src/Message/Message.php b/src/Message/Message.php index fc791da..217bdc8 100644 --- a/src/Message/Message.php +++ b/src/Message/Message.php @@ -4,7 +4,6 @@ namespace WellRESTed\Message; use Psr\Http\Message\MessageInterface; use Psr\Http\Message\StreamInterface; -use WellRESTed\Stream\NullStream; abstract class Message implements MessageInterface { diff --git a/src/Stream/NullStream.php b/src/Message/NullStream.php similarity index 99% rename from src/Stream/NullStream.php rename to src/Message/NullStream.php index c8d837e..ac3c650 100644 --- a/src/Stream/NullStream.php +++ b/src/Message/NullStream.php @@ -1,6 +1,6 @@ assertNull($stream->close()); } /** - * @covers WellRESTed\Stream\NullStream::detach() - * @uses WellRESTed\Stream\Stream + * @covers WellRESTed\Message\NullStream::detach() + * @uses WellRESTed\Message\Stream */ public function testDetachReturnsNull() { - $stream = new NullStream(); + $stream = new \WellRESTed\Message\NullStream(); $this->assertNull($stream->detach()); } /** - * @covers WellRESTed\Stream\NullStream::getSize - * @uses WellRESTed\Stream\Stream + * @covers WellRESTed\Message\NullStream::getSize + * @uses WellRESTed\Message\Stream */ public function testSizeReturnsZero() { - $stream = new NullStream(); + $stream = new \WellRESTed\Message\NullStream(); $this->assertEquals(0, $stream->getSize()); } /** - * @covers WellRESTed\Stream\NullStream::tell + * @covers WellRESTed\Message\NullStream::tell */ public function testTellReturnsFalse() { - $stream = new NullStream(); + $stream = new \WellRESTed\Message\NullStream(); $this->assertFalse($stream->tell()); } /** - * @covers WellRESTed\Stream\NullStream::eof + * @covers WellRESTed\Message\NullStream::eof */ public function testEofReturnsReturnsTrue() { - $stream = new NullStream(); + $stream = new \WellRESTed\Message\NullStream(); $this->assertTrue($stream->eof()); } /** - * @covers WellRESTed\Stream\NullStream::isSeekable - * @uses WellRESTed\Stream\Stream + * @covers WellRESTed\Message\NullStream::isSeekable + * @uses WellRESTed\Message\Stream */ public function testIsSeekableReturnsFalse() { - $stream = new NullStream(); + $stream = new \WellRESTed\Message\NullStream(); $this->assertFalse($stream->isSeekable()); } /** - * @covers WellRESTed\Stream\NullStream::seek + * @covers WellRESTed\Message\NullStream::seek */ public function testSeekReturnsFalse() { @@ -78,16 +78,16 @@ class NullStreamTest extends \PHPUnit_Framework_TestCase } /** - * @covers WellRESTed\Stream\NullStream::rewind + * @covers WellRESTed\Message\NullStream::rewind */ public function testRewindReturnsFalse() { - $stream = new NullStream(); + $stream = new \WellRESTed\Message\NullStream(); $this->assertFalse($stream->rewind()); } /** - * @covers WellRESTed\Stream\NullStream::isWritable + * @covers WellRESTed\Message\NullStream::isWritable */ public function testIsWritableReturnsFalse() { @@ -96,34 +96,34 @@ class NullStreamTest extends \PHPUnit_Framework_TestCase } /** - * @covers WellRESTed\Stream\NullStream::write + * @covers WellRESTed\Message\NullStream::write */ public function testWriteReturnsFalse() { - $stream = new NullStream(); + $stream = new \WellRESTed\Message\NullStream(); $this->assertFalse($stream->write("")); } /** - * @covers WellRESTed\Stream\NullStream::isReadable + * @covers WellRESTed\Message\NullStream::isReadable */ public function testIsReableReturnsTrue() { - $stream = new NullStream(); + $stream = new \WellRESTed\Message\NullStream(); $this->assertTrue($stream->isReadable()); } /** - * @covers WellRESTed\Stream\NullStream::read + * @covers WellRESTed\Message\NullStream::read */ public function testReadReturnsEmptyString() { - $stream = new NullStream(); + $stream = new \WellRESTed\Message\NullStream(); $this->assertEquals("", $stream->read(100)); } /** - * @covers WellRESTed\Stream\NullStream::getContents + * @covers WellRESTed\Message\NullStream::getContents */ public function testGetContentsReturnsEmptyString() { @@ -132,20 +132,20 @@ class NullStreamTest extends \PHPUnit_Framework_TestCase } /** - * @covers WellRESTed\Stream\NullStream::getMetadata + * @covers WellRESTed\Message\NullStream::getMetadata */ public function testGetMetadataReturnsNull() { - $stream = new NullStream(); + $stream = new \WellRESTed\Message\NullStream(); $this->assertNull($stream->getMetadata()); } /** - * @covers WellRESTed\Stream\NullStream::getMetadata + * @covers WellRESTed\Message\NullStream::getMetadata */ public function testGetMetadataReturnsNullWithKey() { - $stream = new NullStream(); + $stream = new \WellRESTed\Message\NullStream(); $this->assertNull($stream->getMetadata("size")); } } diff --git a/test/tests/unit/Message/ServerRequestTest.php b/test/tests/unit/Message/ServerRequestTest.php index 00800b9..d5dec13 100644 --- a/test/tests/unit/Message/ServerRequestTest.php +++ b/test/tests/unit/Message/ServerRequestTest.php @@ -9,7 +9,7 @@ use WellRESTed\Message\ServerRequest; * @uses WellRESTed\Message\Request * @uses WellRESTed\Message\Message * @uses WellRESTed\Message\HeaderCollection - * @uses WellRESTed\Stream\Stream + * @uses WellRESTed\Message\Stream */ class ServerRequestTest extends \PHPUnit_Framework_TestCase { diff --git a/test/tests/unit/Stream/StreamTest.php b/test/tests/unit/Message/StreamTest.php similarity index 72% rename from test/tests/unit/Stream/StreamTest.php rename to test/tests/unit/Message/StreamTest.php index d6fa259..f96e119 100644 --- a/test/tests/unit/Stream/StreamTest.php +++ b/test/tests/unit/Message/StreamTest.php @@ -1,11 +1,11 @@ resource); + $stream = new \WellRESTed\Message\Stream($this->resource); $this->assertNotNull($stream); } public function testCreatesInstanceWithString() { - $stream = new Stream("Hello, world!"); + $stream = new \WellRESTed\Message\Stream("Hello, world!"); $this->assertNotNull($stream); } /** - * @covers WellRESTed\Stream\Stream::__construct() + * @covers WellRESTed\Message\Stream::__construct() * @expectedException \InvalidArgumentException * @dataProvider invalidResourceProvider */ public function testThrowsExceptiondWithInvalidResource($resource) { - new Stream($resource); + new \WellRESTed\Message\Stream($resource); } public function invalidResourceProvider() @@ -61,16 +61,16 @@ class StreamTest extends \PHPUnit_Framework_TestCase } /** - * @covers WellRESTed\Stream\Stream::__toString() + * @covers WellRESTed\Message\Stream::__toString() */ public function testCastsToString() { - $stream = new Stream($this->resource); + $stream = new \WellRESTed\Message\Stream($this->resource); $this->assertEquals($this->content, (string) $stream); } /** - * @covers WellRESTed\Stream\Stream::close() + * @covers WellRESTed\Message\Stream::close() */ public function testClosesHandle() { @@ -80,7 +80,7 @@ class StreamTest extends \PHPUnit_Framework_TestCase } /** - * @covers WellRESTed\Stream\Stream::detach() + * @covers WellRESTed\Message\Stream::detach() */ public function testDetachReturnsHandle() { @@ -89,36 +89,36 @@ class StreamTest extends \PHPUnit_Framework_TestCase } /** - * @covers WellRESTed\Stream\Stream::detach() + * @covers WellRESTed\Message\Stream::detach() */ public function testDetachUnsetsInstanceVariable() { - $stream = new Stream($this->resource); + $stream = new \WellRESTed\Message\Stream($this->resource); $stream->detach(); $this->assertNull($stream->detach()); } /** - * @covers WellRESTed\Stream\Stream::getSize + * @covers WellRESTed\Message\Stream::getSize */ public function testReturnsSize() { - $stream = new Stream($this->resource); + $stream = new \WellRESTed\Message\Stream($this->resource); $this->assertEquals(strlen($this->content), $stream->getSize()); } /** - * @covers WellRESTed\Stream\Stream::tell + * @covers WellRESTed\Message\Stream::tell */ public function testTellReturnsHandlePosition() { - $stream = new Stream($this->resource); + $stream = new \WellRESTed\Message\Stream($this->resource); fseek($this->resource, 10); $this->assertEquals(10, $stream->tell()); } /** - * @covers WellRESTed\Stream\Stream::eof + * @covers WellRESTed\Message\Stream::eof */ public function testReturnsOef() { @@ -130,28 +130,28 @@ class StreamTest extends \PHPUnit_Framework_TestCase } /** - * @covers WellRESTed\Stream\Stream::isSeekable + * @covers WellRESTed\Message\Stream::isSeekable */ public function testReadsSeekableStatusFromMetadata() { - $stream = new Stream($this->resource); + $stream = new \WellRESTed\Message\Stream($this->resource); $metadata = stream_get_meta_data($this->resource); $seekable = $metadata["seekable"] == 1; $this->assertEquals($seekable, $stream->isSeekable()); } /** - * @covers WellRESTed\Stream\Stream::seek + * @covers WellRESTed\Message\Stream::seek */ public function testSeeksToPosition() { - $stream = new Stream($this->resource); + $stream = new \WellRESTed\Message\Stream($this->resource); $stream->seek(10); $this->assertEquals(10, ftell($this->resource)); } /** - * @covers WellRESTed\Stream\Stream::rewind + * @covers WellRESTed\Message\Stream::rewind */ public function testRewindReturnsToBeginning() { @@ -162,29 +162,29 @@ class StreamTest extends \PHPUnit_Framework_TestCase } /** - * @covers WellRESTed\Stream\Stream::write + * @covers WellRESTed\Message\Stream::write */ public function testWritesToHandle() { $message = "\nThis is a stream."; - $stream = new Stream($this->resource); + $stream = new \WellRESTed\Message\Stream($this->resource); $stream->write($message); $this->assertEquals($this->content . $message, (string) $stream); } /** - * @covers WellRESTed\Stream\Stream::read + * @covers WellRESTed\Message\Stream::read */ public function testReadsFromStream() { - $stream = new Stream($this->resource); + $stream = new \WellRESTed\Message\Stream($this->resource); $stream->seek(7); $string = $stream->read(5); $this->assertEquals("world", $string); } /** - * @covers WellRESTed\Stream\Stream::getContents + * @covers WellRESTed\Message\Stream::getContents */ public function testReadsToEnd() { @@ -195,16 +195,16 @@ class StreamTest extends \PHPUnit_Framework_TestCase } /** - * @covers WellRESTed\Stream\Stream::getMetadata + * @covers WellRESTed\Message\Stream::getMetadata */ public function testReturnsMetadataArray() { - $stream = new Stream($this->resource); + $stream = new \WellRESTed\Message\Stream($this->resource); $this->assertEquals(stream_get_meta_data($this->resource), $stream->getMetadata()); } /** - * @covers WellRESTed\Stream\Stream::getMetadata + * @covers WellRESTed\Message\Stream::getMetadata */ public function testReturnsMetadataItem() { @@ -214,7 +214,7 @@ class StreamTest extends \PHPUnit_Framework_TestCase } /** - * @covers WellRESTed\Stream\Stream::isReadable + * @covers WellRESTed\Message\Stream::isReadable * @dataProvider modeProvider */ public function testReturnsIsReadableForReadableStreams($mode, $readable, $writeable) @@ -229,7 +229,7 @@ class StreamTest extends \PHPUnit_Framework_TestCase } /** - * @covers WellRESTed\Stream\Stream::isWritable + * @covers WellRESTed\Message\Stream::isWritable * @dataProvider modeProvider */ public function testReturnsIsWritableForWritableStreams($mode, $readable, $writeable) @@ -239,7 +239,7 @@ class StreamTest extends \PHPUnit_Framework_TestCase unlink($tmp); } $resource = fopen($tmp, $mode); - $stream = new Stream($resource); + $stream = new \WellRESTed\Message\Stream($resource); $this->assertEquals($writeable, $stream->isWritable()); } diff --git a/test/tests/unit/Routing/RouterTest.php b/test/tests/unit/Routing/RouterTest.php index 06b6ae7..39fb59c 100644 --- a/test/tests/unit/Routing/RouterTest.php +++ b/test/tests/unit/Routing/RouterTest.php @@ -17,7 +17,7 @@ use WellRESTed\Routing\Router; * @uses WellRESTed\Routing\Route\PrefixRoute * @uses WellRESTed\Routing\Route\StaticRoute * @uses WellRESTed\Routing\Route\Route - * @uses WellRESTed\Stream\Stream + * @uses WellRESTed\Message\Stream */ class RouterTest extends \PHPUnit_Framework_TestCase {