示例#1
0
 /**
  * Retrieve all necessary objects mocks which used inside customer storage
  *
  * @param int $tableRowsCount
  * @param array $tableData
  * @param array $aliasesMap
  *
  * @return array
  */
 protected function _getModelDependencies($tableRowsCount = 0, $tableData = array(), $aliasesMap = array())
 {
     $this->_selectMock = $this->getMock('Varien_Db_Select', array(), array(), '', false);
     $this->_selectMock->expects($this->any())->method('from')->will($this->returnSelf());
     $this->_selectMock->expects($this->any())->method('where')->will($this->returnCallback(array($this, 'whereCallback')));
     $adapterMock = $this->getMock('Varien_Db_Adapter_Pdo_Mysql', array('select', 'update', 'fetchAll', 'fetchOne'), array(), '', false);
     $adapterMock->expects($this->any())->method('select')->will($this->returnValue($this->_selectMock));
     $adapterMock->expects($this->any())->method('update')->will($this->returnCallback(array($this, 'updateCallback')));
     $adapterMock->expects($this->any())->method('fetchAll')->will($this->returnValue($tableData));
     $adapterMock->expects($this->any())->method('fetchOne')->will($this->returnValue($tableRowsCount));
     return array('resource_config' => 'not_used', 'connection_config' => 'not_used', 'module_config' => 'not_used', 'base_dir' => 'not_used', 'path_to_map_file' => 'not_used', 'connection' => $adapterMock, 'core_helper' => new Mage_Core_Helper_Data(), 'aliases_map' => $aliasesMap);
 }