|
Last change
on this file since 851179e 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
|
|---|
| 2 | namespace GuzzleHttp\Tests\Psr7;
|
|---|
| 3 |
|
|---|
| 4 | use GuzzleHttp\Psr7\BufferStream;
|
|---|
| 5 | use GuzzleHttp\Psr7\DroppingStream;
|
|---|
| 6 |
|
|---|
| 7 | class 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.