X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;ds=sidebyside;f=phpunit%2FEncodingTest.php;h=46426130f9ef46b90e9af6db0cd0339f4fad901d;hb=0b83632b2b0a03eeca090f993259ccd95ab646fb;hp=5fb2df319007f33c15affb653f83537de090ea6a;hpb=a3ac311bb52e1947e743739c9d165b7aa01583b8;p=m6w6%2Fext-http diff --git a/phpunit/EncodingTest.php b/phpunit/EncodingTest.php index 5fb2df3..4642613 100644 --- a/phpunit/EncodingTest.php +++ b/phpunit/EncodingTest.php @@ -19,10 +19,11 @@ class EncodingStreamTest extends PHPUnit_Framework_TestCase { } function testChunkNotEncodedNotice() { + error_reporting(E_ALL); $this->setExpectedException("PHPUnit_Framework_Error_Notice", "Data does not seem to be chunked encoded"); $s = "this is apparently not encodded\n"; - http\Encoding\Stream\Dechunk::decode($s); + $this->assertEquals($s, http\Encoding\Stream\Dechunk::decode($s)); } function testChunkNotEncodedFail() { @@ -61,9 +62,12 @@ class EncodingStreamTest extends PHPUnit_Framework_TestCase { $data .= $dech->update(sprintf("%lx\r\n%s\r\n", strlen($line), $line)); } else { $data .= $dech->update(sprintf("%lx\r\n", strlen($line))); + $data .= $dech->flush(); $data .= $dech->update($line); + $data .= $dech->flush(); $data .= $dech->update("\r\n"); } + $dech->flush(); $this->assertFalse($dech->done()); } $data .= $dech->update("0\r\n"); @@ -140,11 +144,14 @@ class EncodingStreamTest extends PHPUnit_Framework_TestCase { $file = file(__FILE__); $data = ""; foreach ($file as $line) { + $data .= $infl->flush(); if (strlen($temp = $defl->update($line))) { $data .= $infl->update($temp); + $data .= $infl->flush(); } if (strlen($temp = $defl->flush())) { $data .= $infl->update($temp); + $data .= $infl->flush(); } $this->assertTrue($defl->done()); }