Ejemplo n.º 1
0
 /**
  * Logs in as a customer by customer id and store id
  *
  * @param int             $customerId
  * @param string|int|null $storeId
  *
  * @return EcomDev_PHPUnit_Mock_Proxy
  */
 public function helperCustomerSession($customerId, $storeId = null)
 {
     $customerSessionMock = TestHelper::invoke('mockSession', 'customer/session', array('renewSession'));
     if ($storeId === null) {
         $storeId = TestUtil::app()->getAnyStoreView()->getCode();
     }
     TestUtil::setCurrentStore($storeId);
     $customerSessionMock->loginById($customerId);
     return $customerSessionMock;
 }
Ejemplo n.º 2
0
 /**
  * Start session as guest.
  *
  * @param string|int|null $storeId
  *
  * @return EcomDev_PHPUnit_Mock_Proxy
  */
 public function helperGuestSession($storeId = null)
 {
     $guestSessionMock = TestHelper::invoke('mockSession', 'core/session', array('renewSession'));
     /** @var Mage_Core_Model_Session $session */
     $session = $guestSessionMock->getMock();
     $_GET[$session->getSessionIdQueryParam()] = $session->getSessionId();
     // some action need that (loginPost, ...)
     if ($storeId === null) {
         $storeId = TestUtil::app()->getAnyStoreView()->getCode();
     }
     TestUtil::setCurrentStore($storeId);
     return $guestSessionMock;
 }
Ejemplo n.º 3
0
 /**
  * Set current store scope for test
  *
  * @param int|string|Mage_Core_Model_Store $store
  * @return EcomDev_PHPUnit_Test_Case
  */
 public function setCurrentStore($store)
 {
     TestUtil::setCurrentStore($store);
     return $this;
 }