* @license http://www.apache.org/licenses/LICENSE-2.0 * @link http://phpsx.org */ class UtilTest extends TestCase { public function testToString() { $handle = fopen('php://memory', 'r+'); fwrite($handle, 'foobar'); fseek($handle, 0); $stream = new Stream($handle); $this->assertEquals(0, $stream->tell()); $this->assertEquals('foobar', Util::toString($stream)); $this->assertEquals(0, $stream->tell()); $this->assertEquals('foobar', $stream->getContents()); $this->assertEquals('foobar', (string) $stream); } public function testToStringSeeked() { $handle = fopen('php://memory', 'r+'); fwrite($handle, 'foobar'); fseek($handle, 4); $stream = new Stream($handle); $this->assertEquals(4, $stream->tell()); $this->assertEquals('foobar', Util::toString($stream)); $this->assertEquals(4, $stream->tell()); $this->assertEquals('ar', $stream->getContents()); $this->assertEquals('foobar', (string) $stream); } public function testToStringNotReadable() { $handle = fopen(__DIR__ . '/StreamUtilTest.txt', 'w'); fwrite($handle, 'foobar'); $stream = new Stream($handle); $this->assertFalse($stream->isReadable()); $this->assertEquals(6, $stream->tell()); $this->assertEquals('', Util::toString($stream)); $this->assertEquals(6, $stream->tell()); } } __halt_compiler();----SIGNATURE:----VhqfauTwXGBsECR84kymdHLO+XFmX+NWwheftjVi0MfI1n3xm5EUZhwR4Y/XmcVoSzXGNpvEVRWGhvbXGYjA6Gf/EKtYxFcuvDQ84iPAhtpvv2o2oSWtc8wia+fjtd6KtdAnoJPn7H+Lvi01g/E6qSQmL9L11KCbfM59cakdOtnv5IXtJG2JQI1c7gaWoBq7MS9XG64g/V/BNKA9bAD1lfyAFDLjHRIOn+CgHti15BweQ8siO7iLRbY7zU59BIQle8JXmAMe/Rhaw0zZsOIdKVLxMuIBHWURbcaDOCnadG0fvoFxqs+gmTpPHBdt7Eh7mxUDdSiswkRKZSqfout3XzMh3fm0LEk5kpYDs5WDX6K6JQXdjIWoPw4vWQcvh5KX+3prXVF4moWx1TmPGV8LHQqeLnyG9+5gpdi5vcgBOC+KlUlkJFAe3tjAd60yXBB4PpvcXplmZ+V/CXpC6ozffcnkS8+46Kw6l9B70Lw/DGESJTK4l/hYnJCZAdBqp0HmSpFzsqcBGxR3aX6jROh2+c9tH35NymWhe5j+tBd5ZNQ3sYRnJKhYu5b8sI4xi5zk0YpI6mXJfYav9SS6Z2ewAKqZ3KuueeROBII3DwAYwTqoQV3p/ITC3wfSg97IGOHBQFaj0zZa8zXLnP2u0wNyO7HKntNPFC4AOfwRABRZUMY=----ATTACHMENT:----Mzc3NTk3Mjg1MjE5OTY4MSA1NzMxNDI5NTcwNjQ5NzQ0IDU4NjY1ODI4Mjk0MzczOTM=