function setUp()
 {
     parent::setUp('api', 'job_queue');
     include drupal_get_path('module', 'api') . '/api.admin.inc';
     include drupal_get_path('module', 'api') . '/parser.inc';
     // Make a branch for sample code.
     $branch->branch_name = '6';
     $branch->title = 'Testing 6';
     $branch->directory = drupal_get_path('module', 'api') . '/tests/sample';
     $branch = null;
     api_save_branch($branch);
     // Parse the code.
     api_update_all_branches();
     while (job_queue_dequeue()) {
     }
 }
Example #2
0
 /**
  * Sets up a files branch using API function calls.
  *
  * @param $prefix
  *   Directory prefix to prepend on the data directories.
  * @param $default
  *   TRUE to set this as the default branch; FALSE to not set it as default.
  * @param $info
  *   Array of branch information to override the defaults (see function
  *   code to see what they are). Note that $prefix is applied after this
  *   information is read, and that only one directory and one excluded are
  *   supported in this function.
  *
  * @return
  *   Array of information (defaults with overrides) used to create the
  *   branch.
  */
 function setUpBranchAPICall($prefix = '', $default = TRUE, $info = array())
 {
     // Set up defaults.
     $info += array('project' => 'test', 'project_title' => 'Project 6', 'branch_name' => '6', 'title' => 'Testing 6', 'directory' => drupal_get_path('module', 'api') . '/tests/sample', 'excluded' => drupal_get_path('module', 'api') . '/tests/sample/to_exclude');
     // Save this information as a branch.
     $branch = new stdClass();
     $branch->type = 'files';
     $branch->status = 1;
     $branch->project = $info['project'];
     $branch->project_title = $info['project_title'];
     $branch->branch_name = $info['branch_name'];
     $branch->title = $info['title'];
     $branch->data = array('directories' => $prefix . $info['directory'], 'excluded_directories' => $prefix . $info['excluded']);
     api_save_branch($branch);
     if ($default) {
         variable_set('api_default_branch', $branch->branch_id);
     }
     $this->assertEqual(variable_get('api_default_branch', 99), $branch->branch_id, 'Variable for default branch is set correctly');
     return $info;
 }
Example #3
0
 /**
  * Sets up a project and a files branch using API function calls.
  *
  * @param $prefix
  *   Directory prefix to prepend on the data directories.
  * @param $default
  *   TRUE to set this as the default branch; FALSE to not set it as default.
  * @param $info
  *   Array of information to override the defaults (see function code to see
  *   what they are). Note that $prefix is applied after this information is
  *   read, and that only one directory and one excluded are supported in this
  *   function.
  *
  * @return
  *   Array of information (defaults with overrides) used to create the
  *   branch and project.
  */
 function setUpBranchAPICall($prefix = '', $default = TRUE, $info = array())
 {
     // Set up defaults.
     $info += array('project' => 'test', 'project_title' => 'Project 6', 'project_type' => 'module', 'branch_name' => '6', 'title' => 'Testing 6', 'core_compatibility' => '7.x', 'update_frequency' => 1, 'directory' => drupal_get_path('module', 'api') . '/tests/sample', 'excluded' => drupal_get_path('module', 'api') . '/tests/sample/to_exclude', 'regexps' => '');
     $info['preferred'] = $default ? 1 : 0;
     // Create the project.
     $project = new stdClass();
     $project->project_type = $info['project_type'];
     $project->project_name = $info['project'];
     $project->project_title = $info['project_title'];
     api_save_project($project);
     if ($default) {
         // Make this the default project/compatibility.
         variable_set('api_default_project', $info['project']);
         variable_set('api_default_core_compatibility', $info['core_compatibility']);
     }
     // Create the branch.
     $branch = new stdClass();
     $branch->project = $info['project'];
     $branch->branch_name = $info['branch_name'];
     $branch->title = $info['title'];
     $branch->preferred = $info['preferred'];
     $branch->core_compatibility = $info['core_compatibility'];
     $branch->update_frequency = $info['update_frequency'];
     $branch->data = array('directories' => $prefix . $info['directory'], 'excluded_directories' => $prefix . $info['excluded'], 'exclude_files_regexp' => $info['regexps']);
     api_save_branch($branch);
     if ($default) {
         $this->assertEqual(variable_get('api_default_branch', 99), $branch->branch_id, 'Variable for default branch is set correctly');
     }
     return $info;
 }