/** * Obtains release info for projects. */ private function getAvailableReleases($projects) { drush_log(dt('Checking available update data ...'), 'ok'); $release_info = drush_include_engine('release_info', 'updatexml'); $available = array(); foreach ($projects as $project_name => $project) { // Discard projects with unknown installation path. if ($project_name != 'drupal' && !isset($project['path'])) { continue; } drush_log(dt('Checking available update data for !project.', array('!project' => $project['label'])), 'ok'); $request = pm_parse_request($project_name, NULL, $project_name); $project_release_info = $release_info->get($request); if ($project_release_info) { $available[$project_name] = $project_release_info; } } // Clear any error set by a failed project. This avoid rollbacks. drush_clear_error(); return $available; }
/** * Tests for pm_parse_request(). */ public function testRequestParser() { $request = 'devel-7.x-1.2'; $request = pm_parse_request($request); $this->assertEquals('devel', $request['name']); $this->assertEquals('7.x-1.2', $request['version']); $request = 'field-conditional-state'; $request = pm_parse_request($request); $this->assertEquals('field-conditional-state', $request['name']); $this->assertEquals('', $request['version']); $request = 'field-conditional-state-7.x-1.2'; $request = pm_parse_request($request); $this->assertEquals('field-conditional-state', $request['name']); $this->assertEquals('7.x-1.2', $request['version']); }