Lines Matching +full:s +full:- +full:tell
18 $s = $this->getMockBuilder('GuzzleHttp\Stream\StreamInterface')
19 ->getMockForAbstractClass();
20 $s->expects($this->once())
21 ->method('isReadable')
22 ->will($this->returnValue(true));
23 $a->addStream($s);
29 $this->assertFalse($a->seek(100, SEEK_CUR));
35 $s = $this->getMockBuilder('GuzzleHttp\Stream\StreamInterface')
36 ->getMockForAbstractClass();
37 $s->expects($this->once())
38 ->method('isReadable')
39 ->will($this->returnValue(true));
40 $s->expects($this->once())
41 ->method('isSeekable')
42 ->will($this->returnValue(true));
43 $s->expects($this->once())
44 ->method('seek')
45 ->will($this->returnValue(false));
46 $a->addStream($s);
47 $this->assertFalse($a->seek(10));
58 $this->assertTrue($a->seek(3));
59 $this->assertEquals(3, $a->tell());
60 $this->assertEquals('bar', $a->read(3));
61 $a->seek(6);
62 $this->assertEquals(6, $a->tell());
63 $this->assertEquals('baz', $a->read(3));
71 $this->assertSame('foofoo', (string) $a);
72 $a->detach();
73 $this->assertSame('', (string) $a);
74 $this->assertSame(0, $a->getSize());
81 $a->close();
82 $this->assertSame('', (string) $a);
88 $this->assertFalse($a->isWritable());
89 $this->assertTrue($a->isSeekable());
90 $this->assertTrue($a->isReadable());
91 $this->assertFalse($a->write('foo'));
97 $this->assertEquals('', (string) $a);
107 $this->assertFalse($a->eof());
108 $this->assertSame(0, $a->tell());
109 $this->assertEquals('foo', $a->read(3));
110 $this->assertEquals('bar', $a->read(3));
111 $this->assertEquals('baz', $a->read(3));
112 $this->assertEmpty($a->read(1));
113 $this->assertTrue($a->eof());
114 $this->assertSame(9, $a->tell());
115 $this->assertEquals('foobarbaz', (string) $a);
124 $this->assertEquals(6, $a->getSize());
126 $s = $this->getMockBuilder('GuzzleHttp\Stream\StreamInterface')
127 ->getMockForAbstractClass();
128 $s->expects($this->once())
129 ->method('isSeekable')
130 ->will($this->returnValue(null));
131 $s->expects($this->once())
132 ->method('isReadable')
133 ->will($this->returnValue(true));
134 $a->addStream($s);
135 $this->assertNull($a->getSize());
140 $s = $this->getMockBuilder('GuzzleHttp\Stream\StreamInterface')
141 ->getMockForAbstractClass();
142 $s->expects($this->once())
143 ->method('read')
144 ->will($this->throwException(new \RuntimeException('foo')));
145 $s->expects($this->once())
146 ->method('isReadable')
147 ->will($this->returnValue(true));
148 $s->expects($this->any())
149 ->method('eof')
150 ->will($this->returnValue(false));
151 $a = new AppendStream([$s]);
152 $this->assertFalse($a->eof());
153 $this->assertSame('', (string) $a);
161 $s = new AppendStream();
162 $s->detach();
167 $s = new AppendStream();
168 $this->assertEquals([], $s->getMetadata());
169 $this->assertNull($s->getMetadata('foo'));
175 $this->expectException(CannotAttachException::class);
176 $p->attach('a');