• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Model\Session类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: setUp

 /**
  * Set up test
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 protected function setUp()
 {
     $this->contextMock = $this->getMock('Magento\\Backend\\App\\Action\\Context', ['getAuthorization', 'getSession', 'getActionFlag', 'getAuth', 'getView', 'getHelper', 'getBackendUrl', 'getFormKeyValidator', 'getLocaleResolver', 'getCanUseBaseUrl', 'getRequest', 'getResponse', 'getObjectManager', 'getMessageManager'], [], '', false);
     $this->response = $this->getMock('Magento\\Framework\\App\\ResponseInterface', ['setRedirect', 'sendResponse'], [], '', false);
     $this->view = $this->getMock('\\Magento\\Framework\\App\\ViewInterface', ['loadLayout', 'getPage', 'getConfig', 'getTitle', 'renderLayout', 'loadLayoutUpdates', 'getDefaultLayoutHandle', 'addPageLayoutHandles', 'generateLayoutBlocks', 'generateLayoutXml', 'getLayout', 'addActionLayoutHandles', 'setIsLayoutLoaded', 'isLayoutLoaded'], [], '', false);
     $this->session = $this->getMock('\\Magento\\Backend\\Model\\Session', ['setIsUrlNotice'], [], '', false);
     $this->session->expects($this->any())->method('setIsUrlNotice')->willReturn($this->objectManager);
     $this->actionFlag = $this->getMock('\\Magento\\Framework\\App\\ActionFlag', ['get'], [], '', false);
     $this->actionFlag->expects($this->any())->method("get")->willReturn($this->objectManager);
     $this->objectManager = $this->getMock('Magento\\Framework\\TestFramework\\Unit\\Helper\\ObjectManager', ['get'], [], '', false);
     $this->request = $this->getMockForAbstractClass('\\Magento\\Framework\\App\\RequestInterface', ['getParam', 'getRequest'], '', false);
     $this->response->expects($this->any())->method("setRedirect")->willReturn(1);
     $this->page = $this->getMock('\\Magento\\Framework\\View\\Result\\Page', [], [], '', false);
     $this->config = $this->getMock('\\Magento\\Framework\\View\\Result\\Page', [], [], '', false);
     $this->title = $this->getMock('\\Magento\\Framework\\View\\Page\\Title', [], [], '', false);
     $this->messageManager = $this->getMockForAbstractClass('\\Magento\\Framework\\Message\\ManagerInterface', ['addError', 'addSuccess'], '', false);
     $this->indexReg = $this->getMock('Magento\\Framework\\Indexer\\IndexerRegistry', ['get', 'setScheduled'], [], '', false);
     $this->helper = $this->getMock('\\Magento\\Backend\\Helper\\Data', ['getUrl'], [], '', false);
     $this->contextMock->expects($this->any())->method("getObjectManager")->willReturn($this->objectManager);
     $this->contextMock->expects($this->any())->method("getRequest")->willReturn($this->request);
     $this->contextMock->expects($this->any())->method("getResponse")->willReturn($this->response);
     $this->contextMock->expects($this->any())->method("getMessageManager")->willReturn($this->messageManager);
     $this->contextMock->expects($this->any())->method("getSession")->willReturn($this->session);
     $this->contextMock->expects($this->any())->method("getActionFlag")->willReturn($this->actionFlag);
     $this->contextMock->expects($this->any())->method("getHelper")->willReturn($this->helper);
 }
开发者ID:nblair,项目名称:magescotch,代码行数:30,代码来源:MassChangelogTest.php


示例2: execute

 public function execute()
 {
     $id = $this->getRequest()->getParam('author_id');
     /** @var \Sample\News\Model\Author $author */
     $author = $this->initAuthor();
     /** @var \Magento\Backend\Model\View\Result\Page|\Magento\Framework\View\Result\Page $resultPage */
     $resultPage = $this->resultPageFactory->create();
     $resultPage->setActiveMenu('Sample_News::author');
     $resultPage->getConfig()->getTitle()->set(__('Authors'));
     if ($id) {
         $author->load($id);
         if (!$author->getId()) {
             $this->messageManager->addError(__('This author no longer exists.'));
             $resultRedirect = $this->resultRedirectFactory->create();
             $resultRedirect->setPath('sample_news/*/edit', ['author_id' => $author->getId(), '_current' => true]);
             return $resultRedirect;
         }
     }
     $title = $author->getId() ? $author->getName() : __('New Author');
     $resultPage->getConfig()->getTitle()->append($title);
     $data = $this->backendSession->getData('sample_news_author_data', true);
     if (!empty($data)) {
         $author->setData($data);
     }
     return $resultPage;
 }
