getMockBuilder(ZipExporter::class) ->disableOriginalConstructor() ->setMethods(['createZipFile']) ->getMock(); $exporterMock->expects($this->once()) ->method('createZipFile') ->with($expectedResultingPath) ->will($this->returnValue('does_not_matter')); $exporterMock->export([ 'filename' => $originalPath, 'id' => 'no_matter', ], ''); } }