Example #1
0
 /**
  * @covers Mage_Core_Controller_Varien_Router_Base::getControllerFileName
  * @covers Mage_Core_Controller_Varien_Router_Base::validateControllerFileName
  */
 public function testGetControllerFileName()
 {
     $file = $this->_model->getControllerFileName('Mage_Core', 'index');
     $this->assertStringEndsWith('IndexController.php', $file);
     $this->assertTrue($this->_model->validateControllerFileName($file));
     $this->assertFalse($this->_model->validateControllerFileName(''));
 }
Example #2
0
 /**
  * Build controller file name based on moduleName and controllerName
  *
  * @param string $realModule
  * @param string $controller
  * @return string
  */
 public function getControllerFileName($realModule, $controller)
 {
     /**
      * Start temporary block
      * TODO: Sprint#27. Delete after adminhtml refactoring
      */
     if ($realModule == 'Mage_Adminhtml') {
         return parent::getControllerFileName($realModule, $controller);
     }
     /**
      * End temporary block
      */
     $parts = explode('_', $realModule);
     $realModule = implode('_', array_splice($parts, 0, 2));
     $file = Mage::getModuleDir('controllers', $realModule);
     return $file . DS . ucfirst($this->_areaCode) . DS . uc_words($controller, DS) . 'Controller.php';
 }