114 $this->request->expects($this->at(0))->method(
'getParam')->with(
'id', 0)
115 ->will($this->returnValue(1));
116 $this->request->expects($this->at(1))->method(
'getParam')->with(
'type', 0)
117 ->will($this->returnValue($fileType));
118 $this->response->expects($this->once())->method(
'setHttpResponseCode')
119 ->will($this->returnSelf());
120 $this->response->expects($this->once())->method(
'clearBody')
121 ->will($this->returnSelf());
123 ->expects($this->any())
124 ->method(
'setHeader')
126 [
'Pragma',
'public',
true],
129 'must-revalidate, post-check=0, pre-check=0',
132 [
'Content-type',
'text/html'],
133 [
'Content-Length', $fileSize],
134 [
'Content-Disposition',
'attachment; filename=' .
$fileName]
136 ->will($this->returnSelf());
137 $this->response->expects($this->once())->method(
'sendHeaders')
138 ->will($this->returnSelf());
139 $this->objectManager->expects($this->at(1))->method(
'get')->with(\
Magento\Downloadable\Helper\File::class)
140 ->will($this->returnValue($this->fileHelper));
141 $this->objectManager->expects($this->at(2))->method(
'get')->with(\
Magento\Downloadable\Model\Link::class)
142 ->will($this->returnValue($this->linkModel));
143 $this->objectManager->expects($this->at(3))->method(
'get')->with(\
Magento\Downloadable\Helper\Download::class)
144 ->will($this->returnValue($this->downloadHelper));
145 $this->fileHelper->expects($this->once())->method(
'getFilePath')
146 ->will($this->returnValue(
'filepath/' . $fileType .
'.jpg'));
147 $this->downloadHelper->expects($this->once())->method(
'setResource')
148 ->will($this->returnSelf());
149 $this->downloadHelper->expects($this->once())->method(
'getFilename')
151 $this->downloadHelper->expects($this->once())->method(
'getContentType')
152 ->willReturn(
'text/html');
153 $this->downloadHelper->expects($this->once())->method(
'getFileSize')
154 ->will($this->returnValue($fileSize));
155 $this->downloadHelper->expects($this->once())->method(
'getContentDisposition')
156 ->will($this->returnValue(
'inline'));
157 $this->downloadHelper->expects($this->once())->method(
'output')
158 ->will($this->returnSelf());
159 $this->linkModel->expects($this->once())->method(
'load')
160 ->will($this->returnSelf());
161 $this->linkModel->expects($this->once())->method(
'getId')
162 ->will($this->returnValue(
'1'));
163 $this->linkModel->expects($this->any())->method(
'get' . $fileType .
'Type')
164 ->will($this->returnValue(
'file'));
165 $this->objectManager->expects($this->once())->method(
'create')
166 ->will($this->returnValue($this->linkModel));
168 $this->link->execute();