xref: /plugin/elasticsearch/vendor/ezimuel/guzzlestreams/tests/DroppingStreamTest.php
  • Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?php
2namespace GuzzleHttp\Tests\Stream;
3
4use GuzzleHttp\Stream\BufferStream;
5use GuzzleHttp\Stream\DroppingStream;
6use PHPUnit\Framework\TestCase;
7
8class DroppingStreamTest extends TestCase
9{
10    public function testBeginsDroppingWhenSizeExceeded()
11    {
12        $stream = new BufferStream();
13        $drop = new DroppingStream($stream, 5);
14        $this->assertEquals(3, $drop->write('hel'));
15        $this->assertFalse($drop->write('lo'));
16        $this->assertEquals(5, $drop->getSize());
17        $this->assertEquals('hello', $drop->read(5));
18        $this->assertEquals(0, $drop->getSize());
19        $drop->write('12345678910');
20        $this->assertEquals(5, $stream->getSize());
21        $this->assertEquals(5, $drop->getSize());
22        $this->assertEquals('12345', (string) $drop);
23        $this->assertEquals(0, $drop->getSize());
24        $drop->write('hello');
25        $this->assertFalse($drop->write('test'));
26    }
27}
28

served by {OpenGrok

Last Index Update: Thu Jul 13 10:31:41 UTC 2023

Global DokuWiki Links

  • Download
  • Wiki
  • Forum
  • IRC
  • Bugs
  • Translate
  • Git
  • XRef
  • Code Search
Navigate Window
x
Scopes Window
x
Intelligence window
x
Next >> | << Prev


In current file
  • Highlight
  • Unhighlight
  • Unhighlight all
In project "undefined"
  • Search for definitions of
  • Search for references of
  • Do a full search with
  • Search for file names that contain
On Google
  • Google
Messages Window
x