当前位置: 首页>>代码示例>>PHP>>正文


PHP Action\Context类代码示例

本文整理汇总了PHP中Magento\Backend\App\Action\Context的典型用法代码示例。如果您正苦于以下问题:PHP Context类的具体用法?PHP Context怎么用?PHP Context使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Context类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct(\Magento\Backend\App\Action\Context $context, \Magento\Framework\View\Result\PageFactory $resultPageFactory, \Magento\Backend\Model\View\Result\ForwardFactory $resultForwardFactory)
 {
     $this->resultPageFactory = $resultPageFactory;
     $this->resultForwardFactory = $resultForwardFactory;
     $this->resultRedirectFactory = $context->getResultRedirectFactory();
     parent::__construct($context);
 }
开发者ID:ksz2013,项目名称:B05032-Foggyline_Helpdesk,代码行数:7,代码来源:Ticket.php

示例2: __construct

 /**
  * ResetContactImport constructor.
  *
  * @param \Dotdigitalgroup\Email\Model\ResourceModel\ContactFactory $contactResourceFactory
  * @param \Dotdigitalgroup\Email\Model\ContactFactory               $contactFactory
  * @param \Dotdigitalgroup\Email\Helper\Data                        $data
  * @param \Magento\Backend\App\Action\Context                       $context
  */
 public function __construct(\Dotdigitalgroup\Email\Model\ResourceModel\ContactFactory $contactResourceFactory, \Dotdigitalgroup\Email\Model\ContactFactory $contactFactory, \Dotdigitalgroup\Email\Helper\Data $data, \Magento\Backend\App\Action\Context $context)
 {
     $this->contactFactory = $contactFactory;
     $this->contactResourceFactory = $contactResourceFactory;
     $this->helper = $data;
     $this->messageManager = $context->getMessageManager();
 }
开发者ID:dotmailer,项目名称:dotmailer-magento2-extension,代码行数:15,代码来源:ResetContactImport.php

示例3: __construct

 /**
  * Automapdatafields constructor.
  *
  * @param \Dotdigitalgroup\Email\Helper\Data               $data
  * @param \Dotdigitalgroup\Email\Model\Connector\Datafield $datafield
  * @param \Magento\Backend\App\Action\Context              $context
  */
 public function __construct(\Dotdigitalgroup\Email\Helper\Data $data, \Dotdigitalgroup\Email\Model\Connector\Datafield $datafield, \Magento\Backend\App\Action\Context $context)
 {
     $this->data = $data;
     $this->datafield = $datafield;
     $this->messageManager = $context->getMessageManager();
     parent::__construct($context);
 }
开发者ID:dotmailer,项目名称:dotmailer-magento2-extension,代码行数:14,代码来源:Automapdatafields.php

