Lines Matching refs:body
17 protected $body;
25 $this->body = new CachingStream($this->decorated);
31 $this->body->close();
36 $body = Stream::factory('test');
37 $caching = new CachingStream($body);
45 $this->body->seek(10);
50 $this->assertFalse($this->body->seek(2, SEEK_END));
68 $this->assertEquals('te', $this->body->read(2));
69 $this->body->seek(0);
70 $this->assertEquals('test', $this->body->read(4));
71 $this->assertEquals(4, $this->body->tell());
72 $this->body->seek(2);
73 $this->assertEquals(2, $this->body->tell());
74 $this->body->seek(2, SEEK_CUR);
75 $this->assertEquals(4, $this->body->tell());
76 $this->assertEquals('ing', $this->body->read(3));
81 $this->body->read(2);
82 $this->body->write('hi');
83 $this->body->seek(0);
84 $this->assertEquals('tehiing', (string) $this->body);
95 $body = new CachingStream($decorated);
100 $this->assertEquals("0000\n", Utils::readline($body));
101 $this->assertEquals("0001\n", Utils::readline($body));
102 // Write over part of the body yet to be read, so skip some bytes
103 $this->assertEquals(5, $body->write("TEST\n"));
104 $this->assertEquals(5, $skipReadBytes->getValue($body));
106 $this->assertEquals("0003\n", Utils::readline($body));
107 $this->assertEquals(0, $skipReadBytes->getValue($body));
108 $this->assertEquals("0004\n", Utils::readline($body));
109 $this->assertEquals("0005\n", Utils::readline($body));
111 // Overwrite part of the cached body (so don't skip any bytes)
112 $body->seek(5);
113 $this->assertEquals(5, $body->write("ABCD\n"));
114 $this->assertEquals(0, $skipReadBytes->getValue($body));
115 $this->assertEquals("TEST\n", Utils::readline($body));
116 $this->assertEquals("0003\n", Utils::readline($body));
117 $this->assertEquals("0004\n", Utils::readline($body));
118 $this->assertEquals("0005\n", Utils::readline($body));
119 $this->assertEquals("0006\n", Utils::readline($body));
120 $this->assertEquals(5, $body->write("1234\n"));
121 $this->assertEquals(5, $skipReadBytes->getValue($body));
124 $body->seek(0);
125 $this->assertEquals("0000\nABCD\nTEST\n0003\n0004\n0005\n0006\n1234\n0008\n0009\n", $body->read(50));
128 $this->assertStringContainsString("0000\nABCD\nTEST\n0003\n0004\n0005\n0006\n1234\n0008\n0009\n", (string) $body);