getMockBuilder('Psr\Http\Message\StreamInterface') ->setMethods(array('isSeekable', 'seek')) ->getMockForAbstractClass(); $s->expects($this->never())->method('seek'); $s->expects($this->never())->method('isSeekable'); $wrapped = new NoSeekStream($s); $this->assertFalse($wrapped->isSeekable()); $wrapped->seek(2); } /** * @expectedException \RuntimeException * @expectedExceptionMessage Cannot write to a non-writable stream */ public function testHandlesClose() { $s = Psr7\stream_for('foo'); $wrapped = new NoSeekStream($s); $wrapped->close(); $wrapped->write('foo'); } }