Lines Matching refs:stream

23         $stream = new Stream($handle);
24 $this->assertTrue($stream->isReadable());
25 $this->assertTrue($stream->isWritable());
26 $this->assertTrue($stream->isSeekable());
27 $this->assertEquals('php://temp', $stream->getMetadata('uri'));
28 $this->assertInternalType('array', $stream->getMetadata());
29 $this->assertEquals(4, $stream->getSize());
30 $this->assertFalse($stream->eof());
31 $stream->close();
37 $stream = new Stream($handle);
38 unset($stream);
46 $stream = new Stream($handle);
47 $this->assertEquals('data', (string) $stream);
48 $this->assertEquals('data', (string) $stream);
49 $stream->close();
56 $stream = new Stream($handle);
57 $this->assertEquals('', $stream->getContents());
58 $stream->seek(0);
59 $this->assertEquals('data', $stream->getContents());
60 $this->assertEquals('', $stream->getContents());
67 $stream = new Stream($handle);
68 $this->assertFalse($stream->eof());
69 $stream->read(4);
70 $this->assertTrue($stream->eof());
71 $stream->close();
78 $stream = new Stream($handle);
79 $stream->setSize(10);
80 $this->assertEquals(10, $stream->getSize());
81 $stream->close();
88 $stream = new Stream($handle);
89 $this->assertEquals($size, $stream->getSize());
91 $this->assertEquals($size, $stream->getSize());
92 $stream->close();
99 $stream = new Stream($h);
100 $this->assertEquals(3, $stream->getSize());
101 $this->assertEquals(4, $stream->write('test'));
102 $this->assertEquals(7, $stream->getSize());
103 $this->assertEquals(7, $stream->getSize());
104 $stream->close();
110 $stream = new Stream($handle);
111 $this->assertEquals(0, $stream->tell());
112 $stream->write('foo');
113 $this->assertEquals(3, $stream->tell());
114 $stream->seek(1);
115 $this->assertEquals(1, $stream->tell());
116 $this->assertSame(ftell($handle), $stream->tell());
117 $stream->close();
124 $stream = Stream::factory($h);
125 $this->assertEquals(10, $stream->tell());
126 $stream->close();
132 $stream = new Stream($r);
133 $stream->write('foo');
134 $this->assertTrue($stream->isReadable());
135 $this->assertSame($r, $stream->detach());
136 $this->assertNull($stream->detach());
138 $this->assertFalse($stream->isReadable());
139 $this->assertFalse($stream->read(10));
140 $this->assertFalse($stream->isWritable());
141 $this->assertFalse($stream->write('bar'));
142 $this->assertFalse($stream->isSeekable());
143 $this->assertFalse($stream->seek(10));
144 $this->assertFalse($stream->tell());
145 $this->assertTrue($stream->eof());
146 $this->assertNull($stream->getSize());
147 $this->assertSame('', (string) $stream);
148 $this->assertSame('', $stream->getContents());
150 $stream->attach($r);
151 $stream->seek(0);
152 $this->assertEquals('foo', $stream->getContents());
153 $this->assertTrue($stream->isReadable());
154 $this->assertTrue($stream->isWritable());
155 $this->assertTrue($stream->isSeekable());
157 $stream->close();
163 $stream = new Stream($handle);
164 $stream->close();
166 $this->assertEmpty($stream->getMetadata());
167 $this->assertFalse($stream->isSeekable());
168 $this->assertFalse($stream->isReadable());
169 $this->assertFalse($stream->isWritable());
170 $this->assertNull($stream->getSize());
175 $stream = Stream::factory('foo');
176 $this->assertInstanceOf('GuzzleHttp\Stream\Stream', $stream);
177 $this->assertEquals('foo', $stream->getContents());
178 $stream->close();