~ballot/wordpress/openstack-objectstorage-bis

« back to all changes in this revision

Viewing changes to vendor/guzzlehttp/streams/tests/NoSeekStreamTest.php

  • Committer: Jacek Nykis
  • Date: 2015-02-11 15:35:31 UTC
  • Revision ID: jacek.nykis@canonical.com-20150211153531-hmy6zi0ov2qfkl0b
Initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
}