source: externals/php/vendor/guzzlehttp/psr7/tests/DroppingStreamTest.php@ 01a620f

Last change on this file since 01a620f was 01a620f, checked in by Joachim Langenbach <joachim.langenbach@…>, 11 years ago

Removed submodules for php externals and use composer to provide them and versioned them afterwards

  • Property mode set to 100644
File size: 916 bytes
Line 
1<?php
2namespace GuzzleHttp\Tests\Psr7;
3
4use GuzzleHttp\Psr7\BufferStream;
5use GuzzleHttp\Psr7\DroppingStream;
6
7class DroppingStreamTest extends \PHPUnit_Framework_TestCase
8{
9 public function testBeginsDroppingWhenSizeExceeded()
10 {
11 $stream = new BufferStream();
12 $drop = new DroppingStream($stream, 5);
13 $this->assertEquals(3, $drop->write('hel'));
14 $this->assertEquals(2, $drop->write('lo'));
15 $this->assertEquals(5, $drop->getSize());
16 $this->assertEquals('hello', $drop->read(5));
17 $this->assertEquals(0, $drop->getSize());
18 $drop->write('12345678910');
19 $this->assertEquals(5, $stream->getSize());
20 $this->assertEquals(5, $drop->getSize());
21 $this->assertEquals('12345', (string) $drop);
22 $this->assertEquals(0, $drop->getSize());
23 $drop->write('hello');
24 $this->assertSame(0, $drop->write('test'));
25 }
26}
Note: See TracBrowser for help on using the repository browser.