本文整理汇总了PHP中Magento\Backend\Model\View\Result\RedirectFactory::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP RedirectFactory::expects方法的具体用法?PHP RedirectFactory::expects怎么用?PHP RedirectFactory::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Backend\Model\View\Result\RedirectFactory
的用法示例。
在下文中一共展示了RedirectFactory::expects方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
protected function setUp()
{
$this->productBuilder = $this->getMock('Magento\\Catalog\\Controller\\Adminhtml\\Product\\Builder', ['build'], [], '', false);
$this->product = $this->getMockBuilder('Magento\\Catalog\\Model\\Product')->disableOriginalConstructor()->setMethods(['addData', 'getSku', 'getTypeId', 'getStoreId', '__sleep', '__wakeup', 'getAttributes', 'setAttributeSetId'])->getMock();
$this->product->expects($this->any())->method('getTypeId')->will($this->returnValue('simple'));
$this->product->expects($this->any())->method('getStoreId')->will($this->returnValue('1'));
$this->product->expects($this->any())->method('getAttributes')->will($this->returnValue([]));
$this->productBuilder->expects($this->any())->method('build')->will($this->returnValue($this->product));
$this->resultPage = $this->getMockBuilder('Magento\\Backend\\Model\\View\\Result\\Page')->disableOriginalConstructor()->getMock();
$resultPageFactory = $this->getMockBuilder('Magento\\Framework\\View\\Result\\PageFactory')->disableOriginalConstructor()->setMethods(['create'])->getMock();
$resultPageFactory->expects($this->any())->method('create')->willReturn($this->resultPage);
$this->resultForward = $this->getMockBuilder('Magento\\Backend\\Model\\View\\Result\\Forward')->disableOriginalConstructor()->getMock();
$resultForwardFactory = $this->getMockBuilder('Magento\\Backend\\Model\\View\\Result\\ForwardFactory')->disableOriginalConstructor()->setMethods(['create'])->getMock();
$resultForwardFactory->expects($this->any())->method('create')->willReturn($this->resultForward);
$this->resultPage->expects($this->any())->method('getLayout')->willReturn($this->layout);
$this->resultRedirectFactory = $this->getMock('Magento\\Backend\\Model\\View\\Result\\RedirectFactory', ['create'], [], '', false);
$this->resultRedirect = $this->getMock('Magento\\Backend\\Model\\View\\Result\\Redirect', [], [], '', false);
$this->resultRedirectFactory->expects($this->any())->method('create')->willReturn($this->resultRedirect);
$this->initializationHelper = $this->getMock('Magento\\Catalog\\Controller\\Adminhtml\\Product\\Initialization\\Helper', [], [], '', false);
$this->productFactory = $this->getMockBuilder('Magento\\Catalog\\Model\\ProductFactory')->disableOriginalConstructor()->setMethods(['create'])->getMock();
$this->productFactory->expects($this->any())->method('create')->willReturn($this->product);
$this->resultJson = $this->getMock('Magento\\Framework\\Controller\\Result\\Json', [], [], '', false);
$this->resultJsonFactory = $this->getMockBuilder('Magento\\Framework\\Controller\\Result\\JsonFactory')->disableOriginalConstructor()->setMethods(['create'])->getMock();
$this->resultJsonFactory->expects($this->any())->method('create')->willReturn($this->resultJson);
$additionalParams = ['resultRedirectFactory' => $this->resultRedirectFactory];
$this->action = (new ObjectManagerHelper($this))->getObject('Magento\\Catalog\\Controller\\Adminhtml\\Product\\Validate', ['context' => $this->initContext($additionalParams), 'productBuilder' => $this->productBuilder, 'resultPageFactory' => $resultPageFactory, 'resultForwardFactory' => $resultForwardFactory, 'initializationHelper' => $this->initializationHelper, 'resultJsonFactory' => $this->resultJsonFactory, 'productFactory' => $this->productFactory]);
}
示例2: setUp
public function setUp()
{
$objectManagerHelper = new ObjectManagerHelper($this);
$this->shipmentLoader = $this->getMock('Magento\\Shipping\\Controller\\Adminhtml\\Order\\ShipmentLoader', ['setOrderId', 'setShipmentId', 'setShipment', 'setTracking', 'load'], [], '', false);
$this->context = $this->getMock('Magento\\Backend\\App\\Action\\Context', ['getRequest', 'getResponse', 'getMessageManager', 'getRedirect', 'getObjectManager', 'getSession', 'getActionFlag', 'getHelper', 'getResultRedirectFactory'], [], '', false);
$this->response = $this->getMock('Magento\\Framework\\App\\ResponseInterface', ['setRedirect', 'sendResponse'], [], '', false);
$this->request = $this->getMockBuilder('Magento\\Framework\\App\\RequestInterface')->setMethods(['isPost', 'getModuleName', 'setModuleName', 'getActionName', 'setActionName', 'getParam', 'getCookie'])->getMockForAbstractClass();
$this->objectManager = $this->getMock('Magento\\Framework\\ObjectManager\\ObjectManager', ['create'], [], '', false);
$this->messageManager = $this->getMock('Magento\\Framework\\Message\\Manager', ['addSuccess', 'addError'], [], '', false);
$this->session = $this->getMock('Magento\\Backend\\Model\\Session', ['setIsUrlNotice'], [], '', false);
$this->actionFlag = $this->getMock('Magento\\Framework\\App\\ActionFlag', ['get'], [], '', false);
$this->helper = $this->getMock('\\Magento\\Backend\\Helper\\Data', ['getUrl'], [], '', false);
$this->resultRedirect = $this->getMock('Magento\\Backend\\Model\\View\\Result\\Redirect', [], [], '', false);
$this->resultRedirectFactory = $this->getMock('Magento\\Backend\\Model\\View\\Result\\RedirectFactory', ['create'], [], '', false);
$this->resultRedirectFactory->expects($this->once())->method('create')->willReturn($this->resultRedirect);
$this->context->expects($this->once())->method('getMessageManager')->willReturn($this->messageManager);
$this->context->expects($this->once())->method('getRequest')->willReturn($this->request);
$this->context->expects($this->once())->method('getResponse')->willReturn($this->response);
$this->context->expects($this->once())->method('getObjectManager')->willReturn($this->objectManager);
$this->context->expects($this->once())->method('getSession')->willReturn($this->session);
$this->context->expects($this->once())->method('getActionFlag')->willReturn($this->actionFlag);
$this->context->expects($this->once())->method('getHelper')->willReturn($this->helper);
$this->context->expects($this->once())->method('getResultRedirectFactory')->willReturn($this->resultRedirectFactory);
$this->shipmentEmail = $objectManagerHelper->getObject('Magento\\Shipping\\Controller\\Adminhtml\\Order\\Shipment\\Email', ['context' => $this->context, 'shipmentLoader' => $this->shipmentLoader, 'request' => $this->request, 'response' => $this->response]);
}
示例3: testExecute
public function testExecute()
{
$path = '*/*';
$this->resultRedirectFactory->expects($this->any())->method('create')->willReturn($this->resultRedirect);
$this->messageManager->expects($this->once())->method('addSuccess')->with(__('We updated lifetime statistic.'));
$this->objectManager->expects($this->any())->method('create')->with('Magento\\Sales\\Model\\Resource\\Report\\Order')->willReturn($this->order);
$this->resultRedirect->expects($this->once())->method('setPath')->with($path)->willReturnSelf();
$this->assertInstanceOf('Magento\\Backend\\Model\\View\\Result\\Redirect', $this->refreshStatisticsController->execute());
}
示例4: setUp
protected function setUp()
{
$this->attributeHelper = $this->getMock('Magento\\Catalog\\Helper\\Product\\Edit\\Action\\Attribute', ['getProductIds', 'getSelectedStoreId', 'getStoreWebsiteId'], [], '', false);
$this->dataObjectHelperMock = $this->getMockBuilder('\\Magento\\Framework\\Api\\DataObjectHelper')->disableOriginalConstructor()->getMock();
$this->stockIndexerProcessor = $this->getMock('Magento\\CatalogInventory\\Model\\Indexer\\Stock\\Processor', ['reindexList'], [], '', false);
$resultRedirect = $this->getMockBuilder('Magento\\Backend\\Model\\View\\Result\\Redirect')->disableOriginalConstructor()->getMock();
$this->resultRedirectFactory = $this->getMockBuilder('Magento\\Backend\\Model\\View\\Result\\RedirectFactory')->disableOriginalConstructor()->setMethods(['create'])->getMock();
$this->resultRedirectFactory->expects($this->atLeastOnce())->method('create')->willReturn($resultRedirect);
$this->prepareContext();
$this->object = (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this))->getObject('Magento\\Catalog\\Controller\\Adminhtml\\Product\\Action\\Attribute\\Save', ['context' => $this->context, 'attributeHelper' => $this->attributeHelper, 'stockIndexerProcessor' => $this->stockIndexerProcessor, 'dataObjectHelper' => $this->dataObjectHelperMock]);
}
示例5: testEditActionBlockNoExists
public function testEditActionBlockNoExists()
{
$blockId = 1;
$this->requestMock->expects($this->once())->method('getParam')->with('block_id')->willReturn($blockId);
$this->blockMock->expects($this->once())->method('load')->with($blockId);
$this->blockMock->expects($this->once())->method('getId')->willReturn(null);
$this->messageManagerMock->expects($this->once())->method('addError')->with(__('This block no longer exists.'));
$this->resultRedirectFactoryMock->expects($this->atLeastOnce())->method('create')->willReturn($this->resultRedirectMock);
$this->resultRedirectMock->expects($this->once())->method('setPath')->with('*/*/')->willReturnSelf();
$this->assertSame($this->resultRedirectMock, $this->editController->execute());
}
示例6: testExecute
/**
* @return void
*/
public function testExecute()
{
$creditmemoId = '111';
$this->requestMock->expects($this->once())
->method('getParam')
->with('creditmemo_id')
->willReturn($creditmemoId);
$this->objectManagerMock->expects($this->once())
->method('create')
->with('Magento\Sales\Api\CreditmemoManagementInterface')
->willReturn($this->creditmemoManagementMock);
$this->creditmemoManagementMock->expects($this->once())
->method('cancel')
->with($creditmemoId);
$this->messageManagerMock->expects($this->once())
->method('addSuccess')
->with('The credit memo has been canceled.');
$this->resultRedirectFactoryMock->expects($this->once())
->method('create')
->willReturn($this->resultRedirectMock);
$this->resultRedirectMock->expects($this->once())
->method('setPath')
->with('sales/*/view', ['creditmemo_id' => $creditmemoId])
->willReturnSelf();
$this->assertInstanceOf(
'Magento\Backend\Model\View\Result\Redirect',
$this->controller->executeInternal()
);
}
示例7: setUp
protected function setUp()
{
$this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
$this->messageManagerMock = $this->getMock('Magento\\Framework\\Message\\ManagerInterface', [], [], '', false);
$this->requestMock = $this->getMockForAbstractClass('Magento\\Framework\\App\\RequestInterface', [], '', false, true, true, ['getParam']);
$this->blockMock = $this->getMockBuilder('Magento\\Cms\\Model\\Block')->disableOriginalConstructor()->setMethods(['load', 'delete'])->getMock();
$this->objectManagerMock = $this->getMockBuilder('Magento\\Framework\\ObjectManager\\ObjectManager')->disableOriginalConstructor()->setMethods(['create'])->getMock();
$this->resultRedirectMock = $this->getMockBuilder('Magento\\Backend\\Model\\View\\Result\\Redirect')->setMethods(['setPath'])->disableOriginalConstructor()->getMock();
$this->resultRedirectFactoryMock = $this->getMockBuilder('Magento\\Backend\\Model\\View\\Result\\RedirectFactory')->disableOriginalConstructor()->setMethods(['create'])->getMock();
$this->resultRedirectFactoryMock->expects($this->atLeastOnce())->method('create')->willReturn($this->resultRedirectMock);
$this->contextMock = $this->getMock('\\Magento\\Backend\\App\\Action\\Context', [], [], '', false);
$this->contextMock->expects($this->any())->method('getRequest')->willReturn($this->requestMock);
$this->contextMock->expects($this->any())->method('getMessageManager')->willReturn($this->messageManagerMock);
$this->contextMock->expects($this->any())->method('getObjectManager')->willReturn($this->objectManagerMock);
$this->contextMock->expects($this->any())->method('getResultRedirectFactory')->willReturn($this->resultRedirectFactoryMock);
$this->deleteController = $this->objectManager->getObject('Magento\\Cms\\Controller\\Adminhtml\\Block\\Delete', ['context' => $this->contextMock]);
}
示例8: setUp
protected function setUp()
{
$this->request = $this->getMockBuilder('\\Magento\\Framework\\App\\RequestInterface')->disableOriginalConstructor()->setMethods([])->getMockForAbstractClass();
$this->response = $this->getMockBuilder('\\Magento\\Framework\\App\\ResponseInterface')->disableOriginalConstructor()->setMethods([])->getMockForAbstractClass();
$this->objectManager = $this->getMockBuilder('\\Magento\\Framework\\ObjectManagerInterface')->disableOriginalConstructor()->setMethods(['create'])->getMockForAbstractClass();
$this->messageManager = $this->getMockBuilder('\\Magento\\Framework\\Message\\ManagerInterface')->disableOriginalConstructor()->setMethods(['addSuccess', 'addError'])->getMockForAbstractClass();
$this->context = $this->getMockBuilder('Magento\\Backend\\App\\Action\\Context')->setMethods(['getRequest', 'getResponse', 'getObjectManager', 'getMessageManager'])->disableOriginalConstructor()->getMock();
$this->context->expects($this->atLeastOnce())->method('getRequest')->will($this->returnValue($this->request));
$this->context->expects($this->atLeastOnce())->method('getResponse')->will($this->returnValue($this->response));
$this->context->expects($this->any())->method('getObjectManager')->will($this->returnValue($this->objectManager));
$this->context->expects($this->any())->method('getMessageManager')->will($this->returnValue($this->messageManager));
$this->pageFactory = $this->getMockBuilder('Magento\\Framework\\View\\Result\\PageFactory')->setMethods([])->disableOriginalConstructor()->getMock();
$this->redirect = $this->getMockBuilder('Magento\\Backend\\Model\\View\\Result\\Redirect')->setMethods(['setPath'])->disableOriginalConstructor()->getMock();
$this->redirectFactory = $this->getMockBuilder('Magento\\Backend\\Model\\View\\Result\\RedirectFactory')->setMethods(['create'])->disableOriginalConstructor()->getMock();
$this->redirectFactory->expects($this->any())->method('create')->will($this->returnValue($this->redirect));
$this->objectManagerHelper = new ObjectManagerHelper($this);
$this->controller = $this->objectManagerHelper->getObject('Magento\\Search\\Controller\\Adminhtml\\Term\\MassDelete', ['context' => $this->context, 'resultPageFactory' => $this->pageFactory, 'resultRedirectFactory' => $this->redirectFactory]);
}
示例9: testExecuteException
/**
* @return void
*/
public function testExecuteException()
{
$invoiceId = 2;
$message = 'Invoice capturing error';
$e = new \Exception($message);
$this->requestMock->expects($this->once())
->method('getParam')
->with('invoice_id')
->will($this->returnValue($invoiceId));
$this->invoiceManagement->expects($this->once())
->method('setCapture')
->with($invoiceId)
->will($this->throwException($e));
$invoiceMock = $this->getMockBuilder('Magento\Sales\Model\Order\Invoice')
->disableOriginalConstructor()
->getMock();
$this->messageManagerMock->expects($this->once())
->method('addError')
->with($message);
$invoiceMock->expects($this->once())
->method('getId')
->will($this->returnValue($invoiceId));
$invoiceMock->expects($this->once())
->method('getEntityId')
->will($this->returnValue($invoiceId));
$invoiceRepository = $this->getMockBuilder('Magento\Sales\Api\InvoiceRepositoryInterface')
->disableOriginalConstructor()
->getMock();
$invoiceRepository->expects($this->any())
->method('get')
->willReturn($invoiceMock);
$this->objectManagerMock->expects($this->once())
->method('create')
->with('Magento\Sales\Api\InvoiceRepositoryInterface')
->willReturn($invoiceRepository);
$resultRedirect = $this->getMockBuilder('Magento\Backend\Model\View\Result\Redirect')
->disableOriginalConstructor()
->setMethods([])
->getMock();
$resultRedirect->expects($this->once())->method('setPath')->with('sales/*/view', ['invoice_id' => $invoiceId]);
$this->resultRedirectFactoryMock->expects($this->once())
->method('create')
->will($this->returnValue($resultRedirect));
$this->assertSame($resultRedirect, $this->controller->executeInternal());
}
示例10: testExecutePageDirectAccess
public function testExecutePageDirectAccess()
{
$this->request->expects($this->any())->method('getParam')->with('filters')->willReturn(null);
$this->request->expects($this->any())->method('getParams')->willReturn([]);
$this->attributeHelper->expects($this->any())->method('getProductIds')->willReturn(null);
$resultRedirect = $this->getMockBuilder('Magento\\Backend\\Model\\View\\Result\\Redirect')->setMethods(['setPath'])->disableOriginalConstructor()->getMock();
$resultRedirect->expects($this->any())->method('setPath')->with('catalog/product/', ['_current' => true])->willReturnSelf();
$this->resultRedirectFactory->expects($this->any())->method('create')->willReturn($resultRedirect);
$this->assertSame($resultRedirect, $this->object->execute());
}
示例11: prepareRedirect
/**
* @param int $cmId
*/
protected function prepareRedirect($cmId)
{
$this->resultRedirectFactoryMock->expects($this->once())
->method('create')
->willReturn($this->resultRedirectMock);
$this->resultRedirectMock->expects($this->once())
->method('setPath')
->with('sales/order_creditmemo/view', ['creditmemo_id' => $cmId])
->willReturnSelf();
}
示例12: testEmail
public function testEmail()
{
$invoiceId = 10000031;
$orderId = 100000030;
$invoiceClassName = 'Magento\Sales\Model\Order\Invoice';
$cmNotifierClassName = 'Magento\Sales\Api\InvoiceManagementInterface';
$invoice = $this->getMock($invoiceClassName, [], [], '', false);
$invoice->expects($this->once())
->method('getEntityId')
->willReturn($invoiceId);
$order = $this->getMock('Magento\Sales\Model\Order', [], [], '', false);
$order->expects($this->once())
->method('getId')
->willReturn($orderId);
$this->request->expects($this->once())
->method('getParam')
->with('invoice_id')
->willReturn($invoiceId);
$invoiceRepository = $this->getMockBuilder('Magento\Sales\Api\InvoiceRepositoryInterface')
->disableOriginalConstructor()
->getMock();
$invoiceRepository->expects($this->any())
->method('get')
->willReturn($invoice);
$this->objectManager->expects($this->at(0))
->method('create')
->with('Magento\Sales\Api\InvoiceRepositoryInterface')
->willReturn($invoiceRepository);
$invoice->expects($this->once())
->method('getOrder')
->willReturn($order);
$this->objectManager->expects($this->at(1))
->method('create')
->with($cmNotifierClassName)
->willReturn($this->invoiceManagement);
$this->invoiceManagement->expects($this->once())
->method('notify')
->with($invoiceId)
->willReturn(true);
$this->messageManager->expects($this->once())
->method('addSuccess')
->with('You sent the message.');
$this->resultRedirectFactory->expects($this->atLeastOnce())
->method('create')
->willReturn($this->resultRedirect);
$this->resultRedirect->expects($this->once())
->method('setPath')
->with('sales/invoice/view', ['order_id' => $orderId, 'invoice_id' => $invoiceId])
->willReturnSelf();
$this->assertInstanceOf('Magento\Backend\Model\View\Result\Redirect', $this->invoiceEmail->executeInternal());
}
示例13: testExecuteBackupNotFound
/**
* @covers \Magento\Backup\Controller\Adminhtml\Index\Download::execute
* @param int $time
* @param bool $exists
* @param int $existsCount
* @dataProvider executeBackupNotFoundDataProvider
*/
public function testExecuteBackupNotFound($time, $exists, $existsCount)
{
$type = 'db';
$this->backupModelMock->expects($this->atLeastOnce())->method('getTime')->willReturn($time);
$this->backupModelMock->expects($this->exactly($existsCount))->method('exists')->willReturn($exists);
$this->requestMock->expects($this->any())->method('getParam')->willReturnMap([['time', null, $time], ['type', null, $type]]);
$this->backupModelFactoryMock->expects($this->once())->method('create')->with($time, $type)->willReturn($this->backupModelMock);
$this->resultRedirectMock->expects($this->once())->method('setPath')->with('backup/*');
$this->resultRedirectFactoryMock->expects($this->once())->method('create')->willReturn($this->resultRedirectMock);
$this->assertSame($this->resultRedirectMock, $this->downloadController->execute());
}
示例14: setUp
protected function setUp()
{
$this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
$this->contextMock = $this->getMock('Magento\\Backend\\App\\Action\\Context', [], [], '', false);
$this->resultRedirectFactory = $this->getMockBuilder('Magento\\Backend\\Model\\View\\Result\\RedirectFactory')->disableOriginalConstructor()->setMethods(['create'])->getMock();
$this->resultRedirect = $this->getMockBuilder('Magento\\Backend\\Model\\View\\Result\\Redirect')->disableOriginalConstructor()->getMock();
$this->resultRedirectFactory->expects($this->atLeastOnce())->method('create')->willReturn($this->resultRedirect);
$this->dataProcessorMock = $this->getMock('Magento\\Cms\\Controller\\Adminhtml\\Block\\PostDataProcessor', ['filter'], [], '', false);
$this->sessionMock = $this->getMock('Magento\\Backend\\Model\\Session', ['setFormData'], [], '', false);
$this->requestMock = $this->getMockForAbstractClass('Magento\\Framework\\App\\RequestInterface', [], '', false, true, true, ['getParam', 'getPostValue']);
$this->blockMock = $this->getMockBuilder('Magento\\Cms\\Model\\Block')->disableOriginalConstructor()->getMock();
$this->messageManagerMock = $this->getMock('Magento\\Framework\\Message\\ManagerInterface', [], [], '', false);
$this->eventManagerMock = $this->getMockForAbstractClass('Magento\\Framework\\Event\\ManagerInterface', [], '', false, true, true, ['dispatch']);
$this->objectManagerMock = $this->getMockBuilder('Magento\\Framework\\ObjectManager\\ObjectManager')->disableOriginalConstructor()->setMethods(['get', 'create'])->getMock();
$this->contextMock->expects($this->any())->method('getRequest')->willReturn($this->requestMock);
$this->contextMock->expects($this->any())->method('getObjectManager')->willReturn($this->objectManagerMock);
$this->contextMock->expects($this->any())->method('getMessageManager')->willReturn($this->messageManagerMock);
$this->contextMock->expects($this->any())->method('getEventManager')->willReturn($this->eventManagerMock);
$this->contextMock->expects($this->any())->method('getResultRedirectFactory')->willReturn($this->resultRedirectFactory);
$this->saveController = $this->objectManager->getObject('Magento\\Cms\\Controller\\Adminhtml\\Block\\Save', ['context' => $this->contextMock, 'dataProcessor' => $this->dataProcessorMock]);
}
示例15: testExecute
/**
* @return void
*/
public function testExecute()
{
$id = '111';
$transactionMock = $this->getMockBuilder('Magento\Framework\DB\Transaction')
->disableOriginalConstructor()
->getMock();
$orderMock = $this->getMockBuilder('Magento\Sales\Model\Order')
->disableOriginalConstructor()
->getMock();
$invoiceMock = $this->getMockBuilder('Magento\Sales\Model\Order\Invoice')
->disableOriginalConstructor()
->getMock();
$this->requestMock->expects($this->any())
->method('getParam')
->withAnyParameters()
->willReturnArgument(0);
$this->loaderMock->expects($this->once())
->method('load')
->willReturn($this->creditmemoMock);
$this->objectManagerMock->expects($this->once())
->method('create')
->with('Magento\Framework\DB\Transaction')
->willReturn($transactionMock);
$this->creditmemoMock->expects($this->any())
->method('getOrder')
->willReturn($orderMock);
$this->creditmemoMock->expects($this->any())
->method('getInvoice')
->willReturn($invoiceMock);
$this->messageManagerMock->expects($this->once())
->method('addSuccess')
->with('You voided the credit memo.');
$this->resultRedirectFactoryMock->expects($this->once())
->method('create')
->willReturn($this->resultRedirectMock);
$this->creditmemoMock->expects($this->atLeastOnce())
->method('getId')
->willReturn($id);
$this->resultRedirectMock->expects($this->once())
->method('setPath')
->with('sales/*/view', ['creditmemo_id' => $id])
->willReturnSelf();
$this->assertInstanceOf(
'Magento\Backend\Model\View\Result\Redirect',
$this->controller->executeInternal()
);
}