CCC Update test';
$this->assertTrue(strpos($this->drupalGetContent(), $bbb_project_link) < strpos($this->drupalGetContent(), $ccc_project_link), "'BBB Update test' project is listed before the 'CCC Update test' project");
}
/**
* Test that subthemes are notified about security updates for base themes.
*/
function testUpdateBaseThemeSecurityUpdate() {
// Only enable the subtheme, not the base theme.
db_update('system')
->fields(array('status' => 1))
->condition('type', 'theme')
->condition('name', 'update_test_subtheme')
->execute();
// Define the initial state for core and the subtheme.
$system_info = array(
// We want core to be version 7.0.
'#all' => array(
'version' => '7.0',
),
// Show the update_test_basetheme
'update_test_basetheme' => array(
'project' => 'update_test_basetheme',
'version' => '7.x-1.0',
'hidden' => FALSE,
),
// Show the update_test_subtheme
'update_test_subtheme' => array(
'project' => 'update_test_subtheme',
'version' => '7.x-1.0',
'hidden' => FALSE,
),
);
variable_set('update_test_system_info', $system_info);
$xml_mapping = array(
'drupal' => '0',
'update_test_subtheme' => '1_0',
'update_test_basetheme' => '1_1-sec',
);
$this->refreshUpdateStatus($xml_mapping);
$this->assertText(t('Security update required!'));
$this->assertRaw(l(t('Update test base theme'), 'http://example.com/project/update_test_basetheme'), t('Link to the Update test base theme project appears.'));
}
/**
* Test that disabled themes are only shown when desired.
*/
function testUpdateShowDisabledThemes() {
// Make sure all the update_test_* themes are disabled.
db_update('system')
->fields(array('status' => 0))
->condition('type', 'theme')
->condition('name', 'update_test_%', 'LIKE')
->execute();
// Define the initial state for core and the test contrib themes.
$system_info = array(
// We want core to be version 7.0.
'#all' => array(
'version' => '7.0',
),
// The update_test_basetheme should be visible and up to date.
'update_test_basetheme' => array(
'project' => 'update_test_basetheme',
'version' => '7.x-1.1',
'hidden' => FALSE,
),
// The update_test_subtheme should be visible and up to date.
'update_test_subtheme' => array(
'project' => 'update_test_subtheme',
'version' => '7.x-1.0',
'hidden' => FALSE,
),
);
variable_set('update_test_system_info', $system_info);
$xml_mapping = array(
'drupal' => '0',
'update_test_subtheme' => '1_0',
'update_test_basetheme' => '1_1-sec',
);
$base_theme_project_link = l(t('Update test base theme'), 'http://example.com/project/update_test_basetheme');
$sub_theme_project_link = l(t('Update test subtheme'), 'http://example.com/project/update_test_subtheme');
foreach (array(TRUE, FALSE) as $check_disabled) {
variable_set('update_check_disabled', $check_disabled);
$this->refreshUpdateStatus($xml_mapping);
// In neither case should we see the "Themes" heading for enabled themes.
$this->assertNoText(t('Themes'));
if ($check_disabled) {
$this->assertText(t('Disabled themes'));
$this->assertRaw($base_theme_project_link, t('Link to the Update test base theme project appears.'));
$this->assertRaw($sub_theme_project_link, t('Link to the Update test subtheme project appears.'));
}
else {
$this->assertNoText(t('Disabled themes'));
$this->assertNoRaw($base_theme_project_link, t('Link to the Update test base theme project does not appear.'));
$this->assertNoRaw($sub_theme_project_link, t('Link to the Update test subtheme project does not appear.'));
}
}
}
/**
* Make sure that if we fetch from a broken URL, sane things happen.
*/
function testUpdateBrokenFetchURL() {
$system_info = array(
'#all' => array(
'version' => '7.0',
),
'aaa_update_test' => array(
'project' => 'aaa_update_test',
'version' => '7.x-1.0',
'hidden' => FALSE,
),
'bbb_update_test' => array(
'project' => 'bbb_update_test',
'version' => '7.x-1.0',
'hidden' => FALSE,
),
'ccc_update_test' => array(
'project' => 'ccc_update_test',
'version' => '7.x-1.0',
'hidden' => FALSE,
),
);
variable_set('update_test_system_info', $system_info);
$xml_mapping = array(
'drupal' => '0',
'aaa_update_test' => '1_0',
'bbb_update_test' => 'does-not-exist',
'ccc_update_test' => '1_0',
);
$this->refreshUpdateStatus($xml_mapping);
$this->assertText(t('Up to date'));
// We're expecting the report to say most projects are up to date, so we
// hope that 'Up to date' is not unique.
$this->assertNoUniqueText(t('Up to date'));
// It should say we failed to get data, not that we're missing an update.
$this->assertNoText(t('Update available'));
// We need to check that this string is found as part of a project row,
// not just in the "Failed to get available update data for ..." message
// at the top of the page.
$this->assertRaw('
' . t('Failed to get available update data'));
// We should see the output messages from fetching manually.
$this->assertUniqueText(t('Checked available update data for 3 projects.'));
$this->assertUniqueText(t('Failed to get available update data for one project.'));
// The other two should be listed as projects.
$this->assertRaw(l(t('AAA Update test'), 'http://example.com/project/aaa_update_test'), t('Link to aaa_update_test project appears.'));
$this->assertNoRaw(l(t('BBB Update test'), 'http://example.com/project/bbb_update_test'), t('Link to bbb_update_test project does not appear.'));
$this->assertRaw(l(t('CCC Update test'), 'http://example.com/project/ccc_update_test'), t('Link to bbb_update_test project appears.'));
}
}