本文整理汇总了PHP中Magento\Framework\App\Action\Context类的典型用法代码示例。如果您正苦于以下问题:PHP Context类的具体用法?PHP Context怎么用?PHP Context使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Context类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
$objectManagerHelper = new ObjectManagerHelper($this);
$this->contextMock = $this->getMock('Magento\\Backend\\App\\Action\\Context', ['getRequest', 'getResponse', 'getMessageManager', 'getRedirect', 'getObjectManager', 'getSession', 'getActionFlag', 'getHelper', 'getResultRedirectFactory', 'getResultFactory'], [], '', false);
$resultRedirectFactory = $this->getMock('Magento\\Backend\\Model\\View\\Result\\RedirectFactory', ['create'], [], '', false);
$this->responseMock = $this->getMock('Magento\\Framework\\App\\ResponseInterface', ['setRedirect', 'sendResponse'], [], '', false);
$this->requestMock = $this->getMockBuilder('Magento\\Framework\\App\\Request\\Http')->disableOriginalConstructor()->getMock();
$this->objectManagerMock = $this->getMock('Magento\\Framework\\ObjectManager\\ObjectManager', ['create'], [], '', false);
$this->messageManagerMock = $this->getMock('Magento\\Framework\\Message\\Manager', ['addSuccess', 'addError'], [], '', false);
$this->orderCollectionMock = $this->getMockBuilder('Magento\\Sales\\Model\\Resource\\Order\\Collection')->disableOriginalConstructor()->getMock();
$this->sessionMock = $this->getMock('Magento\\Backend\\Model\\Session', ['setIsUrlNotice'], [], '', false);
$this->actionFlagMock = $this->getMock('Magento\\Framework\\App\\ActionFlag', ['get', 'set'], [], '', false);
$this->helperMock = $this->getMock('\\Magento\\Backend\\Helper\\Data', ['getUrl'], [], '', false);
$this->resultRedirectMock = $this->getMock('Magento\\Backend\\Model\\View\\Result\\Redirect', [], [], '', false);
$resultRedirectFactory->expects($this->any())->method('create')->willReturn($this->resultRedirectMock);
$redirectMock = $this->getMockBuilder('Magento\\Backend\\Model\\View\\Result\\Redirect')->disableOriginalConstructor()->getMock();
$resultFactoryMock = $this->getMockBuilder('Magento\\Framework\\Controller\\ResultFactory')->disableOriginalConstructor()->getMock();
$resultFactoryMock->expects($this->any())->method('create')->with(\Magento\Framework\Controller\ResultFactory::TYPE_REDIRECT)->willReturn($redirectMock);
$this->contextMock->expects($this->once())->method('getMessageManager')->willReturn($this->messageManagerMock);
$this->contextMock->expects($this->once())->method('getRequest')->willReturn($this->requestMock);
$this->contextMock->expects($this->once())->method('getResponse')->willReturn($this->responseMock);
$this->contextMock->expects($this->once())->method('getObjectManager')->willReturn($this->objectManagerMock);
$this->contextMock->expects($this->once())->method('getSession')->willReturn($this->sessionMock);
$this->contextMock->expects($this->once())->method('getActionFlag')->willReturn($this->actionFlagMock);
$this->contextMock->expects($this->once())->method('getHelper')->willReturn($this->helperMock);
$this->contextMock->expects($this->once())->method('getResultRedirectFactory')->willReturn($resultRedirectFactory);
$this->contextMock->expects($this->any())->method('getResultFactory')->willReturn($resultFactoryMock);
$this->massAction = $objectManagerHelper->getObject('Magento\\Sales\\Controller\\Adminhtml\\Order\\MassCancel', ['context' => $this->contextMock]);
}
开发者ID:nja78,项目名称:magento2,代码行数:29,代码来源:MassCancelTest.php
示例2: setUp
public function setUp()
{
$objectManagerHelper = new ObjectManagerHelper($this);
$this->contextMock = $this->getMock('Magento\\Backend\\App\\Action\\Context', [], [], '', false);
$resultRedirectFactory = $this->getMock('Magento\\Backend\\Model\\View\\Result\\RedirectFactory', [], [], '', false);
$this->responseMock = $this->getMock('Magento\\Framework\\App\\ResponseInterface', [], [], '', false);
$this->requestMock = $this->getMockBuilder('Magento\\Framework\\App\\Request\\Http')->disableOriginalConstructor()->getMock();
$this->objectManagerMock = $this->getMock('Magento\\Framework\\ObjectManager\\ObjectManager', ['create'], [], '', false);
$this->messageManagerMock = $this->getMock('Magento\\Framework\\Message\\Manager', [], [], '', false);
$this->customerCollectionMock = $this->getMockBuilder('Magento\\Customer\\Model\\ResourceModel\\Customer\\Collection')->disableOriginalConstructor()->getMock();
$this->customerCollectionFactoryMock = $this->getMockBuilder('Magento\\Customer\\Model\\ResourceModel\\Customer\\CollectionFactory')->disableOriginalConstructor()->setMethods(['create'])->getMock();
$redirectMock = $this->getMockBuilder('Magento\\Backend\\Model\\View\\Result\\Redirect')->disableOriginalConstructor()->getMock();
$resultFactoryMock = $this->getMockBuilder('Magento\\Framework\\Controller\\ResultFactory')->disableOriginalConstructor()->getMock();
$resultFactoryMock->expects($this->any())->method('create')->with(\Magento\Framework\Controller\ResultFactory::TYPE_REDIRECT)->willReturn($redirectMock);
$this->subscriberMock = $this->getMock('Magento\\Newsletter\\Model\\Subscriber', [], [], '', false);
$subscriberFactoryMock = $this->getMockBuilder('Magento\\Newsletter\\Model\\SubscriberFactory')->setMethods(['create'])->disableOriginalConstructor()->getMock();
$subscriberFactoryMock->expects($this->any())->method('create')->willReturn($this->subscriberMock);
$this->resultRedirectMock = $this->getMock('Magento\\Backend\\Model\\View\\Result\\Redirect', [], [], '', false);
$resultRedirectFactory->expects($this->any())->method('create')->willReturn($this->resultRedirectMock);
$this->contextMock->expects($this->once())->method('getMessageManager')->willReturn($this->messageManagerMock);
$this->contextMock->expects($this->once())->method('getRequest')->willReturn($this->requestMock);
$this->contextMock->expects($this->once())->method('getResponse')->willReturn($this->responseMock);
$this->contextMock->expects($this->once())->method('getObjectManager')->willReturn($this->objectManagerMock);
$this->contextMock->expects($this->any())->method('getResultRedirectFactory')->willReturn($resultRedirectFactory);
$this->contextMock->expects($this->any())->method('getResultFactory')->willReturn($resultFactoryMock);
$this->filterMock = $this->getMock('Magento\\Ui\\Component\\MassAction\\Filter', [], [], '', false);
$this->filterMock->expects($this->once())->method('getCollection')->with($this->customerCollectionMock)->willReturnArgument(0);
$this->customerCollectionFactoryMock->expects($this->once())->method('create')->willReturn($this->customerCollectionMock);
$this->customerRepositoryMock = $this->getMockBuilder('Magento\\Customer\\Api\\CustomerRepositoryInterface')->getMockForAbstractClass();
$this->massAction = $objectManagerHelper->getObject('Magento\\Customer\\Controller\\Adminhtml\\Index\\MassUnsubscribe', ['context' => $this->contextMock, 'filter' => $this->filterMock, 'collectionFactory' => $this->customerCollectionFactoryMock, 'customerRepository' => $this->customerRepositoryMock, 'subscriberFactory' => $subscriberFactoryMock]);
}
开发者ID:tingyeeh,项目名称:magento2,代码行数:31,代码来源:MassUnsubscribeTest.php
示例3: __construct
/**
* @param \Magento\Framework\App\Action\Context $context
* @param PhpCookieManager $cookieManager
* @param CookieMetadataFactory $cookieMetadataFactory
*/
public function __construct(\Magento\Framework\App\Action\Context $context, PhpCookieManager $cookieManager, CookieMetadataFactory $cookieMetadataFactory)
{
$this->cookieManager = $cookieManager;
$this->cookieMetadataFacory = $cookieMetadataFactory;
$this->_response = $context->getResponse();
$this->request = $context->getRequest();
}
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:12,代码来源:CookieTester.php
示例4: setUp
public function setUp()
{
$objectManagerHelper = new ObjectManagerHelper($this);
$this->context = $this->getMock('Magento\\Backend\\App\\Action\\Context', [], [], '', false);
$this->response = $this->getMock('Magento\\Framework\\App\\ResponseInterface', [], [], '', false);
$this->request = $this->getMock('Magento\\Framework\\App\\RequestInterface', [], [], '', false);
$this->objectManager = $this->getMock('Magento\\Framework\\ObjectManager\\ObjectManager', [], [], '', false);
$this->messageManager = $this->getMock('Magento\\Framework\\Message\\Manager', [], [], '', false);
$this->session = $this->getMock('Magento\\Backend\\Model\\Session', ['setIsUrlNotice'], [], '', false);
$this->actionFlag = $this->getMock('Magento\\Framework\\App\\ActionFlag', [], [], '', false);
$this->helper = $this->getMock('\\Magento\\Backend\\Helper\\Data', [], [], '', false);
$this->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->context->expects($this->once())->method('getMessageManager')->willReturn($this->messageManager);
$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('getRequest')->willReturn($this->request);
$this->context->expects($this->once())->method('getResponse')->willReturn($this->response);
$this->context->expects($this->once())->method('getHelper')->willReturn($this->helper);
$this->context->expects($this->once())->method('getResultRedirectFactory')->willReturn($this->resultRedirectFactory);
$this->resultForward = $this->getMockBuilder('Magento\\Backend\\Model\\View\\Result\\Forward')->disableOriginalConstructor()->getMock();
$this->resultForwardFactory = $this->getMockBuilder('Magento\\Backend\\Model\\View\\Result\\ForwardFactory')->disableOriginalConstructor()->setMethods(['create'])->getMock();
$this->invoiceEmail = $objectManagerHelper->getObject('Magento\\Sales\\Controller\\Adminhtml\\Order\\Invoice\\Email', ['context' => $this->context, 'resultForwardFactory' => $this->resultForwardFactory]);
}
开发者ID:opexsw,项目名称:magento2,代码行数:25,代码来源:EmailTest.php
示例5: 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', 'getResultFactory'], [], '', 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->resultFactory = $this->getMock('Magento\\Framework\\Controller\\ResultFactory', ['create'], [], '', false);
$this->resultFactory->expects($this->once())->method('create')->with(\Magento\Framework\Controller\ResultFactory::TYPE_REDIRECT)->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('getResultFactory')->willReturn($this->resultFactory);
$this->shipmentEmail = $objectManagerHelper->getObject('Magento\\Shipping\\Controller\\Adminhtml\\Order\\Shipment\\Email', ['context' => $this->context, 'shipmentLoader' => $this->shipmentLoader, 'request' => $this->request, 'response' => $this->response]);
}
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:25,代码来源:EmailTest.php
示例6: __construct
/**
* @param \Magento\Framework\App\Action\Context $context
*/
public function __construct(\Magento\Framework\App\Action\Context $context)
{
$this->_request = $context->getRequest();
$this->_response = $context->getResponse();
$this->resultRedirectFactory = $context->getResultRedirectFactory();
$this->resultFactory = $context->getResultFactory();
}
开发者ID:whoople,项目名称:magento2-testing,代码行数:10,代码来源:AbstractAction.php
示例7: __construct
/**
* @param Context $context
*/
public function __construct(Context $context)
{
$this->_request = $context->getRequest();
$this->_response = $context->getResponse();
$this->resultRedirectFactory = $context->getResultRedirectFactory();
$this->resultFactory = $context->getResultFactory();
}
开发者ID:Doability,项目名称:magento2dev,代码行数:10,代码来源:AbstractAction.php
示例8: __construct
/**
* @param AuthorFactory $authorFactory
* @param Registry $registry
* @param Context $context
*/
public function __construct(AuthorFactory $authorFactory, Registry $registry, Context $context)
{
$this->authorFactory = $authorFactory;
$this->registry = $registry;
$this->resultFactory = $context->getResultFactory();
parent::__construct($context);
}
开发者ID:mirasvit,项目名称:module-blog,代码行数:12,代码来源:View.php
示例9: __construct
/**
* @param Context $context
* @param Registry $coreRegistry
* @param DataFactory $dataFactory
* @param CartManagementInterface $cartManagement
* @param Onepage $onepageCheckout
* @param JsonHelper $jsonHelper
*/
public function __construct(Context $context, Registry $coreRegistry, DataFactory $dataFactory, CartManagementInterface $cartManagement, Onepage $onepageCheckout, JsonHelper $jsonHelper)
{
$this->eventManager = $context->getEventManager();
$this->cartManagement = $cartManagement;
$this->onepageCheckout = $onepageCheckout;
$this->jsonHelper = $jsonHelper;
parent::__construct($context, $coreRegistry, $dataFactory);
}
开发者ID:Doability,项目名称:magento2dev,代码行数:16,代码来源:Place.php
示例10: setUp
protected function setUp()
{
$this->response = $this->getMock('Magento\\Framework\\App\\ResponseInterface', ['setRedirect', 'sendResponse']);
$this->redirect = $this->getMock('\\Magento\\Framework\\App\\Response\\RedirectInterface');
$this->context = $this->getMock('Magento\\Framework\\App\\Action\\Context', [], [], '', false);
$this->context->expects($this->any())->method('getResponse')->will($this->returnValue($this->response));
$this->context->expects($this->any())->method('getRedirect')->will($this->returnValue($this->redirect));
$this->unit = (new ObjectManager($this))->getObject('Magento\\Store\\Controller\\Store\\SwitchAction', ['context' => $this->context]);
}
开发者ID:nja78,项目名称:magento2,代码行数:9,代码来源:SwitchActionTest.php
示例11: __construct
/**
* AjaxPlugin constructor.
* @param Context $context
* @param \Boxalino\Intelligence\Helper\Data $bxHelperData
* @param \Boxalino\Intelligence\Helper\P13n\Adapter $p13nHelper
* @param AutocompleteInterface $autocomplete
* @param \Boxalino\Intelligence\Helper\Autocomplete $autocompleteHelper
*/
public function __construct(Context $context, \Boxalino\Intelligence\Helper\Data $bxHelperData, \Boxalino\Intelligence\Helper\P13n\Adapter $p13nHelper, \Boxalino\Intelligence\Helper\Autocomplete $autocompleteHelper)
{
$this->autocompleteHelper = $autocompleteHelper;
$this->url = $context->getUrl();
$this->request = $context->getRequest();
$this->p13nHelper = $p13nHelper;
$this->resultFactory = $context->getResultFactory();
$this->bxHelperData = $bxHelperData;
}
开发者ID:boxalino,项目名称:plugin-magento2,代码行数:17,代码来源:AjaxPlugin.php
示例12: testExecuteException
/**
* Run test for execute method (exception)
*
* @expectedException \Magento\Framework\Exception\LocalizedException
* @expectedExceptionMessage Wrong type of request.
*/
public function testExecuteException()
{
$this->contextMock = $this->getMockBuilder('Magento\\Framework\\App\\Action\\Context')->disableOriginalConstructor()->getMock();
$this->contextMock->expects(static::once())->method('getRequest')->willReturn($this->getRequestMock(false));
$this->checkoutSessionMock = $this->getMockBuilder('Magento\\Checkout\\Model\\Session')->disableOriginalConstructor()->getMock();
$this->checkoutSessionMock->expects(static::never())->method('getQuote');
$getButtonData = new GetButtonData($this->contextMock, $this->checkoutSessionMock);
$getButtonData->execute();
}
开发者ID:whoople,项目名称:magento2-testing,代码行数:15,代码来源:GetButtonDataTest.php
示例13: __construct
/**
* @param \Magento\Framework\App\Action\Context $context
* @param \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder
* @param \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
*/
public function __construct(\Magento\Framework\App\Action\Context $context, \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder, \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\Escaper $escaper)
{
$this->_transportBuilder = $transportBuilder;
$this->inlineTranslation = $inlineTranslation;
$this->scopeConfig = $scopeConfig;
$this->storeManager = $storeManager;
$this->_escaper = $escaper;
$this->messageManager = $context->getMessageManager();
}
开发者ID:alinmiron,项目名称:alin-cadou,代码行数:16,代码来源:Mailer.php
示例14: __construct
/**
* @param PaymentHelper $paymentHelper
*/
public function __construct(\Magento\Framework\App\Action\Context $context, PaymentHelper $paymentHelper, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\View\Asset\Repository $assetRepo)
{
$this->_request = $context->getRequest();
$this->methodInstance = $paymentHelper->getMethodInstance($this->methodCode);
$this->_scopeConfig = $scopeConfig;
$this->_checkoutSession = $checkoutSession;
$this->_storeManager = $storeManager;
$this->_assetRepo = $assetRepo;
$this->_context = $context;
}
开发者ID:SummaSolutions,项目名称:cart-magento2,代码行数:13,代码来源:CustomConfigProvider.php
示例15: setUp
public function setUp()
{
$this->request = $this->getMockBuilder('Magento\\Framework\\App\\RequestInterface')->disableOriginalConstructor()->getMock();
$this->response = $this->getMock('Magento\\Framework\\App\\ResponseInterface', [], [], '', false);
$this->redirect = $this->getMockBuilder('Magento\\Framework\\Controller\\Result\\Redirect')->setMethods(['setRefererOrBaseUrl'])->disableOriginalConstructor()->getMock();
$this->redirectFactory = $this->getMockBuilder('Magento\\Backend\\Model\\View\\Result\\RedirectFactory')->setMethods(['create'])->disableOriginalConstructor()->getMock();
$this->redirectFactory->expects($this->any())->method('create')->willReturn($this->redirect);
$this->context = $this->getMockBuilder('Magento\\Framework\\App\\Action\\Context')->disableOriginalConstructor()->getMock();
$this->context->expects($this->any())->method('getResultRedirectFactory')->willReturn($this->redirectFactory);
$this->action = $this->getMockForAbstractClass('Magento\\Framework\\App\\Action\\AbstractAction', [$this->context]);
}
开发者ID:opexsw,项目名称:magento2,代码行数:11,代码来源:AbstractActionTest.php
示例16: setUp
protected function setUp()
{
$this->context = $this->getMockBuilder('Magento\\Framework\\App\\Action\\Context')->disableOriginalConstructor()->getMock();
$this->request = $this->getMockBuilder('Magento\\Framework\\App\\RequestInterface')->getMockForAbstractClass();
$this->context->expects($this->once())->method('getRequest')->willReturn($this->request);
$this->response = $this->getMockBuilder('Magento\\Framework\\App\\ResponseInterface')->getMockForAbstractClass();
$this->context->expects($this->once())->method('getResponse')->willReturn($this->response);
$this->resultPageFactory = $this->getMockBuilder('Magento\\Framework\\View\\Result\\PageFactory')->disableOriginalConstructor()->getMock();
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
$this->controller = $objectManager->getObject('\\Magento\\SampleServiceContractClient\\Controller\\Index\\Index', ['context' => $this->context, 'resultPageFactory' => $this->resultPageFactory]);
}
开发者ID:marcinNS,项目名称:magento2-samples,代码行数:11,代码来源:IndexTest.php
示例17: __construct
/**
* @param Context $context
*/
public function __construct(Context $context)
{
parent::__construct($context->getRequest(), $context->getResponse());
$this->_objectManager = $context->getObjectManager();
$this->_eventManager = $context->getEventManager();
$this->_url = $context->getUrl();
$this->_actionFlag = $context->getActionFlag();
$this->_redirect = $context->getRedirect();
$this->_view = $context->getView();
$this->messageManager = $context->getMessageManager();
}
开发者ID:shabbirvividads,项目名称:magento2,代码行数:14,代码来源:Action.php
示例18: afterGetButtonList
public function afterGetButtonList(\Magento\Backend\Block\Widget\Context $subject, \Magento\Backend\Block\Widget\Button\ButtonList $buttonList)
{
$request = $this->_context->getRequest();
if ($request->getFullActionName() == 'sales_order_view') {
$order = $this->getOrder();
if ($order && $order->getState() == 'canceled') {
$message = __('Are you sure you want to un-cancel this order?');
$buttonList->add('order_uncancel', ['label' => __('Un-Cancel'), 'onclick' => "confirmSetLocation('{$message}', '" . $this->getUnCancelUrl() . "')"]);
}
}
return $buttonList;
}
开发者ID:Genmato,项目名称:M2_UnCancelOrder,代码行数:12,代码来源:Context.php
示例19: __construct
public function __construct(\Magento\Framework\App\Action\Context $context, \Magento\Checkout\Model\CartFactory $cartModel, \Magento\Framework\ObjectManagerInterface $objectInterface, \Magento\Checkout\Model\Session $checkoutSession, \Rejoiner\Acr\Helper\Data $rejoinerHelper, \Magento\CatalogInventory\Model\ResourceModel\Stock\ItemFactory $stockItem, \Magento\CatalogInventory\Api\Data\StockItemInterfaceFactory $stockItemFactory, \Magento\Store\Model\StoreManagerInterface $storeManagerInterface, \Magento\Catalog\Model\ProductFactory $product)
{
$this->_checkoutSession = $checkoutSession;
$this->_objectInterface = $objectInterface;
$this->_rejoinerHelper = $rejoinerHelper;
$this->_stockItemFactory = $stockItemFactory;
$this->_cartModel = $cartModel;
$this->_stockItem = $stockItem;
$this->_storeManagerInterface = $storeManagerInterface;
$this->_product = $product;
$this->_messageManager = $context->getMessageManager();
parent::__construct($context);
}
开发者ID:pavlots,项目名称:rejoiner,代码行数:13,代码来源:Index.php
示例20: setUp
protected function setUp()
{
$this->requestMock = $this->getMockBuilder('Magento\\Framework\\App\\RequestInterface')->setMethods(['getPostValue'])->disableOriginalConstructor()->getMockForAbstractClass();
$this->viewMock = $this->getMockBuilder('Magento\\Framework\\App\\ViewInterface')->disableOriginalConstructor()->getMockForAbstractClass();
$this->coreRegistryMock = $this->getMockBuilder('Magento\\Framework\\Registry')->setMethods(['register'])->disableOriginalConstructor()->getMock();
$this->resultLayoutMock = $this->getMockBuilder('Magento\\Framework\\View\\Result\\Layout')->setMethods(['addDefaultHandle', 'getLayout', 'getUpdate', 'load'])->disableOriginalConstructor()->getMock();
$this->resultLayoutFactoryMock = $this->getMockBuilder('Magento\\Framework\\View\\Result\\LayoutFactory')->setMethods(['create'])->disableOriginalConstructor()->getMock();
$this->resultLayoutFactoryMock->expects($this->once())->method('create')->willReturn($this->resultLayoutMock);
$this->transactionMock = $this->getMockBuilder('Magento\\Paypal\\Model\\Payflow\\Service\\Response\\Transaction')->setMethods(['getResponseObject', 'validateResponse', 'savePaymentInQuote'])->disableOriginalConstructor()->getMock();
$this->contextMock = $this->getMockBuilder('\\Magento\\Framework\\App\\Action\\Context')->setMethods(['getRequest'])->disableOriginalConstructor()->getMock();
$this->contextMock->expects($this->once())->method('getRequest')->willReturn($this->requestMock);
$this->responseValidatorMock = $this->getMockBuilder('Magento\\Paypal\\Model\\Payflow\\Service\\Response\\Validator\\ResponseValidator')->disableOriginalConstructor()->getMock();
$this->object = new Response($this->contextMock, $this->coreRegistryMock, $this->transactionMock, $this->responseValidatorMock, $this->resultLayoutFactoryMock);
}
开发者ID:nblair,项目名称:magescotch,代码行数:14,代码来源:ResponseTest.php
注:本文中的Magento\Framework\App\Action\Context类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论