Exemple #1
0
 /**
  * @param string $path
  * @dataProvider layoutFileDataProvider
  */
 public function testLayouts($path)
 {
     $xml = simplexml_load_file($path);
     $classes = Utility_Classes::collectLayoutClasses($xml);
     foreach (Utility_Classes::getXmlAttributeValues($xml, '/layout//@helper', 'helper') as $class) {
         $classes[] = Utility_Classes::getCallbackClass($class);
     }
     $classes = array_merge($classes, Utility_Classes::getXmlAttributeValues($xml, '/layout//@module', 'module'));
     $this->_assertNonFactoryName(array_unique($classes));
     $tabs = Utility_Classes::getXmlNodeValues($xml, '/layout//action[@method="addTab"]/block');
     $this->_assertNonFactoryName(array_unique($tabs), true);
 }
Exemple #2
0
        addReplace($factoryName, $module, $name, '::getSingleton(\'%s\'', '_Model_', $search, $replace);
        addReplace($factoryName, $module, $name, '::getResourceModel(\'%s\'', '_Model_Resource_', $search, $replace);
        addReplace($factoryName, $module, $name, "::getResourceSingleton('%s'", '_Model_Resource_', $search, $replace);
        addReplace($factoryName, $module, $name, 'addBlock(\'%s\'', '_Block_', $search, $replace);
        addReplace($factoryName, $module, $name, 'createBlock(\'%s\'', '_Block_', $search, $replace);
        addReplace($factoryName, $module, $name, 'getBlockClassName(\'%s\'', '_Block_', $search, $replace);
        addReplace($factoryName, $module, $name, 'getBlockSingleton(\'%s\'', '_Block_', $search, $replace);
        addReplace($factoryName, $module, $name, 'helper(\'%s\'', '_Helper_', $search, $replace);
    }
    replaceAndOutput($file, $search, $replace, $factoryNames);
}
// layouts
$layouts = Utility_Files::init()->getLayoutFiles(array(), false);
foreach ($layouts as $file) {
    $xml = simplexml_load_file($file);
    $classes = Utility_Classes::collectLayoutClasses($xml);
    $factoryNames = array_filter($classes, 'isFactoryName');
    if (!$factoryNames) {
        continue;
    }
    $search = array();
    $replace = array();
    foreach ($factoryNames as $factoryName) {
        list($module, $name) = getModuleName($factoryName);
        addReplace($factoryName, $module, $name, 'type="%s"', '_Block_', $search, $replace);
    }
    replaceAndOutput($file, $search, $replace, $factoryNames);
}
// modules in configuration and layouts
$configs = Utility_Files::init()->getConfigFiles('*.xml', array('wsdl.xml', 'wsdl2.xml', 'wsi.xml'), false);
foreach (array_merge($layouts, $configs) as $file) {
Exemple #3
0
 /**
  * @param string $path
  * @dataProvider layoutFileDataProvider
  */
 public function testLayoutFile($path)
 {
     $xml = simplexml_load_file($path);
     $classes = Utility_Classes::getXmlNodeValues($xml, '/layout//*[contains(text(), "_Block_") or contains(text(), "_Model_") or contains(text(), "_Helper_")]');
     foreach (Utility_Classes::getXmlAttributeValues($xml, '/layout//@helper', 'helper') as $class) {
         $classes[] = Utility_Classes::getCallbackClass($class);
     }
     foreach (Utility_Classes::getXmlAttributeValues($xml, '/layout//@module', 'module') as $module) {
         $classes[] = "{$module}_Helper_Data";
     }
     $classes = array_merge($classes, Utility_Classes::collectLayoutClasses($xml));
     $this->_assertClassesExist(array_unique($classes));
 }