update core to 7.36
This commit is contained in:
@@ -556,6 +556,34 @@ class ModuleDependencyTestCase extends ModuleTestCase {
|
||||
$this->drupalPost(NULL, NULL, t('Uninstall'));
|
||||
$this->assertText(t('The selected modules have been uninstalled.'), 'Modules status has been updated.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests whether the correct module metadata is returned.
|
||||
*/
|
||||
function testModuleMetaData() {
|
||||
// Generate the list of available modules.
|
||||
$modules = system_rebuild_module_data();
|
||||
// Check that the mtime field exists for the system module.
|
||||
$this->assertTrue(!empty($modules['system']->info['mtime']), 'The system.info file modification time field is present.');
|
||||
// Use 0 if mtime isn't present, to avoid an array index notice.
|
||||
$test_mtime = !empty($modules['system']->info['mtime']) ? $modules['system']->info['mtime'] : 0;
|
||||
// Ensure the mtime field contains a number that is greater than zero.
|
||||
$this->assertTrue(is_numeric($test_mtime) && ($test_mtime > 0), 'The system.info file modification time field contains a timestamp.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests whether the correct theme metadata is returned.
|
||||
*/
|
||||
function testThemeMetaData() {
|
||||
// Generate the list of available themes.
|
||||
$themes = system_rebuild_theme_data();
|
||||
// Check that the mtime field exists for the bartik theme.
|
||||
$this->assertTrue(!empty($themes['bartik']->info['mtime']), 'The bartik.info file modification time field is present.');
|
||||
// Use 0 if mtime isn't present, to avoid an array index notice.
|
||||
$test_mtime = !empty($themes['bartik']->info['mtime']) ? $themes['bartik']->info['mtime'] : 0;
|
||||
// Ensure the mtime field contains a number that is greater than zero.
|
||||
$this->assertTrue(is_numeric($test_mtime) && ($test_mtime > 0), 'The bartik.info file modification time field contains a timestamp.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2797,3 +2825,75 @@ class SystemValidTokenTest extends DrupalUnitTestCase {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests drupal_set_message() and related functions.
|
||||
*/
|
||||
class DrupalSetMessageTest extends DrupalWebTestCase {
|
||||
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => 'Messages',
|
||||
'description' => 'Tests that messages can be displayed using drupal_set_message().',
|
||||
'group' => 'System',
|
||||
);
|
||||
}
|
||||
|
||||
function setUp() {
|
||||
parent::setUp('system_test');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests setting messages and removing one before it is displayed.
|
||||
*/
|
||||
function testSetRemoveMessages() {
|
||||
// The page at system-test/drupal-set-message sets two messages and then
|
||||
// removes the first before it is displayed.
|
||||
$this->drupalGet('system-test/drupal-set-message');
|
||||
$this->assertNoText('First message (removed).');
|
||||
$this->assertText('Second message (not removed).');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests confirm form destinations.
|
||||
*/
|
||||
class ConfirmFormTest extends DrupalWebTestCase {
|
||||
protected $admin_user;
|
||||
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => 'Confirm form',
|
||||
'description' => 'Tests that the confirm form does not use external destinations.',
|
||||
'group' => 'System',
|
||||
);
|
||||
}
|
||||
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->admin_user = $this->drupalCreateUser(array('administer users'));
|
||||
$this->drupalLogin($this->admin_user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that the confirm form does not use external destinations.
|
||||
*/
|
||||
function testConfirmForm() {
|
||||
$this->drupalGet('user/1/cancel');
|
||||
$this->assertCancelLinkUrl(url('user/1'));
|
||||
$this->drupalGet('user/1/cancel', array('query' => array('destination' => 'node')));
|
||||
$this->assertCancelLinkUrl(url('node'));
|
||||
$this->drupalGet('user/1/cancel', array('query' => array('destination' => 'http://example.com')));
|
||||
$this->assertCancelLinkUrl(url('user/1'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that a cancel link is present pointing to the provided URL.
|
||||
*/
|
||||
function assertCancelLinkUrl($url, $message = '', $group = 'Other') {
|
||||
$links = $this->xpath('//a[normalize-space(text())=:label and @href=:url]', array(':label' => t('Cancel'), ':url' => $url));
|
||||
$message = ($message ? $message : format_string('Cancel link with url %url found.', array('%url' => $url)));
|
||||
return $this->assertTrue(isset($links[0]), $message, $group);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user