Esempio n. 1
0
 /**
  * @magentoDataFixture Mage/Customer/_files/customer.php
  */
 public function testIndexAction()
 {
     $session = new Mage_Customer_Model_Session();
     $session->login('*****@*****.**', 'password');
     $this->dispatch('customer/account/index');
     $this->assertContains('<div class="my-account">', $this->getResponse()->getBody());
 }
Esempio n. 2
0
 /**
  * Verify wishlist view action
  *
  * The following is verified:
  * - Mage_Wishlist_Model_Resource_Item_Collection
  * - Mage_Wishlist_Block_Customer_Wishlist
  * - Mage_Wishlist_Block_Customer_Wishlist_Items
  * - Mage_Wishlist_Block_Customer_Wishlist_Item_Column
  * - Mage_Wishlist_Block_Customer_Wishlist_Item_Column_Cart
  * - Mage_Wishlist_Block_Customer_Wishlist_Item_Column_Comment
  * - Mage_Wishlist_Block_Customer_Wishlist_Button
  * - that Mage_Wishlist_Block_Customer_Wishlist_Item_Options doesn't throw a fatal error
  *
  * @magentoDataFixture Mage/Wishlist/_files/wishlist.php
  */
 public function testItemColumnBlock()
 {
     $session = new Mage_Customer_Model_Session();
     $session->login('*****@*****.**', 'password');
     $this->dispatch('wishlist/index/index');
     $body = $this->getResponse()->getBody();
     $this->assertStringMatchesFormat('%A<img src="%Asmall_image.jpg" %A alt="Simple Product"%A/>%A', $body);
     $this->assertStringMatchesFormat('%Afunction addWItemToCart(itemId)%A', $body);
     $this->assertStringMatchesFormat('%Aonclick="addWItemToCart(%d);"%A', $body);
     $this->assertStringMatchesFormat('%A<textarea name="description[%d]"%A', $body);
     $this->assertStringMatchesFormat('%A<button%Aonclick="addAllWItemsToCart()"%A', $body);
 }
 /**
  * Covers app/code/core/Mage/Checkout/Block/Multishipping/Payment/Info.php
  * and app/code/core/Mage/Checkout/Block/Multishipping/Overview.php
  *
  * @magentoDataFixture Mage/Sales/_files/quote.php
  * @magentoDataFixture Mage/Customer/_files/customer.php
  */
 public function testOverviewAction()
 {
     $quote = new Mage_Sales_Model_Quote();
     $quote->load('test01', 'reserved_order_id');
     Mage::getSingleton('Mage_Checkout_Model_Session')->setQuoteId($quote->getId());
     $session = new Mage_Customer_Model_Session();
     $session->login('*****@*****.**', 'password');
     $this->getRequest()->setPost('payment', array('method' => 'checkmo'));
     $this->dispatch('checkout/multishipping/overview');
     $html = $this->getResponse()->getBody();
     $this->assertContains('<p>' . $quote->getPayment()->getMethodInstance()->getTitle() . '</p>', $html);
     $this->assertContains('<span class="price">$10.00</span>', $html);
 }
 /**
  * Customer authorization
  *
  * @param   string $username
  * @param   string $password
  * @return  bool
  *
  * AVECTRA login
  */
 public function login($username, $password)
 {
     if (Mage::getStoreConfig('customer/avectra/login_hook') == 1) {
         return parent::login($username, $password);
     }
     $key = Mage::getModel('icc_avectra/account')->getAvectraKeyByUserPass($username, $password);
     if ($key && $key != '00000000-0000-0000-0000-000000000000') {
         $customer = Mage::getModel('icc_avectra/account')->getUserByAvectraKey($key);
         if ($customer && $customer->getId()) {
             $this->setCustomerAsLoggedIn($customer);
             $this->renewSession();
             $cookie = Mage::getSingleton('core/cookie');
             $cookie->set('Gorilla', $key);
             return true;
         } else {
             $avcustomer = Mage::getModel('icc_avectra/account')->getAvCustomer($key);
             if ($avcustomer) {
                 $customerData = (array) $avcustomer->Individual;
                 if (count($customerData)) {
                     $firstname = isset($customerData['ind_first_name']) ? $customerData['ind_first_name'] : '';
                     $lastname = isset($customerData['ind_last_name']) ? $customerData['ind_last_name'] : '';
                     $filteredData = array('firstname' => $firstname, 'lastname' => $lastname, 'email' => $username, 'password' => $password, 'avectra_key' => $key);
                     $customer = Mage::getModel('customer/customer');
                     $customer->addData($filteredData);
                     $customer->setWebsiteId(Mage::app()->getWebsite()->getId());
                     $customer->setConfirmation(null);
                     try {
                         $customer->save();
                         $this->loginById($customer->getId());
                         $cookie = Mage::getSingleton('core/cookie');
                         $cookie->set('Gorilla', $key);
                         return true;
                     } catch (Exception $e) {
                     }
                 }
             }
         }
     }
     $errorMessage = Mage::getStoreConfig('avectraconnect_options/avectraconfigfields/login_error_message');
     if (empty($errorMessage)) {
         $errorMessage = Mage::helper('customer')->__('Invalid Email or Password.');
     }
     throw Mage::exception('Mage_Core', $errorMessage, Mage_Customer_Model_Customer::EXCEPTION_INVALID_EMAIL_OR_PASSWORD);
 }
Esempio n. 5
0
 protected function setUp()
 {
     parent::setUp();
     $this->_customerSession = Mage::getModel('Mage_Customer_Model_Session');
     $this->_customerSession->login('*****@*****.**', 'password');
 }