FakeStream
class FakeStream implements StreamInterface (View source)
Properties
| protected string[] | $buffer | Lines queued for testing; each call to fgets() pops the next line. |
|
| protected string[] | $written | Data that has been "written" to this fake stream (for assertion). |
|
| protected array|null | $connection | The connection info. |
|
| protected array | $meta | The mock meta info. |
Methods
Feed a line to the stream buffer with a newline character.
Feed a raw line to the stream buffer.
Set the timed out status.
Open the underlying stream.
Close the underlying stream.
Read data from the stream.
Read a single line from the stream.
Write data to the stream.
Return meta info (like stream_get_meta_data).
Determine if the stream is open.
Set the timeout on the stream.
Set encryption state on an already connected socked.
Assert that the given data was written to the stream.
Details
FakeStream
feed(array|string $lines)
Feed a line to the stream buffer with a newline character.
FakeStream
feedRaw(array|string $lines)
Feed a raw line to the stream buffer.
FakeStream
setMeta(string $attribute, mixed $value)
Set the timed out status.
bool
open(string $transport = null, string $host = null, int $port = null, int $timeout = null, array $options = [])
Open the underlying stream.
void
close()
Close the underlying stream.
string|false
read(int $length)
Read data from the stream.
string|false
fgets()
Read a single line from the stream.
int|false
fwrite(string $data)
Write data to the stream.
array
meta()
Return meta info (like stream_get_meta_data).
bool
opened()
Determine if the stream is open.
bool
setTimeout(int $seconds)
Set the timeout on the stream.
bool|int
setSocketSetCrypto(bool $enabled, int|null $method)
Set encryption state on an already connected socked.
void
assertWritten(string $string)
Assert that the given data was written to the stream.