Exemplo n.º 1
0
    public function setUp()
    {
        $this->_config = new Mage_Core_Model_Config(<<<XML
            <config>
                <global>
                    <cache>
                        <types>
                            <single_tag>
                                <label>Tag One</label>
                                <description>This is Tag One</description>
                                <tags>tag_one</tags>
                            </single_tag>
                            <multiple_tags>
                                <label>Tags One and Two</label>
                                <description>These are Tags One and Two</description>
                                <tags>tag_one,tag_two</tags>
                            </multiple_tags>
                        </types>
                    </cache>
                </global>
            </config>
XML
);
        $this->_helper = $this->getMock('Mage_Core_Helper_Data', array('__'));
        $this->_helper->expects($this->any())->method('__')->will($this->returnArgument(0));
        $this->_config->setOptions(array('cache_dir' => __DIR__, 'etc_dir' => __DIR__));
        $this->_cacheFrontend = $this->getMock('Zend_Cache_Core', array('load', 'test', 'save', 'remove', 'clean', '_getHelper'));
        $this->_requestProcessor = $this->getMock('stdClass', array('extractContent'));
        $this->_model = new Mage_Core_Model_Cache(array('config' => $this->_config, 'helper' => $this->_helper, 'frontend' => $this->_cacheFrontend, 'backend' => 'BlackHole', 'request_processors' => array($this->_requestProcessor)));
    }
Exemplo n.º 2
0
 /**
  * @param string $etcDir
  * @param string $option
  * @param string $expectedNode
  * @param string $expectedValue
  * @dataProvider loadBaseLocalConfigDataProvider
  */
 public function testLoadBaseLocalConfig($etcDir, $option, $expectedNode, $expectedValue)
 {
     $model = new Mage_Core_Model_Config();
     $model->setOptions(array('etc_dir' => __DIR__ . "/_files/local_config/{$etcDir}", 'local_config' => $option));
     $model->loadBase();
     $this->assertInstanceOf('Varien_Simplexml_Element', $model->getNode($expectedNode));
     $this->assertEquals($expectedValue, (string) $model->getNode($expectedNode));
 }
 /**
  * Common logic for all run types
  *
  * @param  string|array $options
  * @return Mage_Core_Model_App
  */
 public function baseInit($options)
 {
     $this->_initEnvironment();
     $this->_config = Mage::getConfig();
     $this->_config->setOptions($options);
     $this->_initBaseConfig();
     $cacheInitOptions = is_array($options) && array_key_exists('cache', $options) ? $options['cache'] : array();
     $this->_initCache($cacheInitOptions);
     return $this;
 }
Exemplo n.º 4
0
 /**
  * Common logic for all run types
  *
  * @param  string|array $options
  * @return Mage_Core_Model_App
  */
 public function baseInit($options)
 {
     $this->_initEnvironment();
     $this->_config = Mage::getConfig();
     $this->_config->setOptions($options);
     $this->_initBaseConfig();
     $this->_initCache();
     return $this;
 }
Exemplo n.º 5
0
 /**
  * Run application. Run process responsible for request processing and sending response.
  * List of suppported parametes:
  *  scope_code - code of default scope (website/store_group/store code)
  *  scope_type - type of default scope (website/group/store)
  *  options    - configuration options
  *
  * @param array $params application run parameters
  *
  * @return Mage_Core_Model_App
  */
 public function run($params)
 {
     $scopeCode = isset($params['scope_code']) ? $params['scope_code'] : '';
     $scopeType = isset($params['scope_type']) ? $params['scope_type'] : 'store';
     $options = isset($params['options']) ? $params['options'] : array();
     $this->_initEnvironment();
     $this->_config = Mage::getConfig();
     $this->_config->setOptions($options);
     $this->_initBaseConfig();
     $this->_initCache();
     if ($this->_cache->processRequest()) {
         $this->getResponse()->sendResponse();
     } else {
         $this->_initModules();
         $this->loadAreaPart(Mage_Core_Model_App_Area::AREA_GLOBAL, Mage_Core_Model_App_Area::PART_EVENTS);
         if ($this->_config->isLocalConfigLoaded()) {
             $this->_initCurrentStore($scopeCode, $scopeType);
             $this->_initRequest();
             Mage_Core_Model_Resource_Setup::applyAllDataUpdates();
         }
         $this->getFrontController()->dispatch();
     }
     return $this;
 }