示例4: __construct

 public function __construct(\Magento\Backend\App\Action\Context $context, \Wyomind\Watchlog\Cron\PeriodicalReport $periodicalReport, \Wyomind\Watchlog\Helper\Data $watchlogHelper)
 {
     $this->resultRedirectFactory = $context->getResultRedirectFactory();
     $this->periodicalReport = $periodicalReport;
     $this->watchlogHelper = $watchlogHelper;
     parent::__construct($context);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:7,代码来源:Report.php

示例5: setUp

 /**
  * Init mocks for tests
  * @return void
  */
 public function setUp()
 {
     $this->objectManager = new ObjectManager($this);
     $this->contextMock = $this->getMockBuilder('\\Magento\\Backend\\App\\Action\\Context')->disableOriginalConstructor()->getMock();
     $this->viewMock = $this->getMock('\\Magento\\Framework\\App\\ViewInterface');
     $this->contextMock->expects($this->any())->method('getView')->will($this->returnValue($this->viewMock));
     $this->controller = $this->objectManager->getObject('\\Magento\\Security\\Controller\\Adminhtml\\Session\\Activity', ['context' => $this->contextMock]);
 }
开发者ID:dragonsword007008,项目名称:magento2,代码行数:12,代码来源:ActivityTest.php

示例6: __construct

 /**
  * AccountTransactionalDataCheck constructor.
  *
  * @param \Dotdigitalgroup\Email\Model\ContactFactory $contactFactory
  * @param \Dotdigitalgroup\Email\Helper\Data          $data
  * @param \Magento\Backend\App\Action\Context         $context
  * @param \Magento\Store\Model\StoreManagerInterface  $storeManagerInterface
  */
 public function __construct(\Dotdigitalgroup\Email\Model\ContactFactory $contactFactory, \Dotdigitalgroup\Email\Helper\Data $data, \Magento\Backend\App\Action\Context $context, \Magento\Store\Model\StoreManagerInterface $storeManagerInterface)
 {
     $this->_helper = $data;
     $this->_context = $context;
     $this->_contactFactory = $contactFactory;
     $this->_request = $context->getRequest();
     $this->_storeManager = $storeManagerInterface;
     $this->messageManager = $context->getMessageManager();
 }
开发者ID:dragonsword007008,项目名称:magento2,代码行数:17,代码来源:AccountTransactionalDataCheck.php

示例7: setUp

 public function setUp()
 {
     $this->context = $this->getMockBuilder('Magento\\Backend\\App\\Action\\Context')->disableOriginalConstructor()->getMock();
     $this->resultFactory = $this->getMockBuilder('Magento\\Framework\\Controller\\ResultFactory')->disableOriginalConstructor()->getMock();
     $this->resultPage = $this->getMockBuilder('Magento\\Framework\\Controller\\ResultInterface')->setMethods(['setData'])->getMockForAbstractClass();
     $this->imageProcessor = $this->getMockBuilder('Magento\\Theme\\Model\\Design\\Config\\FileUploader\\ImageProcessor')->disableOriginalConstructor()->getMock();
     $this->context->expects($this->once())->method('getResultFactory')->willReturn($this->resultFactory);
     $this->controller = new Save($this->context, $this->imageProcessor);
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:9,代码来源:SaveTest.php

示例8: initContext

 protected function initContext()
 {
     $this->request = $this->getMockBuilder('Magento\\Framework\\App\\Request\\Http')->disableOriginalConstructor()->getMock();
     $this->context = $this->getMockBuilder('Magento\\Backend\\App\\Action\\Context')->disableOriginalConstructor()->getMock();
     $this->context->expects($this->any())->method('getRequest')->willReturn($this->request);
     $this->resultRedirect = $this->getMockBuilder('Magento\\Framework\\Controller\\Result\\Redirect')->disableOriginalConstructor()->getMock();
     $resultRedirectFactory = $this->getMockBuilder('Magento\\Framework\\Controller\\Result\\RedirectFactory')->disableOriginalConstructor()->setMethods(['create'])->getMock();
     $resultRedirectFactory->expects($this->any())->method('create')->willReturn($this->resultRedirect);
     $this->context->expects($this->any())->method('getResultRedirectFactory')->willReturn($resultRedirectFactory);
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:10,代码来源:EditTest.php

示例9: setUp

    protected function setUp()
    {
        $this->autocomplete = $this->getMockBuilder('Magento\Search\Model\AutocompleteInterface')
            ->disableOriginalConstructor()
            ->setMethods(['getItems'])
            ->getMockForAbstractClass();
        $this->request = $this->getMockBuilder('\Magento\Framework\App\RequestInterface')
            ->disableOriginalConstructor()
            ->setMethods([])
            ->getMockForAbstractClass();
        $this->url = $this->getMockBuilder('Magento\Framework\UrlInterface')
            ->disableOriginalConstructor()
            ->setMethods(['getBaseUrl'])
            ->getMockForAbstractClass();
        $this->resultFactoryMock = $this->getMockBuilder('Magento\Framework\Controller\ResultFactory')
            ->disableOriginalConstructor()
            ->getMock();
        $this->resultRedirectMock = $this->getMockBuilder('Magento\Backend\Model\View\Result\Redirect')
            ->disableOriginalConstructor()
            ->getMock();
        $this->resultJsonMock = $this->getMockBuilder('Magento\Framework\Controller\Result\Json')
            ->disableOriginalConstructor()
            ->getMock();

        $this->context = $this->getMockBuilder('Magento\Framework\App\Action\Context')
            ->disableOriginalConstructor()
            ->getMock();
        $this->context->expects($this->atLeastOnce())
            ->method('getRequest')
            ->will($this->returnValue($this->request));
        $this->context->expects($this->any())
            ->method('getUrl')
            ->will($this->returnValue($this->url));
        $this->context->expects($this->any())
            ->method('getResultFactory')
            ->willReturn($this->resultFactoryMock);
        $this->resultFactoryMock->expects($this->any())
            ->method('create')
            ->willReturnMap(
                [
                    [ResultFactory::TYPE_REDIRECT, [], $this->resultRedirectMock],
                    [ResultFactory::TYPE_JSON, [], $this->resultJsonMock]
                ]
            );

        $this->objectManagerHelper = new ObjectManagerHelper($this);
        $this->controller = $this->objectManagerHelper->getObject(
            'Magento\Search\Controller\Ajax\Suggest',
            [
                'context' => $this->context,
                'autocomplete' => $this->autocomplete
            ]
        );
    }
开发者ID:nblair,项目名称:magescotch,代码行数:54,代码来源:SuggestTest.php

示例10: setUp

 /**
  * Set up
  */
 protected function setUp()
 {
     $this->resultPage = $this->getMock('Magento\\Backend\\Model\\View\\Result\\Page', ['setActiveMenu', 'getConfig', 'getTitle', 'prepend', 'addBreadcrumb'], [], '', false);
     $this->resultPage->expects($this->any())->method('getConfig')->willReturnSelf();
     $this->resultPage->expects($this->any())->method('getTitle')->willReturnSelf();
     $this->resultFactory = $this->getMock('Magento\\Framework\\Controller\\ResultFactory', ['create'], [], '', false);
     $this->resultFactory->expects($this->any())->method('create')->willReturn($this->resultPage);
     $this->context = $this->getMock('Magento\\Backend\\App\\Action\\Context', ['getResultFactory'], [], '', false);
     $this->context->expects($this->any())->method('getResultFactory')->willReturn($this->resultFactory);
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->indexController = $this->objectManagerHelper->getObject('Magento\\ImportExport\\Controller\\Adminhtml\\History\\Index', ['context' => $this->context]);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:15,代码来源:IndexTest.php

示例11: setUp

    protected function setUp()
    {
        $this->request = $this->getMockBuilder('\Magento\Framework\App\RequestInterface')
            ->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->pageFactory = $this->getMockBuilder('Magento\Framework\View\Result\PageFactory')
            ->setMethods([])
            ->disableOriginalConstructor()
            ->getMock();
        $this->resultRedirectMock = $this->getMockBuilder('Magento\Backend\Model\View\Result\Redirect')
            ->disableOriginalConstructor()
            ->getMock();
        $this->resultFactoryMock = $this->getMockBuilder('Magento\Framework\Controller\ResultFactory')
            ->disableOriginalConstructor()
            ->getMock();
        $this->resultFactoryMock->expects($this->any())
            ->method('create')
            ->with(ResultFactory::TYPE_REDIRECT, [])
            ->willReturn($this->resultRedirectMock);
        $this->context = $this->getMockBuilder('Magento\Backend\App\Action\Context')
            ->disableOriginalConstructor()
            ->getMock();
        $this->context->expects($this->atLeastOnce())
            ->method('getRequest')
            ->willReturn($this->request);
        $this->context->expects($this->any())
            ->method('getObjectManager')
            ->willReturn($this->objectManager);
        $this->context->expects($this->any())
            ->method('getMessageManager')
            ->willReturn($this->messageManager);
        $this->context->expects($this->any())
            ->method('getResultFactory')
            ->willReturn($this->resultFactoryMock);

        $this->objectManagerHelper = new ObjectManagerHelper($this);
        $this->controller = $this->objectManagerHelper->getObject(
            'Magento\Search\Controller\Adminhtml\Term\MassDelete',
            [
                'context' => $this->context,
                'resultPageFactory' => $this->pageFactory,
            ]
        );
    }
开发者ID:nblair,项目名称:magescotch,代码行数:53,代码来源:MassDeleteTest.php

示例12: setUp

 protected function setUp()
 {
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->context = $this->getMockBuilder('\\Magento\\Backend\\App\\Action\\Context')->disableOriginalConstructor()->getMock();
     $this->request = $this->getMock('Magento\\Framework\\App\\RequestInterface');
     $this->response = $this->getMock('\\Magento\\Framework\\App\\ResponseInterface', ['sendResponse', 'setBody']);
     $this->view = $this->getMock('\\Magento\\Framework\\App\\ViewInterface');
     $this->context->expects($this->any())->method('getRequest')->will($this->returnValue($this->request));
     $this->context->expects($this->any())->method('getResponse')->will($this->returnValue($this->response));
     $this->context->expects($this->any())->method('getView')->will($this->returnValue($this->view));
     $this->controller = $this->objectManagerHelper->getObject('\\Magento\\Bundle\\Controller\\Adminhtml\\Bundle\\Selection\\Grid', ['context' => $this->context]);
 }
开发者ID:nja78,项目名称:magento2,代码行数:12,代码来源:GridTest.php

示例13: setUp

 protected function setUp()
 {
     $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $this->messageManagerMock = $this->getMock('Magento\\Framework\\Message\\ManagerInterface', [], [], '', false);
     $this->resultFactoryMock = $this->getMockBuilder('Magento\\Framework\\Controller\\ResultFactory')->disableOriginalConstructor()->getMock();
     $this->resultRedirectMock = $this->getMockBuilder('Magento\\Backend\\Model\\View\\Result\\Redirect')->disableOriginalConstructor()->getMock();
     $this->resultFactoryMock->expects($this->any())->method('create')->with(ResultFactory::TYPE_REDIRECT, [])->willReturn($this->resultRedirectMock);
     $this->contextMock = $this->getMock('\\Magento\\Backend\\App\\Action\\Context', [], [], '', false);
     $this->filterMock = $this->getMockBuilder('Magento\\Ui\\Component\\MassAction\\Filter')->disableOriginalConstructor()->getMock();
     $this->contextMock->expects($this->any())->method('getMessageManager')->willReturn($this->messageManagerMock);
     $this->contextMock->expects($this->any())->method('getResultFactory')->willReturn($this->resultFactoryMock);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:12,代码来源:AbstractMassActionTest.php

示例14: setUp

 protected function setUp()
 {
     $this->objectManager = new ObjectManager($this);
     $this->contextMock = $this->getMockBuilder(Context::class)->disableOriginalConstructor()->getMock();
     $this->attributeLabelCacheMock = $this->getMockBuilder(FrontendInterface::class)->getMockForAbstractClass();
     $this->coreRegistryMock = $this->getMockBuilder(Registry::class)->disableOriginalConstructor()->getMock();
     $this->resultPageFactoryMock = $this->getMockBuilder(PageFactory::class)->disableOriginalConstructor()->getMock();
     $this->requestMock = $this->getMockBuilder(RequestInterface::class)->setMethods(['getPostValue', 'has'])->getMockForAbstractClass();
     $this->resultFactoryMock = $this->getMockBuilder(ResultFactory::class)->disableOriginalConstructor()->getMock();
     $this->contextMock->expects($this->any())->method('getRequest')->willReturn($this->requestMock);
     $this->contextMock->expects($this->any())->method('getResultFactory')->willReturn($this->resultFactoryMock);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:12,代码来源:AttributeTest.php

示例15: setUp

 protected function setUp()
 {
     $this->autocomplete = $this->getMockBuilder('Magento\\Search\\Model\\AutocompleteInterface')->disableOriginalConstructor()->setMethods(['getItems'])->getMockForAbstractClass();
     $this->request = $this->getMockBuilder('\\Magento\\Framework\\App\\RequestInterface')->disableOriginalConstructor()->setMethods([])->getMockForAbstractClass();
     $this->response = $this->getMockBuilder('\\Magento\\Framework\\App\\ResponseInterface')->disableOriginalConstructor()->setMethods(['representJson', 'setRedirect'])->getMockForAbstractClass();
     $this->url = $this->getMockBuilder('Magento\\Framework\\UrlInterface')->disableOriginalConstructor()->setMethods(['getBaseUrl'])->getMockForAbstractClass();
     $this->context = $this->getMockBuilder('Magento\\Framework\\App\\Action\\Context')->setMethods(['getRequest', 'getResponse', 'getUrl'])->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('getUrl')->will($this->returnValue($this->url));
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->controller = $this->objectManagerHelper->getObject('Magento\\Search\\Controller\\Ajax\\Suggest', ['context' => $this->context, 'autocomplete' => $this->autocomplete]);
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:13,代码来源:SuggestTest.php


注:本文中的Magento\Backend\App\Action\Context类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。