Index: server/pifr_server.admin.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/project_issue_file_review/server/pifr_server.admin.inc,v retrieving revision 1.20 diff -u -r1.20 pifr_server.admin.inc --- server/pifr_server.admin.inc 9 Feb 2010 08:56:01 -0000 1.20 +++ server/pifr_server.admin.inc 24 Feb 2010 00:40:31 -0000 @@ -79,7 +79,7 @@ ); $batch['branches'][] = array( - 'project_identifier' => '3060', + 'project_identifier' => 3060, 'client_identifier' => 156281, 'vcs_identifier' => 'HEAD', 'dependency' => '', Index: server/pifr_server.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/project_issue_file_review/server/pifr_server.install,v retrieving revision 1.48 diff -u -r1.48 pifr_server.install --- server/pifr_server.install 23 Feb 2010 02:46:56 -0000 1.48 +++ server/pifr_server.install 24 Feb 2010 00:40:31 -0000 @@ -682,3 +682,56 @@ return $ret; } + +/** + * Update plugin argument keys. + */ +function pifr_server_update_6206() { + $result = db_query('SELECT branch_id FROM {pifr_branch}'); + while ($branch_id = db_result($result)) { + $branch = pifr_server_branch_get($branch_id); + $branch['plugin_argument'] = pifr_server_update_6206_map($branch['plugin_argument']); + pifr_server_branch_save($branch, FALSE); + } + + $result = db_query('SELECT environment_id FROM {pifr_environment}'); + while ($environment_id = db_result($result)) { + $environment = pifr_server_environment_get($environment_id); + $environment['plugin_argument'] = pifr_server_update_6206_map($environment['plugin_argument']); + pifr_server_environment_save($environment, FALSE); + } + + return array(); +} + +/** + * Map old plugin argument keys to new keys. + * + * @param array $array Old plugin argument array. + * @return array Updated plugin argument array. + */ +function pifr_server_update_6206_map(array $array) { + static $map = array( + 'directory' => 'test.directory', + 'files' => 'test.files', + 'core' => 'drupal.core.version', + 'core-url' => 'drupal.core.url', + 'modules' => 'drupal.modules', + 'pifr_coder.annotate' => 'coder.annotate', + 'tests' => 'simpletest.tests', + 'clone-db' => 'simpletest.db', + 'clone-db-user' => 'drupal.user', + 'clone-db-pass' => 'drupal.pass', + ); + + $new = array(); + foreach ($array as $key => $value) { + if (isset($map[$key])) { + $new[$map[$key]] = $value; + } + else { + $new[$key] = $value; + } + } + return $new; +} Index: review/server.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/project_issue_file_review/review/server.inc,v retrieving revision 1.18 diff -u -r1.18 server.inc --- review/server.inc 3 Feb 2010 03:02:38 -0000 1.18 +++ review/server.inc 24 Feb 2010 00:40:31 -0000 @@ -18,7 +18,14 @@ * * @var array */ - protected $argument_default = array(); + protected $argument_default = array( + 'test.title' => NULL, + 'test.directory.review' => '', + 'test.directory.apply' => '', + 'test.directory.dependency' => '', + 'test.files' => array(), + 'test.extensions' => array(), + ); /** * The operations which make up a review mapped to integer codes. @@ -151,6 +158,15 @@ } /** + * Get the associative array of default arguments. + * + * @return array Associative array of default arguments. + */ + public function argument_default_get() { + return $this->argument_default; + } + + /** * Get all the operations. * * @return array List of operation keys. Index: review/client.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/project_issue_file_review/review/client.inc,v retrieving revision 1.34 diff -u -r1.34 client.inc --- review/client.inc 19 Feb 2010 21:18:00 -0000 1.34 +++ review/client.inc 24 Feb 2010 00:40:31 -0000 @@ -65,6 +65,13 @@ protected $test; /** + * Associative array of arguments provided with the test. + * + * @var array + */ + protected $arguments; + + /** * Database backend. * * @var object. @@ -133,6 +140,7 @@ 'base_path' => $base_path, ); $this->test = $test; + $this->arguments = $this->test['review']['argument']; $this->log('Environment variables and review information initialized.'); self::$instance = $this; @@ -406,14 +414,38 @@ } /** - * Checkout the main branch of code to be reviewed. + * Checkout all code the be reviewed. */ protected function checkout() { + // Checkout the main branch. if (!empty($this->test['vcs']['main'])) { $this->checkout_branch($this->test['vcs']['main'], dirname($this->checkout_directory), basename($this->checkout_directory)); $display = $this->checkout_display($this->test['vcs']['main']); - $this->log('Main branch [' . $display . '] checkout complete.'); + $status = $this->has_error() ? 'complete' : 'failed'; + $this->log('Main branch [' . $display . '] checkout [' . $status . '].'); + } + + // If there are dependencies and the dependency directory has been set then + // check them out into the dependency directory. + if (!empty($this->test['vcs']['dependencies']) && !empty($this->arguments['test.directory.dependency'])) { + // Ensure that dependency directory exists. + $directory = $this->checkout_directory . '/' . $this->arguments['test.directory.dependency']; + if (!file_check_directory($directory, FILE_CREATE_DIRECTORY)) { + $this->set_error(array('@reason' => 'failed to create dependency directory')); + return; + } + + // Checkout dependencies into the dependency directory. + foreach ($this->test['vcs']['dependencies'] as $dependency) { + if ($this->has_error()) break; + + $this->checkout_branch($dependency, $directory); + + $display = $this->checkout_display($dependency); + $status = $this->has_error() ? 'complete' : 'failed'; + $this->log('Dependency branch [' . $display . '] checkout [' . $status . '].'); + } } } @@ -487,7 +519,7 @@ protected function apply($directory = NULL, array $files = array()) { // Assume defaults if no custom values set. if (!$directory) { - $directory = $this->checkout_directory; + $directory = $this->checkout_directory . '/' . $this->arguments['test.directory.apply']; } if (!$files) { $files = $this->apply_files(); @@ -589,11 +621,27 @@ foreach ($applied_files as $file) { $files = array_merge($files, $this->vcs[$type]->get_changed_files($file)); } + + // If the files were applied from a directory other than the root correct + // the file paths returned from the VCS backend. + if (!empty($this->arguments['test.directory.apply'])) { + foreach ($files as &$file) { + $file = $this->arguments['test.directory.apply'] . '/' . $file; + } + } + } + elseif (!empty($this->arguments['test.files'])) { + foreach ($this->arguments['test.files'] as $file) { + if (file_exists($this->checkout_directory . '/' . $file)) { + $files[] = $file; + } + } } else { // Check all the files in the checkout directory and make their paths // relative to the checkout directory. - $scan = file_scan_directory($this->checkout_directory, '.*'); + $base = $this->checkout_directory . '/' . $this->arguments['test.directory.review']; + $scan = file_scan_directory($base, '.*'); foreach ($scan as $file) { $files[] = str_replace($this->checkout_directory . '/', '', $file->filename); } @@ -608,6 +656,14 @@ * @return array Filtered list of files to be syntax checked. */ protected function syntax_ignore(array $files) { + // If extensions are specified then filter the files. + if ($extensions = $this->arguments['test.extensions']) { + foreach ($files as $key => $file) { + if (!in_array(pathinfo($file, PATHINFO_EXTENSION), $extensions)) { + unset($files[$key]); + } + } + } return $files; } Index: review/drupal/pifr_drupal.client.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/project_issue_file_review/review/drupal/pifr_drupal.client.inc,v retrieving revision 1.9 diff -u -r1.9 pifr_drupal.client.inc --- review/drupal/pifr_drupal.client.inc 27 Jan 2010 02:11:33 -0000 1.9 +++ review/drupal/pifr_drupal.client.inc 24 Feb 2010 00:40:31 -0000 @@ -14,11 +14,6 @@ class pifr_client_review_pifr_drupal extends pifr_client_review { /** - * Default Drupal core repository URL. - */ - protected $core_url = ':pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal/drupal'; - - /** * Location of default sites module directory. */ protected $module_directory = 'sites/default/modules'; @@ -31,27 +26,12 @@ protected $project_directory; /** - * Administrator username used when installing Drupal. - */ - protected $admin_username = 'admin'; - - /** - * Administrator password used when installing Drupal. - */ - protected $admin_password; - - /** * Analyze review information. */ public function __construct(array $test) { parent::__construct($test); - // Allow the Drupal core URL to be overridden via an argument. - if (!empty($this->test['review']['argument']['core-url'])) { - $this->core_url = $this->test['review']['argument']['core-url']; - } - - if ($this->test['vcs']['main']['repository']['url'] != $this->core_url) { + if ($this->test['vcs']['main']['repository']['url'] != $this->arguments['drupal.core.url']) { // Main repository is not core, so this must be a module test. Move the // module repository (main) to the dependencies and find the core // repository in the dependencies and move it to main. @@ -61,7 +41,7 @@ $this->project_directory = basename($this->test['vcs']['main']['repository']['url']); foreach ($this->test['vcs']['dependencies'] as $key => $dependency) { - if ($dependency['repository']['url'] == $this->core_url) { + if ($dependency['repository']['url'] == $this->arguments['drupal.core.url']) { $this->test['vcs']['main'] = $dependency; unset($this->test['vcs']['dependencies'][$key]); break; @@ -70,7 +50,7 @@ } // Add SimpleTest as dependencies, unless it has already been added. - if ($this->test['review']['argument']['core'] == 6) { + if ($this->arguments['drupal.core.version'] == 6) { $simpletest_url = ':pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib/contributions/modules/simpletest'; $found = FALSE; foreach ($this->test['vcs']['dependencies'] as $key => $dependency) { @@ -92,62 +72,12 @@ ); } } - } - - /** - * Checkout dependencies into the modules directory. - */ - protected function checkout() { - // Checkout Drupal core. - parent::checkout(); - - if (!$this->has_error()) { - // Checkout modules if specified. - if (!empty($this->test['vcs']['dependencies'])) { - $directory = $this->checkout_directory . '/' . $this->module_directory; - if (!file_check_directory($directory, FILE_CREATE_DIRECTORY)) { - $this->set_error(array('@reason' => 'failed to create modules directory')); - return; - } - - // Checkout module dependencies into the modules directory. - $this->checkout_dependencies($this->test['vcs']['dependencies']); - } - } - } - - /** - * Checkout the list of dependencies into the modules directory. - * - * @param array $dependencies List of dependencies VCS information. - */ - protected function checkout_dependencies(array $dependencies) { - $directory = $this->checkout_directory . '/' . $this->module_directory; - foreach ($dependencies as $dependency) { - $this->checkout_branch($dependency, $directory); - - $display = $this->checkout_display($dependency); - if ($this->has_error()) { - $this->log('Dependency [' . $display . '] checkout failed.'); - break; - } - - $this->log('Dependency [' . $display . '] checkout complete.'); - } - } - /** - * Apply patches to dependencies in the modules directory. - */ - protected function apply($directory = NULL, array $files = array()) { - if ($directory || $files) { - // Passthru. - parent::apply($directory, $files); - } - else { - // Called as operation. - $directory = !empty($this->test['vcs']['dependencies']) ? $this->module_directory . '/' . $this->project_directory : NULL; - parent::apply($this->checkout_directory . '/' . $directory); + // If there are dependencies then all patches should be applied from the + // root of the primary dependency or project directory. + if (!empty($this->test['vcs']['dependencies'])) { + $this->arguments['test.directory.dependency'] = $this->module_directory; + $this->arguments['test.directory.apply'] = $this->module_directory . '/' . $this->project_directory; } } @@ -159,9 +89,9 @@ protected function syntax_files() { // If no files to apply then attempt to filter files by arguments. if (!$this->apply_files()) { - if (!empty($this->test['review']['argument']['modules'])) { + if (!empty($this->arguments['drupal.modules'])) { $files = array(); - foreach ($this->test['review']['argument']['modules'] as $module) { + foreach ($this->arguments['drupal.modules'] as $module) { if ($path = $this->module_path($module)) { $scan = file_scan_directory($this->checkout_directory . '/' . $path, '.*'); foreach ($scan as $file) { @@ -171,40 +101,9 @@ } return $files; } - elseif (!empty($this->test['review']['argument']['directory'])) { - $scan = file_scan_directory($this->checkout_directory . '/' . $this->test['review']['argument']['directory'], '.*'); - $files = array(); - foreach ($scan as $file) { - $files[] = str_replace($this->checkout_directory . '/', '', $file->filename); - } - return $files; - } } - $files = parent::syntax_files(); - - // If there are patch files and dependencies then assume the patch files - // are relative to the modules. - if (!empty($this->test['files']) && !empty($this->test['vcs']['dendencies'])) { - foreach ($files as &$file) { - $file = $this->module_directory . '/' . $file; - } - } - - return $files; - } - - /** - * Ingore non-PHP files during syntax check. - */ - protected function syntax_ignore(array $files) { - $php_extensions = array('php', 'inc', 'install', 'module', 'test'); - foreach ($files as $key => $file) { - if (!in_array(pathinfo($file, PATHINFO_EXTENSION), $php_extensions)) { - unset($files[$key]); - } - } - return $files; + return parent::syntax_files(); } /** @@ -235,7 +134,7 @@ // Step: Select an installation profile. // Step: Choose language. - $pofile = $this->test['review']['argument']['core'] == 6 ? 'default' : 'standard'; + $pofile = $this->arguments['drupal.core.version'] == 6 ? 'default' : 'standard'; if (!$b->drupalGet('install.php', array('query' => 'profile=' . $pofile . '&locale=en'))) { $this->set_error(array('@reason' => 'failed to start process')); return; @@ -248,7 +147,7 @@ $edit['driver'] = pifr_client_review_database_type(); } - if ($this->test['review']['argument']['core'] == 6) { + if ($this->arguments['drupal.core.version'] == 6) { // Drupal 6. $edit['db_path'] = $db_info['name']; $edit['db_user'] = $db_info['username']; @@ -272,13 +171,16 @@ } // Step: Site configuration. + if (empty($this->arguments['drupal.pass'])) { + $this->arguments['drupal.pass'] = $b->randomName(16); + } + $edit = array(); $edit['site_name'] = 'checkout'; $edit['site_mail'] = 'admin@example.com'; - $edit['account[name]'] = $this->admin_username; - $edit['account[mail]'] = 'admin@example.com'; - $edit['account[pass][pass1]'] = $this->admin_password = $b->randomName(12); - $edit['account[pass][pass2]'] = $this->admin_password; + $edit['account[name]'] = $this->arguments['drupal.user']; + $edit['account[mail]'] = $this->arguments['drupal.user'] . '@example.com'; + $edit['account[pass][pass1]'] = $edit['account[pass][pass2]'] = $this->arguments['drupal.pass']; $edit['update_status_module[1]'] = FALSE; $b->drupalPost(NULL, $edit, t('Save and continue')); Index: review/drupal/pifr_drupal.server.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/project_issue_file_review/review/drupal/pifr_drupal.server.inc,v retrieving revision 1.5 diff -u -r1.5 pifr_drupal.server.inc --- review/drupal/pifr_drupal.server.inc 19 Dec 2009 00:00:22 -0000 1.5 +++ review/drupal/pifr_drupal.server.inc 24 Feb 2010 00:40:31 -0000 @@ -15,18 +15,21 @@ */ abstract class pifr_server_review_pifr_drupal extends pifr_server_review_pifr_assertion { - protected $argument_default = array( - 'core' => 7, - 'database' => 'mysql-5.0-isam', - 'modules' => array(), - ); - /** - * Modify step information. + * Modify step information and append default arguments. */ public function __construct() { parent::__construct(); + $this->argument_default += array( + 'test.extensions' => array('php', 'inc', 'install', 'module', 'test'), + 'drupal.core.version' => 7, + 'drupal.core.url' => ':pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal/drupal', + 'drupal.modules' => array(), + 'drupal.user' => 'admin', + 'drupal.pass' => NULL, + ); + $this->steps['syntax'] = array_merge($this->steps['syntax'], array( 'title' => 'invalid PHP syntax', 'active title' => 'detect invalid PHP syntax', Index: review/drupal/pifr_drupal.test =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/project_issue_file_review/review/drupal/pifr_drupal.test,v retrieving revision 1.3 diff -u -r1.3 pifr_drupal.test --- review/drupal/pifr_drupal.test 19 Jan 2010 03:27:28 -0000 1.3 +++ review/drupal/pifr_drupal.test 24 Feb 2010 00:40:31 -0000 @@ -40,11 +40,6 @@ protected function testDependecies() { // Add SimpleTest and subuser dependency and execute review. $test = array_replace_recursive($this->test, array( - 'review' => array( - 'argument' => array( - 'core' => 7, - ), - ), 'vcs' => array( 'dependencies' => array( array( Index: review/coder/pifr_coder.server.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/project_issue_file_review/review/coder/pifr_coder.server.inc,v retrieving revision 1.7 diff -u -r1.7 pifr_coder.server.inc --- review/coder/pifr_coder.server.inc 17 Feb 2010 22:38:30 -0000 1.7 +++ review/coder/pifr_coder.server.inc 24 Feb 2010 00:40:31 -0000 @@ -15,12 +15,6 @@ */ class pifr_server_review_pifr_coder extends pifr_server_review_pifr_drupal { - protected $argument_default = array( - 'modules' => array(), - 'directory' => '', - 'pifr_coder.annotate' => FALSE, - ); - protected $labels = array( 'pass' => 'minor', 'fail' => 'critical', @@ -30,11 +24,15 @@ protected $detail_message = '@pass minor(s), @fail critical(s), and @exception normal(s)'; /** - * Modify step information. + * Modify step information and append default arguments. */ public function __construct() { parent::__construct(); + $this->argument_default += array( + 'coder.annotate' => FALSE, + ); + unset($this->steps['install']); $this->steps['review'] = array_merge($this->steps['review'], array( 'confirmation' => FALSE, Index: review/coder/pifr_coder.client.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/project_issue_file_review/review/coder/pifr_coder.client.inc,v retrieving revision 1.18 diff -u -r1.18 pifr_coder.client.inc --- review/coder/pifr_coder.client.inc 17 Feb 2010 22:38:30 -0000 1.18 +++ review/coder/pifr_coder.client.inc 24 Feb 2010 00:40:31 -0000 @@ -39,22 +39,6 @@ } /** - * Use files argument for list of files if specified. - */ - protected function syntax_files() { - if (!empty($this->test['review']['argument']['files'])) { - $files = array(); - foreach ($this->test['review']['argument']['files'] as $file) { - if (file_exists($this->checkout_directory . '/' . $file)) { - $files[] = $file; - } - } - return $files; - } - return parent::syntax_files(); - } - - /** * Perform coder review. */ protected function review() { @@ -111,7 +95,7 @@ $this->results[$file] = do_coder_reviews($args); // If annotate is TRUE, then set the group to the responsible party. - if ($this->test['review']['argument']['pifr_coder.annotate']) { + if ($this->arguments['coder.annotate']) { $this->review_annotate($file, $this->results[$file]); } } @@ -128,20 +112,20 @@ if (!empty($this->test['files'])) { return $this->syntax_files(); } - elseif (!empty($this->test['review']['argument']['files'])) { + elseif (!empty($this->arguments['test.files'])) { return $this->syntax_files(); } - elseif (!empty($this->test['review']['argument']['modules'])) { + elseif (!empty($this->arguments['drupal.modules'])) { $files = array(); - foreach ($this->test['review']['argument']['modules'] as $module) { + foreach ($this->arguments['drupal.modules'] as $module) { $files = array_merge($files, file_scan_directory($this->module_path($module), '/.*/')); } return $files; } - elseif (!empty($this->test['review']['argument']['directory'])) { + elseif (!empty($this->arguments['test.directory.review'])) { $files = $this->syntax_files(); foreach ($files as $key => $file) { - if (strpos($file, $this->test['review']['argument']['directory']) !== 0) { + if (strpos($file, $this->arguments['test.directory.review']) !== 0) { unset($files[$key]); } } Index: review/coder/pifr_coder.test =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/project_issue_file_review/review/coder/pifr_coder.test,v retrieving revision 1.1 diff -u -r1.1 pifr_coder.test --- review/coder/pifr_coder.test 31 Dec 2009 21:17:42 -0000 1.1 +++ review/coder/pifr_coder.test 24 Feb 2010 00:40:31 -0000 @@ -23,10 +23,6 @@ $this->test = array_replace_recursive($this->test, array( 'review' => array( 'plugin' => 'pifr_coder', - 'argument' => array( - 'core' => 7, - 'modules' => array(), - ), ), )); } Index: review/simpletest/pifr_simpletest.server.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/project_issue_file_review/review/simpletest/pifr_simpletest.server.inc,v retrieving revision 1.17 diff -u -r1.17 pifr_simpletest.server.inc --- review/simpletest/pifr_simpletest.server.inc 31 Dec 2009 22:10:58 -0000 1.17 +++ review/simpletest/pifr_simpletest.server.inc 24 Feb 2010 00:40:31 -0000 @@ -15,20 +15,17 @@ */ class pifr_server_review_pifr_simpletest extends pifr_server_review_pifr_drupal { - protected $argument_default = array( - 'core' => 7, - 'tests' => array(), - 'modules' => array(), - 'directory' => '', - 'clone-db' => '', - ); - /** - * Modify step information. + * Modify step information and append default arguments. */ public function __construct() { parent::__construct(); + $this->argument_default += array( + 'simpletest.tests' => array(), + 'simpletest.db' => NULL, + ); + $this->steps['review'] = array_merge($this->steps['review'], array( 'title' => 'test run failure', 'active title' => 'detect a test run failure', Index: review/simpletest/pifr_simpletest.test =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/project_issue_file_review/review/simpletest/pifr_simpletest.test,v retrieving revision 1.5 diff -u -r1.5 pifr_simpletest.test --- review/simpletest/pifr_simpletest.test 31 Dec 2009 22:10:58 -0000 1.5 +++ review/simpletest/pifr_simpletest.test 24 Feb 2010 00:40:31 -0000 @@ -23,11 +23,6 @@ $this->test = array_replace_recursive($this->test, array( 'review' => array( 'plugin' => 'pifr_simpletest', - 'argument' => array( - 'core' => 7, - 'tests' => array(), - 'modules' => array(), - ), ), )); } @@ -52,7 +47,7 @@ $test = array_replace_recursive($this->test, array( 'review' => array( 'argument' => array( - 'tests' => array('NonDefaultBlockAdmin'), + 'simpletest.tests' => array('NonDefaultBlockAdmin'), ), ), 'files' => array( Index: review/simpletest/pifr_simpletest.client.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/project_issue_file_review/review/simpletest/pifr_simpletest.client.inc,v retrieving revision 1.39 diff -u -r1.39 pifr_simpletest.client.inc --- review/simpletest/pifr_simpletest.client.inc 26 Jan 2010 07:10:55 -0000 1.39 +++ review/simpletest/pifr_simpletest.client.inc 24 Feb 2010 00:40:31 -0000 @@ -21,8 +21,9 @@ public function __construct(array $test) { parent::__construct($test); - if (!empty($this->test['review']['argument']['clone-db'])) { - $this->test['files'][] = $this->test['review']['argument']['clone-db']; + // If an import database is provided then download the database export. + if (!empty($this->arguments['simpletest.db'])) { + $this->test['files'][] = $this->arguments['simpletest.db']; } } @@ -32,7 +33,7 @@ protected function install() { parent::install(); - if (!empty($this->test['review']['argument']['clone-db'])) { + if (!empty($this->arguments['simpletest.db'])) { // Drupal install() will have taken care of settings.php and such so drop // and create database to be filled by clone-db. $this->database->drop_database(); @@ -40,17 +41,12 @@ // Since a database import is being used the username and password must // be included in arguments. - if (!empty($this->test['review']['argument']['clone-db-user']) && - !empty($this->test['review']['argument']['clone-db-pass'])) { - $this->admin_username = $this->test['review']['argument']['clone-db-user']; - $this->admin_password = $this->test['review']['argument']['clone-db-pass']; - } - else { - $this->set_error(array('@reason' => 'both [clone-db-user] and [clone-db-pass] must be specified')); + if (empty($this->arguments['drupal.user']) || empty($this->arguments['drupal.pass'])) { + $this->set_error(array('@reason' => 'both [drupal.user] and [drupal.pass] must be specified')); return; } - $basename = basename($this->test['review']['argument']['clone-db']); + $basename = basename($this->arguments['simpletest.db']); foreach ($this->files as $file) { if (basename($file) == $basename) { $this->log('Importing clone database from [' . $basename . ']...'); @@ -74,7 +70,7 @@ global $base_url, $base_path; // If Drupal 6 then we need to perform SimpleTest installation. - if ($this->test['review']['argument']['core'] == 6) { + if ($this->arguments['drupal.core.version'] == 6) { if (!$this->test_prepare()) { return; } @@ -95,13 +91,13 @@ // Login as admin. $user = new stdClass(); - $user->name = $this->admin_username; - $user->pass_raw = $this->admin_password; + $user->name = $this->arguments['drupal.user']; + $user->pass_raw = $this->arguments['drupal.pass']; $b->drupalLogin($user); // Enable SimpleTest. $edit = array(); - if ($this->test['review']['argument']['core'] == 6) { + if ($this->arguments['drupal.core.version'] == 6) { // Drupal 6. $edit['status[simpletest]'] = TRUE; $b->drupalPost('admin/build/modules', $edit, t('Save configuration')); @@ -150,7 +146,7 @@ $files = array( $this->checkout_directory . '/' . $this->module_directory . '/simpletest/D6-core-simpletest.patch', ); - parent::apply(NULL, $files); + parent::apply($this->checkout_directory, $files); // Move run-tests.sh to scripts directory. chdir($this->checkout_directory); @@ -171,12 +167,12 @@ * @return string Tests argument to be appended to run-test.sh command. */ protected function test_list() { - if (!empty($this->test['review']['argument']['tests'])) { - return '--class ' . implode(',', $this->test['review']['argument']['tests']); + if (!empty($this->arguments['simpletest.tests'])) { + return '--class ' . implode(',', $this->arguments['simpletest.tests']); } - elseif (!empty($this->test['review']['argument']['modules'])) { + elseif (!empty($this->arguments['drupal.modules'])) { $args = array(); - foreach ($this->test['review']['argument']['modules'] as $module) { + foreach ($this->arguments['drupal.modules'] as $module) { // Check the root module directory for a test. $file = $this->module_path($module) . '/' . $module . '.test'; if (file_exists($this->checkout_directory . '/' . $file)) { @@ -191,8 +187,8 @@ } return '--file ' . implode(',', $args); } - elseif (!empty($this->test['review']['argument']['directory'])) { - $scan = file_scan_directory($this->checkout_directory . '/' . $this->test['review']['argument']['directory'], '\.test$'); + elseif (!empty($this->arguments['test.directory.review'])) { + $scan = file_scan_directory($this->checkout_directory . '/' . $this->arguments['test.directory.review'], '\.test$'); $files = array(); foreach ($scan as $file) {