本文整理汇总了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()
);
}