开发者ID:nhc,项目名称:Magento2SampleModule,代码行数:26,代码来源:Edit.php


示例3: switchBackendInterfaceLocale

 /**
  * Switch backend locale according to locale code
  *
  * @param string $localeCode
  * @return $this
  */
 public function switchBackendInterfaceLocale($localeCode)
 {
     $this->_session->setSessionLocale(null);
     $this->_authSession->getUser()->setInterfaceLocale($localeCode);
     $this->_translator->setLocale($localeCode)->loadData(null, true);
     return $this;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:13,代码来源:Manager.php


示例4: testSwitchBackendInterfaceLocale

 /**
  * @param string $locale
  * @dataProvider switchBackendInterfaceLocaleDataProvider
  * @covers \Magento\Backend\Model\Locale\Manager::switchBackendInterfaceLocale
  */
 public function testSwitchBackendInterfaceLocale($locale)
 {
     $this->_model->switchBackendInterfaceLocale($locale);
     $userInterfaceLocale = $this->_authSession->getUser()->getInterfaceLocale();
     $this->assertEquals($userInterfaceLocale, $locale);
     $sessionLocale = $this->_session->getSessionLocale();
     $this->assertEquals($sessionLocale, null);
 }
开发者ID:opexsw,项目名称:magento2,代码行数:13,代码来源:ManagerTest.php


示例5: bindLocale

 /**
  * Bind locale
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return $this
  */
 public function bindLocale($observer)
 {
     $locale = $observer->getEvent()->getLocale();
     if ($locale) {
         $selectedLocale = $this->_backendSession->getLocale();
         if ($selectedLocale) {
             $locale->setLocaleCode($selectedLocale);
         }
     }
     return $this;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:17,代码来源:Observer.php


示例6: testToHtmlEmptyGlobalShareAndSessionData

 /**
  * @magentoDataFixture Magento/Customer/_files/customer.php
  * @magentoDataFixture Magento/Core/_files/second_third_store.php
  * @magentoConfigFixture current_store customer/account_share/scope 0
  */
 public function testToHtmlEmptyGlobalShareAndSessionData()
 {
     $this->registry->register(RegistryConstants::CURRENT_CUSTOMER_ID, 1);
     $customer = $this->customerAccountService->getCustomer(1);
     $this->backendSession->setCustomerData(array('account' => $customer->__toArray()));
     $block = $this->layout->createBlock('Magento\\Customer\\Block\\Adminhtml\\Edit\\Tab\\View\\Accordion');
     $html = $block->toHtml();
     $this->assertContains('Wishlist - 0 item(s)', $html);
     $this->assertContains('Shopping Cart of Main Website - 0 item(s)', $html);
     $this->assertContains('Shopping Cart of Second Website - 0 item(s)', $html);
     $this->assertContains('Shopping Cart of Third Website - 0 item(s)', $html);
 }
开发者ID:aiesh,项目名称:magento2,代码行数:17,代码来源:AccordionTest.php


示例7: setLocale

 /**
  * Set locale
  *
  * @param string $locale
  * @return $this
  */
 public function setLocale($locale = null)
 {
     $forceLocale = $this->_request->getParam('locale', null);
     if (!$this->_localeValidator->isValid($forceLocale)) {
         $forceLocale = false;
     }
     $sessionLocale = $this->_session->getSessionLocale();
     $userLocale = $this->_localeManager->getUserInterfaceLocale();
     $localeCodes = array_filter([$forceLocale, $sessionLocale, $userLocale]);
     if (count($localeCodes)) {
         $locale = reset($localeCodes);
     }
     return parent::setLocale($locale);
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:20,代码来源:Resolver.php


示例8: execute

 /**
  * @return \Magento\Backend\Model\View\Result\Page|\Magento\Backend\Model\View\Result\Redirect|\Magento\Framework\View\Result\Page
  */
 public function execute()
 {
     $id = $this->getRequest()->getParam('post_id');
     /** @var \Mageplaza\Blog\Model\Post $post */
     $post = $this->initPost();
     /** @var \Magento\Backend\Model\View\Result\Page|\Magento\Framework\View\Result\Page $resultPage */
     $resultPage = $this->resultPageFactory->create();
     $resultPage->setActiveMenu('Mageplaza_Blog::post');
     $resultPage->getConfig()->getTitle()->set(__('Posts'));
     if ($id) {
         $post->load($id);
         if (!$post->getId()) {
             $this->messageManager->addError(__('This Post no longer exists.'));
             $resultRedirect = $this->resultRedirectFactory->create();
             $resultRedirect->setPath('mageplaza_blog/*/edit', ['post_id' => $post->getId(), '_current' => true]);
             return $resultRedirect;
         }
     }
     $title = $post->getId() ? $post->getName() : __('New Post');
     $resultPage->getConfig()->getTitle()->prepend($title);
     $data = $this->backendSession->getData('mageplaza_blog_post_data', true);
     if (!empty($data)) {
         $post->setData($data);
     }
     return $resultPage;
 }
开发者ID:mageplaza,项目名称:magento-2-blog-extension,代码行数:29,代码来源:Edit.php


示例9: execute

 /**
  * Force admin to change password
  *
  * @param EventObserver $observer
  * @return void
  */
 public function execute(EventObserver $observer)
 {
     if (!$this->observerConfig->isPasswordChangeForced()) {
         return;
     }
     if (!$this->authSession->isLoggedIn()) {
         return;
     }
     $actionList = ['adminhtml_system_account_index', 'adminhtml_system_account_save', 'adminhtml_auth_logout'];
     /** @var \Magento\Framework\App\Action\Action $controller */
     $controller = $observer->getEvent()->getControllerAction();
     /** @var \Magento\Framework\App\RequestInterface $request */
     $request = $observer->getEvent()->getRequest();
     if ($this->authSession->getPciAdminUserIsPasswordExpired()) {
         if (!in_array($request->getFullActionName(), $actionList)) {
             if ($this->authorization->isAllowed('Magento_Backend::myaccount')) {
                 $controller->getResponse()->setRedirect($this->url->getUrl('adminhtml/system_account/'));
                 $this->actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, true);
                 $this->actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_POST_DISPATCH, true);
             } else {
                 /*
                  * if admin password is expired and access to 'My Account' page is denied
                  * than we need to do force logout with error message
                  */
                 $this->authSession->clearStorage();
                 $this->session->clearStorage();
                 $this->messageManager->addErrorMessage(__('Your password has expired; please contact your administrator.'));
                 $controller->getRequest()->setDispatched(false);
             }
         }
     }
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:38,代码来源:ForceAdminPasswordChangeObserver.php


示例10: testExecute

 public function testExecute()
 {
     $shipmentId = 1000012;
     $orderId = 10003;
     $tracking = [];
     $shipmentData = ['items' => [], 'send_email' => ''];
     $shipment = $this->getMock('Magento\\Sales\\Model\\Order\\Shipment', ['load', 'save', 'register', 'getOrder', 'getOrderId', '__wakeup'], [], '', false);
     $this->request->expects($this->any())->method('getParam')->will($this->returnValueMap([['order_id', null, $orderId], ['shipment_id', null, $shipmentId], ['shipment', null, $shipmentData], ['tracking', null, $tracking]]));
     $this->shipmentLoader->expects($this->any())->method('setShipmentId')->with($shipmentId);
     $this->shipmentLoader->expects($this->any())->method('setOrderId')->with($orderId);
     $this->shipmentLoader->expects($this->any())->method('setShipment')->with($shipmentData);
     $this->shipmentLoader->expects($this->any())->method('setTracking')->with($tracking);
     $this->shipmentLoader->expects($this->once())->method('load')->will($this->returnValue($shipment));
     $this->session->expects($this->once())->method('getCommentText')->with(true)->will($this->returnValue(''));
     $this->objectManager->expects($this->atLeastOnce())->method('get')->with('Magento\\Backend\\Model\\Session')->will($this->returnValue($this->session));
     $this->view->expects($this->once())->method('loadLayout')->will($this->returnSelf());
     $this->view->expects($this->once())->method('renderLayout')->will($this->returnSelf());
     $this->view->expects($this->any())->method('getPage')->willReturn($this->resultPageMock);
     $this->resultPageMock->expects($this->any())->method('getConfig')->willReturn($this->pageConfigMock);
     $this->pageConfigMock->expects($this->any())->method('getTitle')->willReturn($this->pageTitleMock);
     $layout = $this->getMock('Magento\\Framework\\View\\Layout\\Element\\Layout', ['getBlock'], [], '', false);
     $menuBlock = $this->getMock('Magento\\Framework\\View\\Element\\BlockInterface', ['toHtml', 'setActive', 'getMenuModel'], [], '', false);
     $menuModel = $this->getMockBuilder('Magento\\Backend\\Model\\Menu')->disableOriginalConstructor()->getMock();
     $itemId = 'Magento_Sales::sales_order';
     $parents = [new \Magento\Framework\DataObject(['title' => 'title1']), new \Magento\Framework\DataObject(['title' => 'title2']), new \Magento\Framework\DataObject(['title' => 'title3'])];
     $menuModel->expects($this->once())->method('getParentItems')->with($itemId)->will($this->returnValue($parents));
     $menuBlock->expects($this->once())->method('setActive')->with($itemId);
     $menuBlock->expects($this->once())->method('getMenuModel')->will($this->returnValue($menuModel));
     $this->view->expects($this->once())->method('getLayout')->will($this->returnValue($layout));
     $layout->expects($this->once())->method('getBlock')->with('menu')->will($this->returnValue($menuBlock));
     $this->assertNull($this->newAction->execute());
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:32,代码来源:NewActionTest.php


示例11: testNewCustomer

 /**
  * @magentoDataFixture Magento/Customer/_files/customer.php
  */
 public function testNewCustomer()
 {
     $customerBuilder = $this->objectManager->get('\\Magento\\Customer\\Service\\V1\\Data\\CustomerBuilder');
     $this->backendSession->setCustomerData(array('customer_id' => 0, 'account' => $customerBuilder->create()->__toArray()));
     $result = $this->accountBlock->initForm()->toHtml();
     // Contains send email controls
     $this->assertContains('<input id="_accountsendemail"', $result);
     $this->assertContains('<select id="_accountsendemail_store_id"', $result);
 }
开发者ID:aiesh,项目名称:magento2,代码行数:12,代码来源:AccountTest.php


示例12: testExecute

 public function testExecute()
 {
     $data = ['tmp_name' => 'tmp_name', 'path' => 'path', 'file' => 'file'];
     $uploader = $this->getMockBuilder('Magento\\MediaStorage\\Model\\File\\Uploader')->disableOriginalConstructor()->getMock();
     $resultJson = $this->getMockBuilder('Magento\\Framework\\Controller\\Result\\Json')->disableOriginalConstructor()->setMethods(['setData'])->getMock();
     $this->request->expects($this->once())->method('getParam')->with('type')->willReturn('samples');
     $this->sample->expects($this->once())->method('getBaseTmpPath')->willReturn('base_tmp_path');
     $this->uploaderFactory->expects($this->once())->method('create')->willReturn($uploader);
     $this->fileHelper->expects($this->once())->method('uploadFromTmp')->willReturn($data);
     $this->storageDatabase->expects($this->once())->method('saveFile');
     $this->session->expects($this->once())->method('getName')->willReturn('Name');
     $this->session->expects($this->once())->method('getSessionId')->willReturn('SessionId');
     $this->session->expects($this->once())->method('getCookieLifetime')->willReturn('CookieLifetime');
     $this->session->expects($this->once())->method('getCookiePath')->willReturn('CookiePath');
     $this->session->expects($this->once())->method('getCookieDomain')->willReturn('CookieDomain');
     $this->resultFactory->expects($this->once())->method('create')->willReturn($resultJson);
     $resultJson->expects($this->once())->method('setData')->willReturnSelf();
     $this->assertEquals($resultJson, $this->upload->execute());
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:19,代码来源:UploadTest.php


示例13: testNewCustomer

 /**
  * @magentoDataFixture Magento/Customer/_files/customer.php
  */
 public function testNewCustomer()
 {
     /** @var \Magento\Customer\Api\Data\CustomerInterfaceFactory $customerFactory */
     $customerFactory = $this->objectManager->get('Magento\\Customer\\Api\\Data\\CustomerInterfaceFactory');
     $customerData = $this->dataObjectProcessor->buildOutputDataArray($customerFactory->create(), '\\Magento\\Customer\\Api\\Data\\CustomerInterface');
     $this->backendSession->setCustomerData(['customer_id' => 0, 'account' => $customerData]);
     $result = $this->accountBlock->initForm()->toHtml();
     // Contains send email controls
     $this->assertContains('<input id="_accountsendemail"', $result);
     $this->assertContains('<select id="_accountsendemail_store_id"', $result);
 }
开发者ID:opexsw,项目名称:magento2,代码行数:14,代码来源:AccountTest.php


示例14: execute

 /**
  * run the action
  *
  * @return \Magento\Backend\Model\View\Result\Redirect
  */
 public function execute()
 {
     $data = $this->getRequest()->getPost('post');
     $resultRedirect = $this->resultRedirectFactory->create();
     if ($data) {
         $post = $this->initPost();
         $post->setData($data);
         $image = $this->uploadModel->uploadFileAndGetName('image', $this->imageModel->getBaseDir(), $data);
         if ($image) {
             $post->setImage('mageplaza/blog/post/image' . $image);
         }
         $tags = $this->getRequest()->getPost('tags', -1);
         if ($tags != -1) {
             $post->setTagsData($this->jsHelper->decodeGridSerializedInput($tags));
         }
         $topics = $this->getRequest()->getPost('topics', -1);
         if ($topics != -1) {
             $post->setTopicsData($this->jsHelper->decodeGridSerializedInput($topics));
         }
         if (!isset($data['categories_ids'])) {
             $post->setCategoriesIds([]);
         }
         $this->_eventManager->dispatch('mageplaza_blog_post_prepare_save', ['post' => $post, 'request' => $this->getRequest()]);
         try {
             $post->save();
             $trafficModel = $this->trafficFactory->create()->load($post->getId(), 'post_id');
             if (!$trafficModel->getId()) {
                 $trafficData = ['post_id' => $post->getId(), 'numbers_view' => '0'];
                 $trafficModel->setData($trafficData);
                 $trafficModel->save();
             }
             $this->messageManager->addSuccess(__('The Post has been saved.'));
             $this->backendSession->setMageplazaBlogPostData(false);
             if ($this->getRequest()->getParam('back')) {
                 $resultRedirect->setPath('mageplaza_blog/*/edit', ['post_id' => $post->getId(), '_current' => true]);
                 return $resultRedirect;
             }
             $resultRedirect->setPath('mageplaza_blog/*/');
             return $resultRedirect;
         } catch (\Magento\Framework\Exception\LocalizedException $e) {
             $this->messageManager->addError($e->getMessage());
         } catch (\RuntimeException $e) {
             $this->messageManager->addError($e->getMessage());
         } catch (\Exception $e) {
             $this->messageManager->addException($e, __('Something went wrong while saving the Post.'));
         }
         $this->_getSession()->setMageplazaBlogPostData($data);
         $resultRedirect->setPath('mageplaza_blog/*/edit', ['post_id' => $post->getId(), '_current' => true]);
         return $resultRedirect;
     }
     $resultRedirect->setPath('mageplaza_blog/*/');
     return $resultRedirect;
 }
开发者ID:mageplaza,项目名称:magento-2-blog-extension,代码行数:58,代码来源:Save.php


示例15: testUpdateNavigationMode

 public function testUpdateNavigationMode()
 {
     $this->_setAdditionalExpectations();
     $request = $this->getMock('Magento\\Framework\\App\\Request\\Http', [], [], '', false);
     $request->expects($this->once())->method('getPathInfo')->will($this->returnValue('/'));
     $this->_backendSession->expects($this->at(0))->method('setData')->with('vde_current_url', '/');
     $this->_backendSession->expects($this->at(1))->method('setData')->with('vde_current_mode', \Magento\DesignEditor\Model\State::MODE_NAVIGATION);
     $this->_urlModelFactory->expects($this->once())->method('replaceClassName')->with(self::URL_MODEL_NAVIGATION_MODE_CLASS_NAME);
     $this->_areaEmulator->expects($this->once())->method('emulateLayoutArea')->with(self::AREA_CODE);
     $controller = $this->getMock('Magento\\Backend\\App\\Action', [], [], '', false);
     $this->_model->update(self::AREA_CODE, $request, $controller);
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:12,代码来源:StateTest.php


示例16: _getItemData

 /**
  * Get requested items qtys and return to stock flags
  *
  * @return array
  */
 protected function _getItemData()
 {
     $data = $this->getCreditmemo();
     if (!$data) {
         $data = $this->backendSession->getFormData(true);
     }
     if (isset($data['items'])) {
         $qtys = $data['items'];
     } else {
         $qtys = [];
     }
     return $qtys;
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:18,代码来源:CreditmemoLoader.php


示例17: _getItemData

 /**
  * Get requested items qtys and return to stock flags
  *
  * @param RequestInterface $request
  * @return array
  */
 protected function _getItemData(RequestInterface $request)
 {
     $data = $request->getParam('creditmemo');
     if (!$data) {
         $data = $this->backendSession->getFormData(true);
     }
     if (isset($data['items'])) {
         $qtys = $data['items'];
     } else {
         $qtys = array();
     }
     return $qtys;
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:19,代码来源:CreditmemoLoader.php


示例18: setupExistingCustomerData

 /**
  * Put existing customer data into the backend session
  */
 protected function setupExistingCustomerData()
 {
     /** @var Customer $customer */
     $customer = $this->_customerAccountService->getCustomer(1);
     $this->_customerData = array('customer_id' => $customer->getId(), 'account' => \Magento\Framework\Service\ExtensibleDataObjectConverter::toFlatArray($customer));
     $this->_customerData['account']['id'] = $customer->getId();
     /** @var Address[] $addresses */
     $addresses = $this->_addressService->getAddresses(1);
     foreach ($addresses as $addressData) {
         $this->_customerData['address'][$addressData->getId()] = AddressConverter::toFlatArray($addressData);
         $this->_customerData['address'][$addressData->getId()]['id'] = $addressData->getId();
     }
     $this->_backendSession->setCustomerData($this->_customerData);
 }
开发者ID:aiesh,项目名称:magento2,代码行数:17,代码来源:AddressesTest.php


示例19: setupExistingCustomerData

 /**
  * Put existing customer data into the backend session
  */
 protected function setupExistingCustomerData()
 {
     /** @var \Magento\Customer\Api\Data\CustomerInterface $customer */
     $customer = $this->_customerRepository->getById(1);
     $this->_customerData = ['customer_id' => $customer->getId(), 'account' => $this->customerMapper->toFlatArray($customer)];
     $this->_customerData['account']['id'] = $customer->getId();
     /** @var \Magento\Customer\Api\Data\AddressInterface[] $addresses */
     $addresses = $customer->getAddresses();
     foreach ($addresses as $addressData) {
         $this->_customerData['address'][$addressData->getId()] = $this->addressMapper->toFlatArray($addressData);
         $this->_customerData['address'][$addressData->getId()]['id'] = $addressData->getId();
     }
     $this->_backendSession->setCustomerData($this->_customerData);
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:17,代码来源:AddressesTest.php


示例20: testExecute

 /**
  * @covers \Magento\Customer\Controller\Adminhtml\Index\Index::execute
  */
 public function testExecute()
 {
     $this->prepareExecute();
     $this->resultPageFactoryMock->expects($this->once())->method('create')->willReturn($this->resultPageMock);
     $this->resultPageMock->expects($this->once())->method('setActiveMenu')->with('Magento_Customer::customer_manage');
     $this->resultPageMock->expects($this->once())->method('getConfig')->willReturn($this->pageConfigMock);
     $this->pageConfigMock->expects($this->once())->method('getTitle')->willReturn($this->pageTitleMock);
     $this->pageTitleMock->expects($this->once())->method('prepend')->with('Customers');
     $this->resultPageMock->expects($this->atLeastOnce())->method('addBreadcrumb')->withConsecutive(['Customers', 'Customers'], ['Manage Customers', 'Manage Customers']);
     $this->sessionMock->expects($this->once())->method('unsCustomerData');
     $this->assertInstanceOf('Magento\\Framework\\View\\Result\\Page', $this->indexController->execute());
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:15,代码来源:IndexTest.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Model\UrlInterface类代码示例发布时间:2022-05-23
下一篇:
PHP Helper\Data类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap