예제 #1
0
 /**
  * Execute download sample url action
  */
 public function testExecuteUrl()
 {
     $this->request->expects($this->at(0))->method('getParam')->with('id', 0)->will($this->returnValue(1));
     $this->response->expects($this->once())->method('setHttpResponseCode')->will($this->returnSelf());
     $this->response->expects($this->once())->method('clearBody')->will($this->returnSelf());
     $this->response->expects($this->any())->method('setHeader')->will($this->returnSelf());
     $this->response->expects($this->once())->method('sendHeaders')->will($this->returnSelf());
     $this->objectManager->expects($this->at(1))->method('get')->with('Magento\\Downloadable\\Helper\\Download')->will($this->returnValue($this->downloadHelper));
     $this->downloadHelper->expects($this->once())->method('setResource')->will($this->returnSelf());
     $this->downloadHelper->expects($this->once())->method('getFilename')->will($this->returnValue('sample.jpg'));
     $this->downloadHelper->expects($this->once())->method('getContentType')->will($this->returnSelf('url'));
     $this->downloadHelper->expects($this->once())->method('getFileSize')->will($this->returnValue(null));
     $this->downloadHelper->expects($this->once())->method('getContentDisposition')->will($this->returnValue(null));
     $this->downloadHelper->expects($this->once())->method('output')->will($this->returnSelf());
     $this->sampleModel->expects($this->once())->method('load')->will($this->returnSelf());
     $this->sampleModel->expects($this->once())->method('getId')->will($this->returnValue('1'));
     $this->sampleModel->expects($this->any())->method('getSampleType')->will($this->returnValue('url'));
     $this->objectManager->expects($this->once())->method('create')->will($this->returnValue($this->sampleModel));
     $this->sample->executeInternal();
 }