Ejemplo n.º 1
0
 /**
  * @covers sAdmin::sUpdateAccount
  */
 public function testsUpdateAccount()
 {
     // Test no user id
     $this->assertTrue($this->module->sUpdateAccount());
     $customer = $this->createDummyCustomer();
     $this->session->offsetSet('sUserId', $customer->getId());
     $this->front->Request()->setPost('email', uniqid() . '*****@*****.**');
     $this->assertTrue($this->module->sUpdateAccount());
     // Test that email was updated
     $this->assertNotEquals($customer->getEmail(), Shopware()->Db()->fetchOne('SELECT email FROM s_user WHERE id = ?', array($customer->getId())));
     $this->front->Request()->setPost('password', uniqid() . 'password');
     $this->front->Request()->setPost('passwordConfirmation', $this->front->Request()->getPost('password'));
     $this->assertTrue($this->module->sUpdateAccount());
     // Test that password was updated
     $this->assertNotEquals($customer->getPassword(), Shopware()->Db()->fetchOne('SELECT password FROM s_user WHERE id = ?', array($customer->getId())));
     $this->deleteDummyCustomer($customer);
 }
Ejemplo n.º 2
0
 /**
  * Save account action
  *
  * Save account address data and create error messages
  *
  */
 public function saveAccountAction()
 {
     if ($this->Request()->isPost()) {
         $checkData = $this->admin->sValidateStep1(true);
         if (!empty($checkData["sErrorMessages"])) {
             foreach ($checkData["sErrorMessages"] as $key => $error_message) {
                 $checkData["sErrorMessages"][$key] = $this->View()->fetch('string:' . $error_message);
             }
         }
         if (empty($checkData['sErrorMessages'])) {
             $this->admin->sUpdateAccount();
             $this->View()->sSuccessAction = 'account';
         } else {
             $this->View()->sErrorFlag = $checkData['sErrorFlag'];
             $this->View()->sErrorMessages = $checkData['sErrorMessages'];
         }
     }
     $this->forward('index');
 }