public function tests($plugin = false, $params = array()) { if (is_array($plugin)) { $params = $plugin; } else { $params = am($params, compact('plugin')); } $paths = Mi::paths('Test'); $files = array(); foreach ($paths as $path) { $files = Set::merge($files, Mi::files($path, null, '.*test.php')); } $return = array(); foreach ($files as $file) { $name = preg_replace('@^.*[\\\\/]cases[\\\\/]@', '', $file); $name = str_replace('.test.php', '', $name); if (isset($return[$name])) { continue; } $return[$name] = $file; } ksort($return); return array_flip($return); }
/** * populateVendorMap method * * @param bool $reset false * @static * @return void * @access protected */ protected static function _populateVendorMap($reset = false) { if ($reset || !self::$vendorMap) { App::import('Vendor', 'Mi.MiCache'); $plugins = MiCache::mi('plugins'); foreach ($plugins as $path => $plugin) { if (is_dir($path . DS . 'webroot')) { if (!class_exists('Mi')) { APP::import('Vendor', 'Mi.Mi'); } $files = Mi::files($path . DS . 'webroot', null, '.*\\.(css|js)$'); foreach ($files as $fPath) { $fPath = realpath($fPath); self::$vendorMap[str_replace(realpath($path . DS . 'webroot') . DS, $plugin . DS, $fPath)] = $fPath; } } } self::log("Populating Vendor Map"); if (!class_exists('MiCache')) { self::log("\tMiCache doesn't exist. Skipping."); return; } self::$vendorMap = am(self::$vendorMap, MiCache::mi('vendors', null, array('shells'), array('excludeFolders' => array('shells', 'simpletest'), 'extension' => array('css', 'js'), 'excludePattern' => false))); self::log("\tDone."); } }