Пример #1
0
 public function setUp()
 {
     $this->_menuMock = $this->getMock('Mage_Backend_Model_Menu', array(), array(), '', false);
     $this->_coreSessionMock = $this->getMock('Mage_Core_Model_Session', array('getFormKey'), array(), '', false);
     $this->_coreSessionMock->expects($this->any())->method('getFormKey')->will($this->returnValue('salt'));
     $this->_coreHelperMock = $this->getMock('Mage_Core_Helper_Data', array('getHash'), array(), '', false);
     $this->_coreHelperMock->expects($this->any())->method('getHash')->will($this->returnArgument(0));
     $mockItem = $this->getMock('Mage_Backend_Model_Menu_Item', array(), array(), '', false);
     $mockItem->expects($this->any())->method('isDisabled')->will($this->returnValue(false));
     $mockItem->expects($this->any())->method('isAllowed')->will($this->returnValue(true));
     $mockItem->expects($this->any())->method('getId')->will($this->returnValue('Mage_Adminhtml::system_acl_roles'));
     $mockItem->expects($this->any())->method('getAction')->will($this->returnValue('adminhtml/user_role'));
     $this->_menuMock->expects($this->any())->method('get')->with($this->equalTo('Mage_Adminhtml::system_acl_roles'))->will($this->returnValue($mockItem));
     $helperMock = $this->getMock('Mage_Backend_Helper_Data', array(), array(), '', false);
     $helperMock->expects($this->any())->method('getAreaFrontName')->will($this->returnValue($this->_areaFrontName));
     $this->_routes = array('admin' => 'adminhtml', 'adminhtml' => '');
     $this->_model = new Mage_Backend_Model_Url(array('startupMenuItemId' => 'Mage_Adminhtml::system_acl_roles', 'menu' => $this->_menuMock, 'backendHelper' => $helperMock, 'coreSession' => $this->_coreSessionMock, 'coreHelper' => $this->_coreHelperMock, 'routes' => $this->_routes));
     $this->_requestMock = $this->getMock('Mage_Core_Controller_Request_Http', array(), array(), '', false);
     $this->_model->setRequest($this->_requestMock);
 }
Пример #2
0
 public function setUp()
 {
     $this->_menuMock = $this->getMock('Mage_Backend_Model_Menu', array(), array(), '', false);
     $this->_menuConfigMock = $this->getMock('Mage_Backend_Model_Menu_Config', array(), array(), '', false);
     $this->_menuConfigMock->expects($this->any())->method('getMenu')->will($this->returnValue($this->_menuMock));
     $this->_coreSessionMock = $this->getMock('Mage_Core_Model_Session', array('getFormKey'), array(), '', false);
     $this->_coreSessionMock->expects($this->any())->method('getFormKey')->will($this->returnValue('salt'));
     $this->_coreHelperMock = $this->getMock('Mage_Core_Helper_Data', array('getHash'), array(), '', false);
     $this->_coreHelperMock->expects($this->any())->method('getHash')->will($this->returnArgument(0));
     $mockItem = $this->getMock('Mage_Backend_Model_Menu_Item', array(), array(), '', false);
     $mockItem->expects($this->any())->method('isDisabled')->will($this->returnValue(false));
     $mockItem->expects($this->any())->method('isAllowed')->will($this->returnValue(true));
     $mockItem->expects($this->any())->method('getId')->will($this->returnValue('Mage_Adminhtml::system_acl_roles'));
     $mockItem->expects($this->any())->method('getAction')->will($this->returnValue('adminhtml/user_role'));
     $this->_menuMock->expects($this->any())->method('get')->with($this->equalTo('Mage_Adminhtml::system_acl_roles'))->will($this->returnValue($mockItem));
     $helperMock = $this->getMock('Mage_Backend_Helper_Data', array(), array(), '', false);
     $helperMock->expects($this->any())->method('getAreaFrontName')->will($this->returnValue($this->_areaFrontName));
     $this->_storeConfigMock = $this->getMock('Mage_Core_Model_Store_Config', array(), array(), '', false);
     $this->_storeConfigMock->expects($this->any())->method('getConfig')->with(Mage_Backend_Model_Url::XML_PATH_STARTUP_MENU_ITEM)->will($this->returnValue('Mage_Adminhtml::system_acl_roles'));
     $this->_model = new Mage_Backend_Model_Url($helperMock, $this->_coreHelperMock, $this->_coreSessionMock, $this->_storeConfigMock, $this->_menuConfigMock);
     $this->_requestMock = $this->getMock('Mage_Core_Controller_Request_Http', array(), array(), '', false);
     $this->_model->setRequest($this->_requestMock);
 }
 /**
  * After an order has been placed, surrounding Magento system should be
  * made aware of the new order - session data should be updated and an
  * event should be dispatched.
  */
 public function testSignalOrderSuccess()
 {
     // Setup quote and orders with relevant data.
     $orderId = 1;
     $incrementId = '005012345';
     $quoteId = 3;
     $this->_order->method('getId')->will($this->returnValue($orderId));
     $this->_order->method('getIncrementId')->will($this->returnValue($incrementId));
     $this->_quote->method('getId')->will($this->returnValue($quoteId));
     // Side-effect tests: ensure session data is updated with quote and
     // order data.
     $this->_coreSession->expects($this->once())->method('setOrderIds')->with($this->identicalTo([$orderId => $incrementId]))->will($this->returnSelf());
     $this->_checkoutSession->expects($this->once())->method('setLastQuoteId')->with($this->identicalTo($quoteId))->will($this->returnSelf());
     $this->assertSame($this->_multishippingCheckout, EcomDev_Utils_Reflection::invokeRestrictedMethod($this->_multishippingCheckout, '_signalOrderSuccess', [$this->_order]));
     // Ensure the event was dispatched once for the new order.
     $this->assertEventDispatchedExactly('checkout_submit_all_after', 1);
 }