public function testCalculatesSizeAndReturnsNullForUnknown() { $s = $this->getMockBuilder('GuzzleHttp\\Stream\\StreamInterface')->setMethods(['getSize', 'isReadable'])->getMockForAbstractClass(); $s->expects($this->once())->method('getSize')->will($this->returnValue(null)); $s->expects($this->once())->method('isReadable')->will($this->returnValue(true)); $b = new MultipartBody([], [new PostFile('foo', $s, 'foo.php')]); $this->assertNull($b->getSize()); }