protected function execute($arguments = array(), $options = array()) { parent::execute($arguments, $options); $this->_initRequiredDirs(); $this->_initBaseClasses(); $this->_initFixturesDirs(); }
/** * @see sfTask */ protected function execute($arguments = array(), $options = array()) { $this->checkORMType($options['type']); parent::execute($arguments, $options); $this->_runInitTask(); $options['application'] = $arguments['application']; // still no class_path given? take the default one! if (empty($options['class_path'])) { $options['class_path'] = $this->modelTypes[$options['type']]['default_model_path']; } if (!empty($options['skip_methods'])) { $methods = explode(',', $options['skip_methods']); foreach ($methods as $method) { array_push($this->skipMethods, $method); } } // a custom class given? if (!empty($options['class'])) { if (strpos($options['class_path'], ':') !== false) { throw new sfCommandException(': is not supported in class_path when specifying the class name.'); } $options['libpath'] = $options['class_path']; $this->createTestClass($options, $options['target']); return; } $paths = explode(':', $options['class_path']); $namespaces = array(); foreach ($paths as $path) { $finder = sfFinder::type('directory'); $ignoredDirs = $this->modelTypes[$options['type']]['ignored_directory']; foreach ($ignoredDirs as $ignDir) { $finder = $finder->not_name($ignDir); } $dirs = $finder->in($path); foreach ($dirs as $dir) { if (is_dir($dir)) { $namespaces[] = $dir; } } } $paths = array_merge($paths, $namespaces); foreach ($paths as $path) { $options['libpath'] = $path; $dir = new DirectoryIterator($path); $this->logSection('phpunit', sprintf('Searching %s', $path)); while ($dir->valid()) { if (strpos($dir, '.php') !== false) { $subfolder = basename(dirname($path . DIRECTORY_SEPARATOR . $dir)); $suffix = !empty($options['file_suffix']) ? $options['file_suffix'] : $this->modelTypes[$options['type']]['classFileSuffix']; $options['class'] = str_replace($suffix, '', $dir); $this->createTestClass($options, $subfolder); } $dir->next(); } } $this->_runInitTask(); }
/** * @see sfTask */ protected function execute($arguments = array(), $options = array()) { parent::execute($arguments, $options); $this->checkAppExists($arguments['application']); $this->checkModuleExists($arguments['application'], $arguments['module']); $this->_runInitTask(); $this->_createClass('functionals', 'functional/BasePhpunitFunctionalTestCase.tpl', array('className' => 'BasePhpunitFunctionalTestCase')); $this->_createDir($dir = sfConfig::get('sf_test_dir') . '/phpunit/functionals/' . $arguments['application']); $this->_createClass('functionals/' . $arguments['application'], 'functional/PhpunitFunctionalTestCase.tpl', array('className' => $arguments['module'] . 'ActionsTestCase', 'parentName' => 'BasePhpunitFunctionalTestCase', 'moduleName' => $arguments['module'], 'application' => $arguments['application'])); $this->_runInitTask(); }
/** * @see sfTask */ protected function execute($arguments = array(), $options = array()) { parent::execute($arguments, $options); $this->_runInitTask(); $interfaces = ''; if (!is_null($options['fixtureType'])) { $map = array('propel' => 'sfPhpunitFixturePropelAggregator', 'doctrine' => 'sfPhpunitFixtureDoctrineAggregator', 'dbunit' => 'sfPhpunitFixtureDbUnitAggregator'); if (!array_key_exists($options['fixtureType'], $map)) { throw new Exception('The fixtureType option can be only `' . implode('`, `', array_keys($map)) . '`. You give: `' . $options['fixtureType'] . '`'); } $interfaces = 'implements ' . $map[$options['fixtureType']]; } $this->_createClass($arguments['targetDir'], $options['source'], array('className' => $arguments['className'], 'parentName' => $options['parentName'], 'interfaces' => $interfaces)); }