scratch – Blame information for rev 87
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
87 | office | 1 | <?php |
2 | namespace GuzzleHttp\Tests\Stream; |
||
3 | |||
4 | use GuzzleHttp\Stream\Stream; |
||
5 | use GuzzleHttp\Stream\NoSeekStream; |
||
6 | |||
7 | /** |
||
8 | * @covers GuzzleHttp\Stream\NoSeekStream |
||
9 | * @covers GuzzleHttp\Stream\StreamDecoratorTrait |
||
10 | */ |
||
11 | class NoSeekStreamTest extends \PHPUnit_Framework_TestCase |
||
12 | { |
||
13 | public function testCannotSeek() |
||
14 | { |
||
15 | $s = $this->getMockBuilder('GuzzleHttp\Stream\StreamInterface') |
||
16 | ->setMethods(['isSeekable', 'seek']) |
||
17 | ->getMockForAbstractClass(); |
||
18 | $s->expects($this->never())->method('seek'); |
||
19 | $s->expects($this->never())->method('isSeekable'); |
||
20 | $wrapped = new NoSeekStream($s); |
||
21 | $this->assertFalse($wrapped->isSeekable()); |
||
22 | $this->assertFalse($wrapped->seek(2)); |
||
23 | } |
||
24 | |||
25 | public function testHandlesClose() |
||
26 | { |
||
27 | $s = Stream::factory('foo'); |
||
28 | $wrapped = new NoSeekStream($s); |
||
29 | $wrapped->close(); |
||
30 | $this->assertFalse($wrapped->write('foo')); |
||
31 | } |
||
32 | } |