本文整理匯總了PHP中Zend_Pdf::expects方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Pdf::expects方法的具體用法?PHP Zend_Pdf::expects怎麽用?PHP Zend_Pdf::expects使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend_Pdf
的用法示例。
在下文中一共展示了Zend_Pdf::expects方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testExecute
/**
* @covers \Magento\Sales\Controller\Adminhtml\Order\Creditmemo\PrintAction::executeInternal
*/
public function testExecute()
{
$creditmemoId = 2;
$date = '2015-01-19_13-03-45';
$fileName = 'creditmemo2015-01-19_13-03-45.pdf';
$fileContents = 'pdf0123456789';
$this->prepareTestExecute($creditmemoId);
$this->objectManagerMock->expects($this->any())
->method('create')
->willReturnMap(
[
['Magento\Sales\Model\Order\Creditmemo', [], $this->creditmemoMock],
['Magento\Sales\Model\Order\Pdf\Creditmemo', [], $this->creditmemoPdfMock]
]
);
$this->creditmemoRepositoryMock->expects($this->once())
->method('get')
->with($creditmemoId)
->willReturn($this->creditmemoMock);
$this->creditmemoPdfMock->expects($this->once())
->method('getPdf')
->with([$this->creditmemoMock])
->willReturn($this->pdfMock);
$this->objectManagerMock->expects($this->once())
->method('get')
->with('Magento\Framework\Stdlib\DateTime\DateTime')
->willReturn($this->dateTimeMock);
$this->dateTimeMock->expects($this->once())
->method('date')
->with('Y-m-d_H-i-s')
->willReturn($date);
$this->pdfMock->expects($this->once())
->method('render')
->willReturn($fileContents);
$this->fileFactoryMock->expects($this->once())
->method('create')
->with(
$fileName,
$fileContents,
\Magento\Framework\App\Filesystem\DirectoryList::VAR_DIR,
'application/pdf'
)
->willReturn($this->responseMock);
$this->assertInstanceOf(
'Magento\Framework\App\ResponseInterface',
$this->printAction->executeInternal()
);
}