|
Last change
on this file since a2330fc 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:
1.1 KB
|
| Line | |
|---|
| 1 | <?php
|
|---|
| 2 | namespace GuzzleHttp\Tests\Psr7;
|
|---|
| 3 |
|
|---|
| 4 | use GuzzleHttp\Psr7;
|
|---|
| 5 | use GuzzleHttp\Psr7\NoSeekStream;
|
|---|
| 6 |
|
|---|
| 7 | /**
|
|---|
| 8 | * @covers GuzzleHttp\Psr7\NoSeekStream
|
|---|
| 9 | * @covers GuzzleHttp\Psr7\StreamDecoratorTrait
|
|---|
| 10 | */
|
|---|
| 11 | class NoSeekStreamTest extends \PHPUnit_Framework_TestCase
|
|---|
| 12 | {
|
|---|
| 13 | /**
|
|---|
| 14 | * @expectedException \RuntimeException
|
|---|
| 15 | * @expectedExceptionMessage Cannot seek a NoSeekStream
|
|---|
| 16 | */
|
|---|
| 17 | public function testCannotSeek()
|
|---|
| 18 | {
|
|---|
| 19 | $s = $this->getMockBuilder('Psr\Http\Message\StreamInterface')
|
|---|
| 20 | ->setMethods(['isSeekable', 'seek'])
|
|---|
| 21 | ->getMockForAbstractClass();
|
|---|
| 22 | $s->expects($this->never())->method('seek');
|
|---|
| 23 | $s->expects($this->never())->method('isSeekable');
|
|---|
| 24 | $wrapped = new NoSeekStream($s);
|
|---|
| 25 | $this->assertFalse($wrapped->isSeekable());
|
|---|
| 26 | $wrapped->seek(2);
|
|---|
| 27 | }
|
|---|
| 28 |
|
|---|
| 29 | /**
|
|---|
| 30 | * @expectedException \RuntimeException
|
|---|
| 31 | * @expectedExceptionMessage Cannot write to a non-writable stream
|
|---|
| 32 | */
|
|---|
| 33 | public function testHandlesClose()
|
|---|
| 34 | {
|
|---|
| 35 | $s = Psr7\stream_for('foo');
|
|---|
| 36 | $wrapped = new NoSeekStream($s);
|
|---|
| 37 | $wrapped->close();
|
|---|
| 38 | $wrapped->write('foo');
|
|---|
| 39 | }
|
|---|
| 40 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.