public function testWrapsMetadata() { $a = $this->getMockBuilder('Guzzle\\Http\\EntityBody')->setMethods(array('getMetadata', 'getWrapper', 'getWrapperData', 'getStreamType', 'getUri'))->setConstructorArgs(array(fopen(__FILE__, 'r')))->getMock(); $a->expects($this->once())->method('getMetadata')->will($this->returnValue(array())); // Called twice for getWrapper and getWrapperData $a->expects($this->exactly(1))->method('getWrapper')->will($this->returnValue('wrapper')); $a->expects($this->once())->method('getWrapperData')->will($this->returnValue(array())); $a->expects($this->once())->method('getStreamType')->will($this->returnValue('baz')); $a->expects($this->once())->method('getUri')->will($this->returnValue('path/to/foo')); $d = new CachingEntityBody($a); $this->assertEquals(array(), $d->getMetaData()); $this->assertEquals('wrapper', $d->getWrapper()); $this->assertEquals(array(), $d->getWrapperData()); $this->assertEquals('baz', $d->getStreamType()); $this->assertEquals('path/to/foo', $d->getUri()); }