Exemplo n.º 1
0
 /**
  * @return void
  */
 public function testCreatePostActionRegistrationDisabled()
 {
     $this->customerSession->expects($this->once())->method('isLoggedIn')->will($this->returnValue(false));
     $this->customerHelperMock->expects($this->once())->method('isRegistrationAllowed')->will($this->returnValue(false));
     $this->redirectMock->expects($this->once())->method('redirect')->with($this->response, '*/*/', array())->will($this->returnValue(false));
     $this->accountServiceMock->expects($this->never())->method('createCustomer');
     $this->object->execute();
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function getResponse()
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getResponse');
     if (!$pluginInfo) {
         return parent::getResponse();
     } else {
         return $this->___callPlugins('getResponse', func_get_args(), $pluginInfo);
     }
 }
 public function testRegenerateIdOnExecution()
 {
     $this->customerSession->expects($this->once())->method('regenerateId');
     $this->customerSession->expects($this->once())->method('isLoggedIn')->will($this->returnValue(false));
     $this->customerHelperMock->expects($this->once())->method('isRegistrationAllowed')->will($this->returnValue(true));
     $this->request->expects($this->once())->method('isPost')->will($this->returnValue(true));
     $this->urlFactoryMock->expects($this->once())->method('create')->will($this->returnValue($this->urlMock));
     $this->object->execute();
 }
Exemplo n.º 4
0
 /**
  * {@inheritdoc}
  */
 public function dispatch(\Magento\Framework\App\RequestInterface $request)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'dispatch');
     if (!$pluginInfo) {
         return parent::dispatch($request);
     } else {
         return $this->___callPlugins('dispatch', func_get_args(), $pluginInfo);
     }
 }
 /**
  * @param $customerId
  * @param $password
  * @param $confirmationStatus
  * @param $successUrl
  * @param $isSetFlag
  * @param $successMessage
  *
  * @dataProvider getSuccessRedirectDataProvider
  */
 public function testSuccessRedirect($customerId, $password, $confirmationStatus, $successUrl, $isSetFlag, $successMessage)
 {
     $this->customerSessionMock->expects($this->once())->method('isLoggedIn')->will($this->returnValue(false));
     $this->registration->expects($this->once())->method('isAllowed')->will($this->returnValue(true));
     $this->customerSessionMock->expects($this->once())->method('regenerateId');
     $this->customerMock->expects($this->any())->method('getId')->will($this->returnValue($customerId));
     $this->customerExtractorMock->expects($this->any())->method('extract')->with($this->equalTo('customer_account_create'), $this->equalTo($this->requestMock))->will($this->returnValue($this->customerMock));
     $this->requestMock->expects($this->once())->method('isPost')->will($this->returnValue(true));
     $this->requestMock->expects($this->any())->method('getPost')->will($this->returnValue(false));
     $this->requestMock->expects($this->any())->method('getParam')->willReturnMap([['password', null, $password], ['password_confirmation', null, $password], ['is_subscribed', false, true]]);
     $this->customerMock->expects($this->once())->method('setAddresses')->with($this->equalTo([]))->will($this->returnSelf());
     $this->accountManagement->expects($this->once())->method('createAccount')->with($this->equalTo($this->customerDetailsMock), $this->equalTo($password), '')->will($this->returnValue($this->customerMock));
     $this->accountManagement->expects($this->once())->method('getConfirmationStatus')->with($this->equalTo($customerId))->will($this->returnValue($confirmationStatus));
     $this->subscriberMock->expects($this->once())->method('subscribeCustomerById')->with($this->equalTo($customerId));
     $this->messageManagerMock->expects($this->any())->method('addSuccess')->with($this->stringContains($successMessage))->will($this->returnSelf());
     $this->urlMock->expects($this->any())->method('getUrl')->willReturnMap([['*/*/index', ['_secure' => true], $successUrl], ['*/*/create', ['_secure' => true], $successUrl]]);
     $this->redirectMock->expects($this->once())->method('success')->with($this->equalTo($successUrl))->will($this->returnValue($successUrl));
     $this->scopeConfigMock->expects($this->once())->method('isSetFlag')->with($this->equalTo(Url::XML_PATH_CUSTOMER_STARTUP_REDIRECT_TO_DASHBOARD), $this->equalTo(ScopeInterface::SCOPE_STORE))->will($this->returnValue($isSetFlag));
     $this->storeMock->expects($this->any())->method('getFrontendName')->will($this->returnValue('frontend'));
     $this->storeManagerMock->expects($this->any())->method('getStore')->will($this->returnValue($this->storeMock));
     $this->model->execute();
 }