Skip to content

Fix encoding stream size #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

## Fixed

- FilteredStream::getSize returns null because the contents size is unknown.

### Deprecated

- FilteredStream::getReadFilter The read filter is internal and should never be used by consuming code.
Expand Down
8 changes: 8 additions & 0 deletions spec/Encoding/ChunkStreamSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,12 @@ function it_chunks_in_multiple()

$this->getContents()->shouldReturn("6\r\nThis i\r\n6\r\ns a st\r\n4\r\nream\r\n0\r\n\r\n");
}

function it_does_not_know_the_content_size()
{
$stream = new MemoryStream('This is a stream');
$this->beConstructedWith($stream, 6);

$this->getSize()->shouldReturn(null);
}
}
9 changes: 9 additions & 0 deletions spec/Encoding/CompressStreamSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,13 @@ function it_gets_content()
$stream->rewind();
$this->getContents()->shouldReturn(gzcompress('This is a test stream'));
}

function it_does_not_know_the_content_size()
{
$stream = new MemoryStream('This is a test stream');
$this->beConstructedWith($stream);

$stream->rewind();
$this->getSize()->shouldReturn(null);
}
}
8 changes: 8 additions & 0 deletions spec/Encoding/DechunkStreamSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,12 @@ function it_gets_content()

$this->getContents()->shouldReturn('test');
}

function it_does_not_know_the_content_size()
{
$stream = new MemoryStream("4\r\ntest\r\n4\r\ntest\r\n0\r\n\r\n\0");
$this->beConstructedWith($stream);

$this->getSize()->shouldReturn(null);
}
}
8 changes: 8 additions & 0 deletions spec/Encoding/DecompressStreamSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,12 @@ function it_gets_content()

$this->getContents()->shouldReturn('This is a test stream');
}

function it_does_not_know_the_content_size()
{
$stream = new MemoryStream(gzcompress('This is a test stream'));
$this->beConstructedWith($stream);

$this->getSize()->shouldReturn(null);
}
}
8 changes: 8 additions & 0 deletions spec/Encoding/DeflateStreamSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,12 @@ function it_gets_content()
$stream->rewind();
$this->getContents()->shouldReturn(gzdeflate('This is a test stream'));
}

function it_does_not_know_the_content_size()
{
$stream = new MemoryStream('This stream is a test stream');
$this->beConstructedWith($stream);

$this->getSize()->shouldReturn(null);
}
}
8 changes: 8 additions & 0 deletions spec/Encoding/GzipDecodeStreamSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,12 @@ function it_gets_content()

$this->getContents()->shouldReturn('This is a test stream');
}

function it_does_not_know_the_content_size()
{
$stream = new MemoryStream(gzencode('This is a test stream'));
$this->beConstructedWith($stream);

$this->getSize()->shouldReturn(null);
}
}
9 changes: 9 additions & 0 deletions spec/Encoding/GzipEncodeStreamSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,13 @@ function it_gets_content()
$stream->rewind();
$this->getContents()->shouldReturn(gzencode('This is a test stream'));
}

function it_does_not_know_the_content_size()
{
$stream = new MemoryStream('This is a test stream');
$this->beConstructedWith($stream);

$stream->rewind();
$this->getSize()->shouldReturn(null);
}
}
8 changes: 8 additions & 0 deletions spec/Encoding/InflateStreamSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,12 @@ function it_gets_content()

$this->getContents()->shouldReturn('This is a test stream');
}

function it_does_not_know_the_content_size()
{
$stream = new MemoryStream(gzdeflate('This stream is a test stream'));
$this->beConstructedWith($stream);

$this->getSize()->shouldReturn(null);
}
}
8 changes: 8 additions & 0 deletions src/Encoding/FilteredStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,14 @@ public function getContents()
return $buffer;
}

/**
* {@inheritdoc}
*/
public function getSize()
{
return;
}

/**
* {@inheritdoc}
*/
Expand Down