|
|
|
@@ -31,9 +31,9 @@ class ModuleTestCase extends DrupalWebTestCase {
|
|
|
|
|
$tables = db_find_tables(Database::getConnection()->prefixTables('{' . $base_table . '}') . '%');
|
|
|
|
|
|
|
|
|
|
if ($count) {
|
|
|
|
|
return $this->assertTrue($tables, t('Tables matching "@base_table" found.', array('@base_table' => $base_table)));
|
|
|
|
|
return $this->assertTrue($tables, format_string('Tables matching "@base_table" found.', array('@base_table' => $base_table)));
|
|
|
|
|
}
|
|
|
|
|
return $this->assertFalse($tables, t('Tables matching "@base_table" not found.', array('@base_table' => $base_table)));
|
|
|
|
|
return $this->assertFalse($tables, format_string('Tables matching "@base_table" not found.', array('@base_table' => $base_table)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -50,7 +50,7 @@ class ModuleTestCase extends DrupalWebTestCase {
|
|
|
|
|
$tables_exist = FALSE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return $this->assertTrue($tables_exist, t('All database tables defined by the @module module exist.', array('@module' => $module)));
|
|
|
|
|
return $this->assertTrue($tables_exist, format_string('All database tables defined by the @module module exist.', array('@module' => $module)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -67,7 +67,7 @@ class ModuleTestCase extends DrupalWebTestCase {
|
|
|
|
|
$tables_exist = TRUE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return $this->assertFalse($tables_exist, t('None of the database tables defined by the @module module exist.', array('@module' => $module)));
|
|
|
|
|
return $this->assertFalse($tables_exist, format_string('None of the database tables defined by the @module module exist.', array('@module' => $module)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -87,7 +87,7 @@ class ModuleTestCase extends DrupalWebTestCase {
|
|
|
|
|
else {
|
|
|
|
|
$message = 'Module "@module" is not enabled.';
|
|
|
|
|
}
|
|
|
|
|
$this->assertEqual(module_exists($module), $enabled, t($message, array('@module' => $module)));
|
|
|
|
|
$this->assertEqual(module_exists($module), $enabled, format_string($message, array('@module' => $module)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -122,7 +122,7 @@ class ModuleTestCase extends DrupalWebTestCase {
|
|
|
|
|
->countQuery()
|
|
|
|
|
->execute()
|
|
|
|
|
->fetchField();
|
|
|
|
|
$this->assertTrue($count > 0, t('watchdog table contains @count rows for @message', array('@count' => $count, '@message' => $message)));
|
|
|
|
|
$this->assertTrue($count > 0, format_string('watchdog table contains @count rows for @message', array('@count' => $count, '@message' => $message)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -152,7 +152,7 @@ class EnableDisableTestCase extends ModuleTestCase {
|
|
|
|
|
unset($modules[$name]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$this->assertTrue(count($modules), t('Found @count core modules that we can try to enable in this test.', array('@count' => count($modules))));
|
|
|
|
|
$this->assertTrue(count($modules), format_string('Found @count core modules that we can try to enable in this test.', array('@count' => count($modules))));
|
|
|
|
|
|
|
|
|
|
// Enable the dblog module first, since we will be asserting the presence
|
|
|
|
|
// of log messages throughout the test.
|
|
|
|
@@ -202,7 +202,7 @@ class EnableDisableTestCase extends ModuleTestCase {
|
|
|
|
|
if (count($modules_to_enable) > 1) {
|
|
|
|
|
$this->drupalPost(NULL, array(), t('Continue'));
|
|
|
|
|
}
|
|
|
|
|
$this->assertText(t('The configuration options have been saved.'), t('Modules status has been updated.'));
|
|
|
|
|
$this->assertText(t('The configuration options have been saved.'), 'Modules status has been updated.');
|
|
|
|
|
|
|
|
|
|
// Check that hook_modules_installed() and hook_modules_enabled() were
|
|
|
|
|
// invoked with the expected list of modules, that each module's
|
|
|
|
@@ -268,7 +268,7 @@ class EnableDisableTestCase extends ModuleTestCase {
|
|
|
|
|
$edit['modules[Core][' . $name . '][enable]'] = $name;
|
|
|
|
|
}
|
|
|
|
|
$this->drupalPost('admin/modules', $edit, t('Save configuration'));
|
|
|
|
|
$this->assertText(t('The configuration options have been saved.'), t('Modules status has been updated.'));
|
|
|
|
|
$this->assertText(t('The configuration options have been saved.'), 'Modules status has been updated.');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -315,7 +315,7 @@ class EnableDisableTestCase extends ModuleTestCase {
|
|
|
|
|
$edit = array();
|
|
|
|
|
$edit['modules[Core][' . $module . '][enable]'] = FALSE;
|
|
|
|
|
$this->drupalPost('admin/modules', $edit, t('Save configuration'));
|
|
|
|
|
$this->assertText(t('The configuration options have been saved.'), t('Modules status has been updated.'));
|
|
|
|
|
$this->assertText(t('The configuration options have been saved.'), 'Modules status has been updated.');
|
|
|
|
|
$this->assertModules(array($module), FALSE);
|
|
|
|
|
|
|
|
|
|
// Check that the appropriate hook was fired and the appropriate log
|
|
|
|
@@ -331,7 +331,7 @@ class EnableDisableTestCase extends ModuleTestCase {
|
|
|
|
|
$edit['uninstall[' . $module . ']'] = $module;
|
|
|
|
|
$this->drupalPost('admin/modules/uninstall', $edit, t('Uninstall'));
|
|
|
|
|
$this->drupalPost(NULL, NULL, t('Uninstall'));
|
|
|
|
|
$this->assertText(t('The selected modules have been uninstalled.'), t('Modules status has been updated.'));
|
|
|
|
|
$this->assertText(t('The selected modules have been uninstalled.'), 'Modules status has been updated.');
|
|
|
|
|
$this->assertModules(array($module), FALSE);
|
|
|
|
|
|
|
|
|
|
// Check that the appropriate hook was fired and the appropriate log
|
|
|
|
@@ -372,7 +372,7 @@ class HookRequirementsTestCase extends ModuleTestCase {
|
|
|
|
|
$this->drupalPost('admin/modules', $edit, t('Save configuration'));
|
|
|
|
|
|
|
|
|
|
// Makes sure the module was NOT installed.
|
|
|
|
|
$this->assertText(t('Requirements 1 Test failed requirements'), t('Modules status has been updated.'));
|
|
|
|
|
$this->assertText(t('Requirements 1 Test failed requirements'), 'Modules status has been updated.');
|
|
|
|
|
$this->assertModules(array('requirements1_test'), FALSE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@@ -397,7 +397,7 @@ class ModuleDependencyTestCase extends ModuleTestCase {
|
|
|
|
|
$edit = array();
|
|
|
|
|
$edit['modules[Core][translation][enable]'] = 'translation';
|
|
|
|
|
$this->drupalPost('admin/modules', $edit, t('Save configuration'));
|
|
|
|
|
$this->assertText(t('Some required modules must be enabled'), t('Dependency required.'));
|
|
|
|
|
$this->assertText(t('Some required modules must be enabled'), 'Dependency required.');
|
|
|
|
|
|
|
|
|
|
$this->assertModules(array('translation', 'locale'), FALSE);
|
|
|
|
|
|
|
|
|
@@ -406,7 +406,7 @@ class ModuleDependencyTestCase extends ModuleTestCase {
|
|
|
|
|
$this->assertTableCount('locale', FALSE);
|
|
|
|
|
|
|
|
|
|
$this->drupalPost(NULL, NULL, t('Continue'));
|
|
|
|
|
$this->assertText(t('The configuration options have been saved.'), t('Modules status has been updated.'));
|
|
|
|
|
$this->assertText(t('The configuration options have been saved.'), 'Modules status has been updated.');
|
|
|
|
|
|
|
|
|
|
$this->assertModules(array('translation', 'locale'), TRUE);
|
|
|
|
|
|
|
|
|
@@ -422,9 +422,9 @@ class ModuleDependencyTestCase extends ModuleTestCase {
|
|
|
|
|
// Test that the system_dependencies_test module is marked
|
|
|
|
|
// as missing a dependency.
|
|
|
|
|
$this->drupalGet('admin/modules');
|
|
|
|
|
$this->assertRaw(t('@module (<span class="admin-missing">missing</span>)', array('@module' => drupal_ucfirst('_missing_dependency'))), t('A module with missing dependencies is marked as such.'));
|
|
|
|
|
$this->assertRaw(t('@module (<span class="admin-missing">missing</span>)', array('@module' => drupal_ucfirst('_missing_dependency'))), 'A module with missing dependencies is marked as such.');
|
|
|
|
|
$checkbox = $this->xpath('//input[@type="checkbox" and @disabled="disabled" and @name="modules[Testing][system_dependencies_test][enable]"]');
|
|
|
|
|
$this->assert(count($checkbox) == 1, t('Checkbox for the module is disabled.'));
|
|
|
|
|
$this->assert(count($checkbox) == 1, 'Checkbox for the module is disabled.');
|
|
|
|
|
|
|
|
|
|
// Force enable the system_dependencies_test module.
|
|
|
|
|
module_enable(array('system_dependencies_test'), FALSE);
|
|
|
|
@@ -432,7 +432,7 @@ class ModuleDependencyTestCase extends ModuleTestCase {
|
|
|
|
|
// Verify that the module is forced to be disabled when submitting
|
|
|
|
|
// the module page.
|
|
|
|
|
$this->drupalPost('admin/modules', array(), t('Save configuration'));
|
|
|
|
|
$this->assertText(t('The @module module is missing, so the following module will be disabled: @depends.', array('@module' => '_missing_dependency', '@depends' => 'system_dependencies_test')), t('The module missing dependencies will be disabled.'));
|
|
|
|
|
$this->assertText(t('The @module module is missing, so the following module will be disabled: @depends.', array('@module' => '_missing_dependency', '@depends' => 'system_dependencies_test')), 'The module missing dependencies will be disabled.');
|
|
|
|
|
|
|
|
|
|
// Confirm.
|
|
|
|
|
$this->drupalPost(NULL, NULL, t('Continue'));
|
|
|
|
@@ -453,7 +453,7 @@ class ModuleDependencyTestCase extends ModuleTestCase {
|
|
|
|
|
'@version' => '1.0',
|
|
|
|
|
)), 'A module that depends on an incompatible version of a module is marked as such.');
|
|
|
|
|
$checkbox = $this->xpath('//input[@type="checkbox" and @disabled="disabled" and @name="modules[Testing][system_incompatible_module_version_dependencies_test][enable]"]');
|
|
|
|
|
$this->assert(count($checkbox) == 1, t('Checkbox for the module is disabled.'));
|
|
|
|
|
$this->assert(count($checkbox) == 1, 'Checkbox for the module is disabled.');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -467,7 +467,7 @@ class ModuleDependencyTestCase extends ModuleTestCase {
|
|
|
|
|
'@module' => 'System incompatible core version test',
|
|
|
|
|
)), 'A module that depends on a module with an incompatible core version is marked as such.');
|
|
|
|
|
$checkbox = $this->xpath('//input[@type="checkbox" and @disabled="disabled" and @name="modules[Testing][system_incompatible_core_version_dependencies_test][enable]"]');
|
|
|
|
|
$this->assert(count($checkbox) == 1, t('Checkbox for the module is disabled.'));
|
|
|
|
|
$this->assert(count($checkbox) == 1, 'Checkbox for the module is disabled.');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -484,7 +484,7 @@ class ModuleDependencyTestCase extends ModuleTestCase {
|
|
|
|
|
$this->drupalPost('admin/modules', $edit, t('Save configuration'));
|
|
|
|
|
|
|
|
|
|
// Makes sure the modules were NOT installed.
|
|
|
|
|
$this->assertText(t('Requirements 1 Test failed requirements'), t('Modules status has been updated.'));
|
|
|
|
|
$this->assertText(t('Requirements 1 Test failed requirements'), 'Modules status has been updated.');
|
|
|
|
|
$this->assertModules(array('requirements1_test'), FALSE);
|
|
|
|
|
$this->assertModules(array('requirements2_test'), FALSE);
|
|
|
|
|
|
|
|
|
@@ -543,18 +543,18 @@ class ModuleDependencyTestCase extends ModuleTestCase {
|
|
|
|
|
// Check that the taxonomy module cannot be uninstalled.
|
|
|
|
|
$this->drupalGet('admin/modules/uninstall');
|
|
|
|
|
$checkbox = $this->xpath('//input[@type="checkbox" and @disabled="disabled" and @name="uninstall[comment]"]');
|
|
|
|
|
$this->assert(count($checkbox) == 1, t('Checkbox for uninstalling the comment module is disabled.'));
|
|
|
|
|
$this->assert(count($checkbox) == 1, 'Checkbox for uninstalling the comment module is disabled.');
|
|
|
|
|
|
|
|
|
|
// Uninstall the forum module, and check that taxonomy now can also be
|
|
|
|
|
// uninstalled.
|
|
|
|
|
$edit = array('uninstall[forum]' => 'forum');
|
|
|
|
|
$this->drupalPost('admin/modules/uninstall', $edit, t('Uninstall'));
|
|
|
|
|
$this->drupalPost(NULL, NULL, t('Uninstall'));
|
|
|
|
|
$this->assertText(t('The selected modules have been uninstalled.'), t('Modules status has been updated.'));
|
|
|
|
|
$this->assertText(t('The selected modules have been uninstalled.'), 'Modules status has been updated.');
|
|
|
|
|
$edit = array('uninstall[comment]' => 'comment');
|
|
|
|
|
$this->drupalPost('admin/modules/uninstall', $edit, t('Uninstall'));
|
|
|
|
|
$this->drupalPost(NULL, NULL, t('Uninstall'));
|
|
|
|
|
$this->assertText(t('The selected modules have been uninstalled.'), t('Modules status has been updated.'));
|
|
|
|
|
$this->assertText(t('The selected modules have been uninstalled.'), 'Modules status has been updated.');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -643,7 +643,7 @@ class ModuleRequiredTestCase extends ModuleTestCase {
|
|
|
|
|
if (!empty($info['required'])) {
|
|
|
|
|
$field_name = "modules[{$info['package']}][$module][enable]";
|
|
|
|
|
if (empty($info['hidden'])) {
|
|
|
|
|
$this->assertFieldByXPath("//input[@name='$field_name' and @disabled='disabled' and @checked='checked']", '', t('Field @name was disabled and checked.', array('@name' => $field_name)));
|
|
|
|
|
$this->assertFieldByXPath("//input[@name='$field_name' and @disabled='disabled' and @checked='checked']", '', format_string('Field @name was disabled and checked.', array('@name' => $field_name)));
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$this->assertNoFieldByName($field_name);
|
|
|
|
@@ -783,14 +783,14 @@ class CronRunTestCase extends DrupalWebTestCase {
|
|
|
|
|
variable_set('cron_last', $cron_last);
|
|
|
|
|
variable_set('cron_safe_threshold', $cron_safe_threshold);
|
|
|
|
|
$this->drupalGet('');
|
|
|
|
|
$this->assertTrue($cron_last == variable_get('cron_last', NULL), t('Cron does not run when the cron threshold is not passed.'));
|
|
|
|
|
$this->assertTrue($cron_last == variable_get('cron_last', NULL), 'Cron does not run when the cron threshold is not passed.');
|
|
|
|
|
|
|
|
|
|
// Test if cron runs when the cron threshold was passed.
|
|
|
|
|
$cron_last = time() - 200;
|
|
|
|
|
variable_set('cron_last', $cron_last);
|
|
|
|
|
$this->drupalGet('');
|
|
|
|
|
sleep(1);
|
|
|
|
|
$this->assertTrue($cron_last < variable_get('cron_last', NULL), t('Cron runs when the cron threshold is passed.'));
|
|
|
|
|
$this->assertTrue($cron_last < variable_get('cron_last', NULL), 'Cron runs when the cron threshold is passed.');
|
|
|
|
|
|
|
|
|
|
// Disable the cron threshold through the interface.
|
|
|
|
|
$admin_user = $this->drupalCreateUser(array('administer site configuration'));
|
|
|
|
@@ -803,7 +803,7 @@ class CronRunTestCase extends DrupalWebTestCase {
|
|
|
|
|
$cron_last = time() - 200;
|
|
|
|
|
variable_set('cron_last', $cron_last);
|
|
|
|
|
$this->drupalGet('');
|
|
|
|
|
$this->assertTrue($cron_last == variable_get('cron_last', NULL), t('Cron does not run when the cron threshold is disabled.'));
|
|
|
|
|
$this->assertTrue($cron_last == variable_get('cron_last', NULL), 'Cron does not run when the cron threshold is disabled.');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -823,7 +823,7 @@ class CronRunTestCase extends DrupalWebTestCase {
|
|
|
|
|
))
|
|
|
|
|
->condition('fid', $temp_old->fid)
|
|
|
|
|
->execute();
|
|
|
|
|
$this->assertTrue(file_exists($temp_old->uri), t('Old temp file was created correctly.'));
|
|
|
|
|
$this->assertTrue(file_exists($temp_old->uri), 'Old temp file was created correctly.');
|
|
|
|
|
|
|
|
|
|
// Temporary file that is less than DRUPAL_MAXIMUM_TEMP_FILE_AGE.
|
|
|
|
|
$temp_new = file_save_data('');
|
|
|
|
@@ -831,7 +831,7 @@ class CronRunTestCase extends DrupalWebTestCase {
|
|
|
|
|
->fields(array('status' => 0))
|
|
|
|
|
->condition('fid', $temp_new->fid)
|
|
|
|
|
->execute();
|
|
|
|
|
$this->assertTrue(file_exists($temp_new->uri), t('New temp file was created correctly.'));
|
|
|
|
|
$this->assertTrue(file_exists($temp_new->uri), 'New temp file was created correctly.');
|
|
|
|
|
|
|
|
|
|
// Permanent file that is older than DRUPAL_MAXIMUM_TEMP_FILE_AGE.
|
|
|
|
|
$perm_old = file_save_data('');
|
|
|
|
@@ -839,18 +839,18 @@ class CronRunTestCase extends DrupalWebTestCase {
|
|
|
|
|
->fields(array('timestamp' => 1))
|
|
|
|
|
->condition('fid', $temp_old->fid)
|
|
|
|
|
->execute();
|
|
|
|
|
$this->assertTrue(file_exists($perm_old->uri), t('Old permanent file was created correctly.'));
|
|
|
|
|
$this->assertTrue(file_exists($perm_old->uri), 'Old permanent file was created correctly.');
|
|
|
|
|
|
|
|
|
|
// Permanent file that is newer than DRUPAL_MAXIMUM_TEMP_FILE_AGE.
|
|
|
|
|
$perm_new = file_save_data('');
|
|
|
|
|
$this->assertTrue(file_exists($perm_new->uri), t('New permanent file was created correctly.'));
|
|
|
|
|
$this->assertTrue(file_exists($perm_new->uri), 'New permanent file was created correctly.');
|
|
|
|
|
|
|
|
|
|
// Run cron and then ensure that only the old, temp file was deleted.
|
|
|
|
|
$this->cronRun();
|
|
|
|
|
$this->assertFalse(file_exists($temp_old->uri), t('Old temp file was correctly removed.'));
|
|
|
|
|
$this->assertTrue(file_exists($temp_new->uri), t('New temp file was correctly ignored.'));
|
|
|
|
|
$this->assertTrue(file_exists($perm_old->uri), t('Old permanent file was correctly ignored.'));
|
|
|
|
|
$this->assertTrue(file_exists($perm_new->uri), t('New permanent file was correctly ignored.'));
|
|
|
|
|
$this->assertFalse(file_exists($temp_old->uri), 'Old temp file was correctly removed.');
|
|
|
|
|
$this->assertTrue(file_exists($temp_new->uri), 'New temp file was correctly ignored.');
|
|
|
|
|
$this->assertTrue(file_exists($perm_old->uri), 'Old permanent file was correctly ignored.');
|
|
|
|
|
$this->assertTrue(file_exists($perm_new->uri), 'New permanent file was correctly ignored.');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -863,7 +863,7 @@ class CronRunTestCase extends DrupalWebTestCase {
|
|
|
|
|
// The common_test_cron_helper module sets the 'common_test_cron' variable.
|
|
|
|
|
$this->cronRun();
|
|
|
|
|
$result = variable_get('common_test_cron');
|
|
|
|
|
$this->assertEqual($result, 'success', t('Cron correctly handles exceptions thrown during hook_cron() invocations.'));
|
|
|
|
|
$this->assertEqual($result, 'success', 'Cron correctly handles exceptions thrown during hook_cron() invocations.');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -886,7 +886,7 @@ class AdminMetaTagTestCase extends DrupalWebTestCase {
|
|
|
|
|
list($version, ) = explode('.', VERSION);
|
|
|
|
|
$string = '<meta name="Generator" content="Drupal ' . $version . ' (http://drupal.org)" />';
|
|
|
|
|
$this->drupalGet('node');
|
|
|
|
|
$this->assertRaw($string, t('Fingerprinting meta tag generated correctly.'), t('System'));
|
|
|
|
|
$this->assertRaw($string, 'Fingerprinting meta tag generated correctly.', 'System');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -913,7 +913,7 @@ class AccessDeniedTestCase extends DrupalWebTestCase {
|
|
|
|
|
|
|
|
|
|
function testAccessDenied() {
|
|
|
|
|
$this->drupalGet('admin');
|
|
|
|
|
$this->assertText(t('Access denied'), t('Found the default 403 page'));
|
|
|
|
|
$this->assertText(t('Access denied'), 'Found the default 403 page');
|
|
|
|
|
$this->assertResponse(403);
|
|
|
|
|
|
|
|
|
|
$this->drupalLogin($this->admin_user);
|
|
|
|
@@ -928,14 +928,14 @@ class AccessDeniedTestCase extends DrupalWebTestCase {
|
|
|
|
|
|
|
|
|
|
$this->drupalLogout();
|
|
|
|
|
$this->drupalGet('admin');
|
|
|
|
|
$this->assertText($node->title, t('Found the custom 403 page'));
|
|
|
|
|
$this->assertText($node->title, 'Found the custom 403 page');
|
|
|
|
|
|
|
|
|
|
// Logout and check that the user login block is shown on custom 403 pages.
|
|
|
|
|
$this->drupalLogout();
|
|
|
|
|
|
|
|
|
|
$this->drupalGet('admin');
|
|
|
|
|
$this->assertText($node->title, t('Found the custom 403 page'));
|
|
|
|
|
$this->assertText(t('User login'), t('Blocks are shown on the custom 403 page'));
|
|
|
|
|
$this->assertText($node->title, 'Found the custom 403 page');
|
|
|
|
|
$this->assertText(t('User login'), 'Blocks are shown on the custom 403 page');
|
|
|
|
|
|
|
|
|
|
// Log back in and remove the custom 403 page.
|
|
|
|
|
$this->drupalLogin($this->admin_user);
|
|
|
|
@@ -945,9 +945,9 @@ class AccessDeniedTestCase extends DrupalWebTestCase {
|
|
|
|
|
$this->drupalLogout();
|
|
|
|
|
|
|
|
|
|
$this->drupalGet('admin');
|
|
|
|
|
$this->assertText(t('Access denied'), t('Found the default 403 page'));
|
|
|
|
|
$this->assertText(t('Access denied'), 'Found the default 403 page');
|
|
|
|
|
$this->assertResponse(403);
|
|
|
|
|
$this->assertText(t('User login'), t('Blocks are shown on the default 403 page'));
|
|
|
|
|
$this->assertText(t('User login'), 'Blocks are shown on the default 403 page');
|
|
|
|
|
|
|
|
|
|
// Log back in, set the custom 403 page to /user and remove the block
|
|
|
|
|
$this->drupalLogin($this->admin_user);
|
|
|
|
@@ -994,7 +994,7 @@ class PageNotFoundTestCase extends DrupalWebTestCase {
|
|
|
|
|
|
|
|
|
|
function testPageNotFound() {
|
|
|
|
|
$this->drupalGet($this->randomName(10));
|
|
|
|
|
$this->assertText(t('Page not found'), t('Found the default 404 page'));
|
|
|
|
|
$this->assertText(t('Page not found'), 'Found the default 404 page');
|
|
|
|
|
|
|
|
|
|
$edit = array(
|
|
|
|
|
'title' => $this->randomName(10),
|
|
|
|
@@ -1006,7 +1006,7 @@ class PageNotFoundTestCase extends DrupalWebTestCase {
|
|
|
|
|
$this->drupalPost('admin/config/system/site-information', array('site_404' => 'node/' . $node->nid), t('Save configuration'));
|
|
|
|
|
|
|
|
|
|
$this->drupalGet($this->randomName(10));
|
|
|
|
|
$this->assertText($node->title, t('Found the custom 404 page'));
|
|
|
|
|
$this->assertText($node->title, 'Found the custom 404 page');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1049,7 +1049,7 @@ class SiteMaintenanceTestCase extends DrupalWebTestCase {
|
|
|
|
|
$offline_message = t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('@site' => variable_get('site_name', 'Drupal')));
|
|
|
|
|
|
|
|
|
|
$this->drupalGet('');
|
|
|
|
|
$this->assertRaw($admin_message, t('Found the site maintenance mode message.'));
|
|
|
|
|
$this->assertRaw($admin_message, 'Found the site maintenance mode message.');
|
|
|
|
|
|
|
|
|
|
// Logout and verify that offline message is displayed.
|
|
|
|
|
$this->drupalLogout();
|
|
|
|
@@ -1079,7 +1079,7 @@ class SiteMaintenanceTestCase extends DrupalWebTestCase {
|
|
|
|
|
$this->drupalLogout();
|
|
|
|
|
$this->drupalLogin($this->admin_user);
|
|
|
|
|
$this->drupalGet('admin/config/development/maintenance');
|
|
|
|
|
$this->assertNoRaw($admin_message, t('Site maintenance mode message not displayed.'));
|
|
|
|
|
$this->assertNoRaw($admin_message, 'Site maintenance mode message not displayed.');
|
|
|
|
|
|
|
|
|
|
$offline_message = 'Sorry, not online.';
|
|
|
|
|
$edit = array(
|
|
|
|
@@ -1090,11 +1090,11 @@ class SiteMaintenanceTestCase extends DrupalWebTestCase {
|
|
|
|
|
// Logout and verify that custom site offline message is displayed.
|
|
|
|
|
$this->drupalLogout();
|
|
|
|
|
$this->drupalGet('');
|
|
|
|
|
$this->assertRaw($offline_message, t('Found the site offline message.'));
|
|
|
|
|
$this->assertRaw($offline_message, 'Found the site offline message.');
|
|
|
|
|
|
|
|
|
|
// Verify that custom site offline message is not displayed on user/password.
|
|
|
|
|
$this->drupalGet('user/password');
|
|
|
|
|
$this->assertText(t('Username or e-mail address'), t('Anonymous users can access user/password'));
|
|
|
|
|
$this->assertText(t('Username or e-mail address'), 'Anonymous users can access user/password');
|
|
|
|
|
|
|
|
|
|
// Submit password reset form.
|
|
|
|
|
$edit = array(
|
|
|
|
@@ -1149,18 +1149,18 @@ class DateTimeFunctionalTest extends DrupalWebTestCase {
|
|
|
|
|
|
|
|
|
|
// Confirm date format and time zone.
|
|
|
|
|
$this->drupalGet("node/$node1->nid");
|
|
|
|
|
$this->assertText('2007-01-31 21:00:00 -1000', t('Date should be identical, with GMT offset of -10 hours.'));
|
|
|
|
|
$this->assertText('2007-01-31 21:00:00 -1000', 'Date should be identical, with GMT offset of -10 hours.');
|
|
|
|
|
$this->drupalGet("node/$node2->nid");
|
|
|
|
|
$this->assertText('2007-07-31 21:00:00 -1000', t('Date should be identical, with GMT offset of -10 hours.'));
|
|
|
|
|
$this->assertText('2007-07-31 21:00:00 -1000', 'Date should be identical, with GMT offset of -10 hours.');
|
|
|
|
|
|
|
|
|
|
// Set time zone to Los Angeles time.
|
|
|
|
|
variable_set('date_default_timezone', 'America/Los_Angeles');
|
|
|
|
|
|
|
|
|
|
// Confirm date format and time zone.
|
|
|
|
|
$this->drupalGet("node/$node1->nid");
|
|
|
|
|
$this->assertText('2007-01-31 23:00:00 -0800', t('Date should be two hours ahead, with GMT offset of -8 hours.'));
|
|
|
|
|
$this->assertText('2007-01-31 23:00:00 -0800', 'Date should be two hours ahead, with GMT offset of -8 hours.');
|
|
|
|
|
$this->drupalGet("node/$node2->nid");
|
|
|
|
|
$this->assertText('2007-08-01 00:00:00 -0700', t('Date should be three hours ahead, with GMT offset of -7 hours.'));
|
|
|
|
|
$this->assertText('2007-08-01 00:00:00 -0700', 'Date should be three hours ahead, with GMT offset of -7 hours.');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -1183,7 +1183,7 @@ class DateTimeFunctionalTest extends DrupalWebTestCase {
|
|
|
|
|
'date_format' => $date_format,
|
|
|
|
|
);
|
|
|
|
|
$this->drupalPost('admin/config/regional/date-time/types/add', $edit, t('Add date type'));
|
|
|
|
|
$this->assertEqual($this->getUrl(), url('admin/config/regional/date-time', array('absolute' => TRUE)), t('Correct page redirection.'));
|
|
|
|
|
$this->assertEqual($this->getUrl(), url('admin/config/regional/date-time', array('absolute' => TRUE)), 'Correct page redirection.');
|
|
|
|
|
$this->assertText(t('New date type added successfully.'), 'Date type added confirmation message appears.');
|
|
|
|
|
$this->assertText($date_type, 'Custom date type appears in the date type list.');
|
|
|
|
|
$this->assertText(t('delete'), 'Delete link for custom date type appears.');
|
|
|
|
@@ -1191,7 +1191,7 @@ class DateTimeFunctionalTest extends DrupalWebTestCase {
|
|
|
|
|
// Delete custom date type.
|
|
|
|
|
$this->clickLink(t('delete'));
|
|
|
|
|
$this->drupalPost('admin/config/regional/date-time/types/' . $machine_name . '/delete', array(), t('Remove'));
|
|
|
|
|
$this->assertEqual($this->getUrl(), url('admin/config/regional/date-time', array('absolute' => TRUE)), t('Correct page redirection.'));
|
|
|
|
|
$this->assertEqual($this->getUrl(), url('admin/config/regional/date-time', array('absolute' => TRUE)), 'Correct page redirection.');
|
|
|
|
|
$this->assertText(t('Removed date type ' . $date_type), 'Custom date type removed.');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1209,7 +1209,7 @@ class DateTimeFunctionalTest extends DrupalWebTestCase {
|
|
|
|
|
'date_format' => 'Y',
|
|
|
|
|
);
|
|
|
|
|
$this->drupalPost('admin/config/regional/date-time/formats/add', $edit, t('Add format'));
|
|
|
|
|
$this->assertEqual($this->getUrl(), url('admin/config/regional/date-time/formats', array('absolute' => TRUE)), t('Correct page redirection.'));
|
|
|
|
|
$this->assertEqual($this->getUrl(), url('admin/config/regional/date-time/formats', array('absolute' => TRUE)), 'Correct page redirection.');
|
|
|
|
|
$this->assertNoText(t('No custom date formats available.'), 'No custom date formats message does not appear.');
|
|
|
|
|
$this->assertText(t('Custom date format added.'), 'Custom date format added.');
|
|
|
|
|
|
|
|
|
@@ -1224,13 +1224,13 @@ class DateTimeFunctionalTest extends DrupalWebTestCase {
|
|
|
|
|
'date_format' => 'Y m',
|
|
|
|
|
);
|
|
|
|
|
$this->drupalPost($this->getUrl(), $edit, t('Save format'));
|
|
|
|
|
$this->assertEqual($this->getUrl(), url('admin/config/regional/date-time/formats', array('absolute' => TRUE)), t('Correct page redirection.'));
|
|
|
|
|
$this->assertEqual($this->getUrl(), url('admin/config/regional/date-time/formats', array('absolute' => TRUE)), 'Correct page redirection.');
|
|
|
|
|
$this->assertText(t('Custom date format updated.'), 'Custom date format successfully updated.');
|
|
|
|
|
|
|
|
|
|
// Delete custom date format.
|
|
|
|
|
$this->clickLink(t('delete'));
|
|
|
|
|
$this->drupalPost($this->getUrl(), array(), t('Remove'));
|
|
|
|
|
$this->assertEqual($this->getUrl(), url('admin/config/regional/date-time/formats', array('absolute' => TRUE)), t('Correct page redirection.'));
|
|
|
|
|
$this->assertEqual($this->getUrl(), url('admin/config/regional/date-time/formats', array('absolute' => TRUE)), 'Correct page redirection.');
|
|
|
|
|
$this->assertText(t('Removed date format'), 'Custom date format removed successfully.');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1347,11 +1347,11 @@ class PageTitleFiltering extends DrupalWebTestCase {
|
|
|
|
|
// drupal_set_title's $filter is CHECK_PLAIN by default, so the title should be
|
|
|
|
|
// returned with check_plain().
|
|
|
|
|
drupal_set_title($title, CHECK_PLAIN);
|
|
|
|
|
$this->assertTrue(strpos(drupal_get_title(), '<em>') === FALSE, t('Tags in title converted to entities when $output is CHECK_PLAIN.'));
|
|
|
|
|
$this->assertTrue(strpos(drupal_get_title(), '<em>') === FALSE, 'Tags in title converted to entities when $output is CHECK_PLAIN.');
|
|
|
|
|
// drupal_set_title's $filter is passed as PASS_THROUGH, so the title should be
|
|
|
|
|
// returned with HTML.
|
|
|
|
|
drupal_set_title($title, PASS_THROUGH);
|
|
|
|
|
$this->assertTrue(strpos(drupal_get_title(), '<em>') !== FALSE, t('Tags in title are not converted to entities when $output is PASS_THROUGH.'));
|
|
|
|
|
$this->assertTrue(strpos(drupal_get_title(), '<em>') !== FALSE, 'Tags in title are not converted to entities when $output is PASS_THROUGH.');
|
|
|
|
|
// Generate node content.
|
|
|
|
|
$langcode = LANGUAGE_NONE;
|
|
|
|
|
$edit = array(
|
|
|
|
@@ -1437,11 +1437,11 @@ class FrontPageTestCase extends DrupalWebTestCase {
|
|
|
|
|
*/
|
|
|
|
|
function testDrupalIsFrontPage() {
|
|
|
|
|
$this->drupalGet('');
|
|
|
|
|
$this->assertText(t('On front page.'), t('Path is the front page.'));
|
|
|
|
|
$this->assertText(t('On front page.'), 'Path is the front page.');
|
|
|
|
|
$this->drupalGet('node');
|
|
|
|
|
$this->assertText(t('On front page.'), t('Path is the front page.'));
|
|
|
|
|
$this->assertText(t('On front page.'), 'Path is the front page.');
|
|
|
|
|
$this->drupalGet($this->node_path);
|
|
|
|
|
$this->assertNoText(t('On front page.'), t('Path is not the front page.'));
|
|
|
|
|
$this->assertNoText(t('On front page.'), 'Path is not the front page.');
|
|
|
|
|
|
|
|
|
|
// Change the front page to an invalid path.
|
|
|
|
|
$edit = array('site_frontpage' => 'kittens');
|
|
|
|
@@ -1451,14 +1451,14 @@ class FrontPageTestCase extends DrupalWebTestCase {
|
|
|
|
|
// Change the front page to a valid path.
|
|
|
|
|
$edit['site_frontpage'] = $this->node_path;
|
|
|
|
|
$this->drupalPost('admin/config/system/site-information', $edit, t('Save configuration'));
|
|
|
|
|
$this->assertText(t('The configuration options have been saved.'), t('The front page path has been saved.'));
|
|
|
|
|
$this->assertText(t('The configuration options have been saved.'), 'The front page path has been saved.');
|
|
|
|
|
|
|
|
|
|
$this->drupalGet('');
|
|
|
|
|
$this->assertText(t('On front page.'), t('Path is the front page.'));
|
|
|
|
|
$this->assertText(t('On front page.'), 'Path is the front page.');
|
|
|
|
|
$this->drupalGet('node');
|
|
|
|
|
$this->assertNoText(t('On front page.'), t('Path is not the front page.'));
|
|
|
|
|
$this->assertNoText(t('On front page.'), 'Path is not the front page.');
|
|
|
|
|
$this->drupalGet($this->node_path);
|
|
|
|
|
$this->assertText(t('On front page.'), t('Path is the front page.'));
|
|
|
|
|
$this->assertText(t('On front page.'), 'Path is the front page.');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1568,47 +1568,47 @@ class SystemMainContentFallback extends DrupalWebTestCase {
|
|
|
|
|
// Disable the dashboard module, which depends on the block module.
|
|
|
|
|
$edit['modules[Core][dashboard][enable]'] = FALSE;
|
|
|
|
|
$this->drupalPost('admin/modules', $edit, t('Save configuration'));
|
|
|
|
|
$this->assertText(t('The configuration options have been saved.'), t('Modules status has been updated.'));
|
|
|
|
|
$this->assertText(t('The configuration options have been saved.'), 'Modules status has been updated.');
|
|
|
|
|
// Disable the block module.
|
|
|
|
|
$edit['modules[Core][block][enable]'] = FALSE;
|
|
|
|
|
$this->drupalPost('admin/modules', $edit, t('Save configuration'));
|
|
|
|
|
$this->assertText(t('The configuration options have been saved.'), t('Modules status has been updated.'));
|
|
|
|
|
$this->assertText(t('The configuration options have been saved.'), 'Modules status has been updated.');
|
|
|
|
|
module_list(TRUE);
|
|
|
|
|
$this->assertFalse(module_exists('block'), t('Block module disabled.'));
|
|
|
|
|
$this->assertFalse(module_exists('block'), 'Block module disabled.');
|
|
|
|
|
|
|
|
|
|
// At this point, no region is filled and fallback should be triggered.
|
|
|
|
|
$this->drupalGet('admin/config/system/site-information');
|
|
|
|
|
$this->assertField('site_name', t('Admin interface still available.'));
|
|
|
|
|
$this->assertField('site_name', 'Admin interface still available.');
|
|
|
|
|
|
|
|
|
|
// Fallback should not trigger when another module is handling content.
|
|
|
|
|
$this->drupalGet('system-test/main-content-handling');
|
|
|
|
|
$this->assertRaw('id="system-test-content"', t('Content handled by another module'));
|
|
|
|
|
$this->assertText(t('Content to test main content fallback'), t('Main content still displayed.'));
|
|
|
|
|
$this->assertRaw('id="system-test-content"', 'Content handled by another module');
|
|
|
|
|
$this->assertText(t('Content to test main content fallback'), 'Main content still displayed.');
|
|
|
|
|
|
|
|
|
|
// Fallback should trigger when another module
|
|
|
|
|
// indicates that it is not handling the content.
|
|
|
|
|
$this->drupalGet('system-test/main-content-fallback');
|
|
|
|
|
$this->assertText(t('Content to test main content fallback'), t('Main content fallback properly triggers.'));
|
|
|
|
|
$this->assertText(t('Content to test main content fallback'), 'Main content fallback properly triggers.');
|
|
|
|
|
|
|
|
|
|
// Fallback should not trigger when another module is handling content.
|
|
|
|
|
// Note that this test ensures that no duplicate
|
|
|
|
|
// content gets created by the fallback.
|
|
|
|
|
$this->drupalGet('system-test/main-content-duplication');
|
|
|
|
|
$this->assertNoText(t('Content to test main content fallback'), t('Main content not duplicated.'));
|
|
|
|
|
$this->assertNoText(t('Content to test main content fallback'), 'Main content not duplicated.');
|
|
|
|
|
|
|
|
|
|
// Request a user* page and see if it is displayed.
|
|
|
|
|
$this->drupalLogin($this->web_user);
|
|
|
|
|
$this->drupalGet('user/' . $this->web_user->uid . '/edit');
|
|
|
|
|
$this->assertField('mail', t('User interface still available.'));
|
|
|
|
|
$this->assertField('mail', 'User interface still available.');
|
|
|
|
|
|
|
|
|
|
// Enable the block module again.
|
|
|
|
|
$this->drupalLogin($this->admin_user);
|
|
|
|
|
$edit = array();
|
|
|
|
|
$edit['modules[Core][block][enable]'] = 'block';
|
|
|
|
|
$this->drupalPost('admin/modules', $edit, t('Save configuration'));
|
|
|
|
|
$this->assertText(t('The configuration options have been saved.'), t('Modules status has been updated.'));
|
|
|
|
|
$this->assertText(t('The configuration options have been saved.'), 'Modules status has been updated.');
|
|
|
|
|
module_list(TRUE);
|
|
|
|
|
$this->assertTrue(module_exists('block'), t('Block module re-enabled.'));
|
|
|
|
|
$this->assertTrue(module_exists('block'), 'Block module re-enabled.');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1746,16 +1746,16 @@ class SystemThemeFunctionalTest extends DrupalWebTestCase {
|
|
|
|
|
$this->drupalPost('admin/appearance', $edit, t('Save configuration'));
|
|
|
|
|
|
|
|
|
|
$this->drupalGet('admin/config');
|
|
|
|
|
$this->assertRaw('themes/seven', t('Administration theme used on an administration page.'));
|
|
|
|
|
$this->assertRaw('themes/seven', 'Administration theme used on an administration page.');
|
|
|
|
|
|
|
|
|
|
$this->drupalGet('node/' . $this->node->nid);
|
|
|
|
|
$this->assertRaw('themes/stark', t('Site default theme used on node page.'));
|
|
|
|
|
$this->assertRaw('themes/stark', 'Site default theme used on node page.');
|
|
|
|
|
|
|
|
|
|
$this->drupalGet('node/add');
|
|
|
|
|
$this->assertRaw('themes/seven', t('Administration theme used on the add content page.'));
|
|
|
|
|
$this->assertRaw('themes/seven', 'Administration theme used on the add content page.');
|
|
|
|
|
|
|
|
|
|
$this->drupalGet('node/' . $this->node->nid . '/edit');
|
|
|
|
|
$this->assertRaw('themes/seven', t('Administration theme used on the edit content page.'));
|
|
|
|
|
$this->assertRaw('themes/seven', 'Administration theme used on the edit content page.');
|
|
|
|
|
|
|
|
|
|
// Disable the admin theme on the node admin pages.
|
|
|
|
|
$edit = array(
|
|
|
|
@@ -1764,10 +1764,10 @@ class SystemThemeFunctionalTest extends DrupalWebTestCase {
|
|
|
|
|
$this->drupalPost('admin/appearance', $edit, t('Save configuration'));
|
|
|
|
|
|
|
|
|
|
$this->drupalGet('admin/config');
|
|
|
|
|
$this->assertRaw('themes/seven', t('Administration theme used on an administration page.'));
|
|
|
|
|
$this->assertRaw('themes/seven', 'Administration theme used on an administration page.');
|
|
|
|
|
|
|
|
|
|
$this->drupalGet('node/add');
|
|
|
|
|
$this->assertRaw('themes/stark', t('Site default theme used on the add content page.'));
|
|
|
|
|
$this->assertRaw('themes/stark', 'Site default theme used on the add content page.');
|
|
|
|
|
|
|
|
|
|
// Reset to the default theme settings.
|
|
|
|
|
variable_set('theme_default', 'bartik');
|
|
|
|
@@ -1778,10 +1778,10 @@ class SystemThemeFunctionalTest extends DrupalWebTestCase {
|
|
|
|
|
$this->drupalPost('admin/appearance', $edit, t('Save configuration'));
|
|
|
|
|
|
|
|
|
|
$this->drupalGet('admin');
|
|
|
|
|
$this->assertRaw('themes/bartik', t('Site default theme used on administration page.'));
|
|
|
|
|
$this->assertRaw('themes/bartik', 'Site default theme used on administration page.');
|
|
|
|
|
|
|
|
|
|
$this->drupalGet('node/add');
|
|
|
|
|
$this->assertRaw('themes/bartik', t('Site default theme used on the add content page.'));
|
|
|
|
|
$this->assertRaw('themes/bartik', 'Site default theme used on the add content page.');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -1792,16 +1792,16 @@ class SystemThemeFunctionalTest extends DrupalWebTestCase {
|
|
|
|
|
theme_enable(array('stark'));
|
|
|
|
|
$this->drupalGet('admin/appearance');
|
|
|
|
|
$this->clickLink(t('Set default'), 1);
|
|
|
|
|
$this->assertTrue(variable_get('theme_default', '') == 'stark', t('Site default theme switched successfully.'));
|
|
|
|
|
$this->assertTrue(variable_get('theme_default', '') == 'stark', 'Site default theme switched successfully.');
|
|
|
|
|
|
|
|
|
|
// Test the default theme on the secondary links (blocks admin page).
|
|
|
|
|
$this->drupalGet('admin/structure/block');
|
|
|
|
|
$this->assertText('Stark(' . t('active tab') . ')', t('Default local task on blocks admin page is the default theme.'));
|
|
|
|
|
$this->assertText('Stark(' . t('active tab') . ')', 'Default local task on blocks admin page is the default theme.');
|
|
|
|
|
// Switch back to Bartik and test again to test that the menu cache is cleared.
|
|
|
|
|
$this->drupalGet('admin/appearance');
|
|
|
|
|
$this->clickLink(t('Set default'), 0);
|
|
|
|
|
$this->drupalGet('admin/structure/block');
|
|
|
|
|
$this->assertText('Bartik(' . t('active tab') . ')', t('Default local task on blocks admin page has changed.'));
|
|
|
|
|
$this->assertText('Bartik(' . t('active tab') . ')', 'Default local task on blocks admin page has changed.');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1849,14 +1849,14 @@ class QueueTestCase extends DrupalWebTestCase {
|
|
|
|
|
$new_items[] = $item->data;
|
|
|
|
|
|
|
|
|
|
// First two dequeued items should match the first two items we queued.
|
|
|
|
|
$this->assertEqual($this->queueScore($data, $new_items), 2, t('Two items matched'));
|
|
|
|
|
$this->assertEqual($this->queueScore($data, $new_items), 2, 'Two items matched');
|
|
|
|
|
|
|
|
|
|
// Add two more items.
|
|
|
|
|
$queue1->createItem($data[2]);
|
|
|
|
|
$queue1->createItem($data[3]);
|
|
|
|
|
|
|
|
|
|
$this->assertTrue($queue1->numberOfItems(), t('Queue 1 is not empty after adding items.'));
|
|
|
|
|
$this->assertFalse($queue2->numberOfItems(), t('Queue 2 is empty while Queue 1 has items'));
|
|
|
|
|
$this->assertTrue($queue1->numberOfItems(), 'Queue 1 is not empty after adding items.');
|
|
|
|
|
$this->assertFalse($queue2->numberOfItems(), 'Queue 2 is empty while Queue 1 has items');
|
|
|
|
|
|
|
|
|
|
$items[] = $item = $queue1->claimItem();
|
|
|
|
|
$new_items[] = $item->data;
|
|
|
|
@@ -1866,10 +1866,10 @@ class QueueTestCase extends DrupalWebTestCase {
|
|
|
|
|
|
|
|
|
|
// All dequeued items should match the items we queued exactly once,
|
|
|
|
|
// therefore the score must be exactly 4.
|
|
|
|
|
$this->assertEqual($this->queueScore($data, $new_items), 4, t('Four items matched'));
|
|
|
|
|
$this->assertEqual($this->queueScore($data, $new_items), 4, 'Four items matched');
|
|
|
|
|
|
|
|
|
|
// There should be no duplicate items.
|
|
|
|
|
$this->assertEqual($this->queueScore($new_items, $new_items), 4, t('Four items matched'));
|
|
|
|
|
$this->assertEqual($this->queueScore($new_items, $new_items), 4, 'Four items matched');
|
|
|
|
|
|
|
|
|
|
// Delete all items from queue1.
|
|
|
|
|
foreach ($items as $item) {
|
|
|
|
@@ -1877,8 +1877,8 @@ class QueueTestCase extends DrupalWebTestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check that both queues are empty.
|
|
|
|
|
$this->assertFalse($queue1->numberOfItems(), t('Queue 1 is empty'));
|
|
|
|
|
$this->assertFalse($queue2->numberOfItems(), t('Queue 2 is empty'));
|
|
|
|
|
$this->assertFalse($queue1->numberOfItems(), 'Queue 1 is empty');
|
|
|
|
|
$this->assertFalse($queue2->numberOfItems(), 'Queue 2 is empty');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -1949,10 +1949,10 @@ class TokenReplaceTestCase extends DrupalWebTestCase {
|
|
|
|
|
// token, [node:title].
|
|
|
|
|
$raw_tokens = array('title' => '[node:title]');
|
|
|
|
|
$generated = token_generate('node', $raw_tokens, array('node' => $node));
|
|
|
|
|
$this->assertEqual($generated['[node:title]'], check_plain($node->title), t('Token sanitized.'));
|
|
|
|
|
$this->assertEqual($generated['[node:title]'], check_plain($node->title), 'Token sanitized.');
|
|
|
|
|
|
|
|
|
|
$generated = token_generate('node', $raw_tokens, array('node' => $node), array('sanitize' => FALSE));
|
|
|
|
|
$this->assertEqual($generated['[node:title]'], $node->title, t('Unsanitized token generated properly.'));
|
|
|
|
|
$this->assertEqual($generated['[node:title]'], $node->title, 'Unsanitized token generated properly.');
|
|
|
|
|
|
|
|
|
|
// Test token replacement when the string contains no tokens.
|
|
|
|
|
$this->assertEqual(token_replace('No tokens here.'), 'No tokens here.');
|
|
|
|
@@ -1983,7 +1983,7 @@ class TokenReplaceTestCase extends DrupalWebTestCase {
|
|
|
|
|
$input = $test['prefix'] . '[site:name]' . $test['suffix'];
|
|
|
|
|
$expected = $test['prefix'] . 'Drupal' . $test['suffix'];
|
|
|
|
|
$output = token_replace($input, array(), array('language' => $language));
|
|
|
|
|
$this->assertTrue($output == $expected, t('Token recognized in string %string', array('%string' => $input)));
|
|
|
|
|
$this->assertTrue($output == $expected, format_string('Token recognized in string %string', array('%string' => $input)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -2011,11 +2011,11 @@ class TokenReplaceTestCase extends DrupalWebTestCase {
|
|
|
|
|
$tests['[site:login-url]'] = url('user', $url_options);
|
|
|
|
|
|
|
|
|
|
// Test to make sure that we generated something for each token.
|
|
|
|
|
$this->assertFalse(in_array(0, array_map('strlen', $tests)), t('No empty tokens generated.'));
|
|
|
|
|
$this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.');
|
|
|
|
|
|
|
|
|
|
foreach ($tests as $input => $expected) {
|
|
|
|
|
$output = token_replace($input, array(), array('language' => $language));
|
|
|
|
|
$this->assertEqual($output, $expected, t('Sanitized system site information token %token replaced.', array('%token' => $input)));
|
|
|
|
|
$this->assertEqual($output, $expected, format_string('Sanitized system site information token %token replaced.', array('%token' => $input)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Generate and test unsanitized tokens.
|
|
|
|
@@ -2024,7 +2024,7 @@ class TokenReplaceTestCase extends DrupalWebTestCase {
|
|
|
|
|
|
|
|
|
|
foreach ($tests as $input => $expected) {
|
|
|
|
|
$output = token_replace($input, array(), array('language' => $language, 'sanitize' => FALSE));
|
|
|
|
|
$this->assertEqual($output, $expected, t('Unsanitized system site information token %token replaced.', array('%token' => $input)));
|
|
|
|
|
$this->assertEqual($output, $expected, format_string('Unsanitized system site information token %token replaced.', array('%token' => $input)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -2047,11 +2047,11 @@ class TokenReplaceTestCase extends DrupalWebTestCase {
|
|
|
|
|
$tests['[date:raw]'] = filter_xss($date);
|
|
|
|
|
|
|
|
|
|
// Test to make sure that we generated something for each token.
|
|
|
|
|
$this->assertFalse(in_array(0, array_map('strlen', $tests)), t('No empty tokens generated.'));
|
|
|
|
|
$this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.');
|
|
|
|
|
|
|
|
|
|
foreach ($tests as $input => $expected) {
|
|
|
|
|
$output = token_replace($input, array('date' => $date), array('language' => $language));
|
|
|
|
|
$this->assertEqual($output, $expected, t('Date token %token replaced.', array('%token' => $input)));
|
|
|
|
|
$this->assertEqual($output, $expected, format_string('Date token %token replaced.', array('%token' => $input)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@@ -2115,15 +2115,15 @@ array_space[a b] = Value';
|
|
|
|
|
|
|
|
|
|
$parsed = drupal_parse_info_format($config);
|
|
|
|
|
|
|
|
|
|
$this->assertEqual($parsed['simple'], $expected['simple'], t('Set a simple value.'));
|
|
|
|
|
$this->assertEqual($parsed['quoted'], $expected['quoted'], t('Set a simple value in quotes.'));
|
|
|
|
|
$this->assertEqual($parsed['multiline'], $expected['multiline'], t('Set a multiline value.'));
|
|
|
|
|
$this->assertEqual($parsed['array'], $expected['array'], t('Set a simple array.'));
|
|
|
|
|
$this->assertEqual($parsed['array_assoc'], $expected['array_assoc'], t('Set an associative array.'));
|
|
|
|
|
$this->assertEqual($parsed['array_deep'], $expected['array_deep'], t('Set a nested array.'));
|
|
|
|
|
$this->assertEqual($parsed['array_deep_assoc'], $expected['array_deep_assoc'], t('Set a nested associative array.'));
|
|
|
|
|
$this->assertEqual($parsed['array_space'], $expected['array_space'], t('Set an array with a whitespace in the key.'));
|
|
|
|
|
$this->assertEqual($parsed, $expected, t('Entire parsed .info string and expected array are identical.'));
|
|
|
|
|
$this->assertEqual($parsed['simple'], $expected['simple'], 'Set a simple value.');
|
|
|
|
|
$this->assertEqual($parsed['quoted'], $expected['quoted'], 'Set a simple value in quotes.');
|
|
|
|
|
$this->assertEqual($parsed['multiline'], $expected['multiline'], 'Set a multiline value.');
|
|
|
|
|
$this->assertEqual($parsed['array'], $expected['array'], 'Set a simple array.');
|
|
|
|
|
$this->assertEqual($parsed['array_assoc'], $expected['array_assoc'], 'Set an associative array.');
|
|
|
|
|
$this->assertEqual($parsed['array_deep'], $expected['array_deep'], 'Set a nested array.');
|
|
|
|
|
$this->assertEqual($parsed['array_deep_assoc'], $expected['array_deep_assoc'], 'Set a nested associative array.');
|
|
|
|
|
$this->assertEqual($parsed['array_space'], $expected['array_space'], 'Set an array with a whitespace in the key.');
|
|
|
|
|
$this->assertEqual($parsed, $expected, 'Entire parsed .info string and expected array are identical.');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -2149,32 +2149,32 @@ class SystemInfoAlterTestCase extends DrupalWebTestCase {
|
|
|
|
|
// thing necessary to use the rebuilt {system}.info.
|
|
|
|
|
module_enable(array('module_test'), FALSE);
|
|
|
|
|
drupal_flush_all_caches();
|
|
|
|
|
$this->assertTrue(module_exists('module_test'), t('Test module is enabled.'));
|
|
|
|
|
$this->assertTrue(module_exists('module_test'), 'Test module is enabled.');
|
|
|
|
|
|
|
|
|
|
$info = $this->getSystemInfo('seven', 'theme');
|
|
|
|
|
$this->assertTrue(isset($info['regions']['test_region']), t('Altered theme info was added to {system}.info.'));
|
|
|
|
|
$this->assertTrue(isset($info['regions']['test_region']), 'Altered theme info was added to {system}.info.');
|
|
|
|
|
$seven_regions = system_region_list('seven');
|
|
|
|
|
$this->assertTrue(isset($seven_regions['test_region']), t('Altered theme info was returned by system_region_list().'));
|
|
|
|
|
$this->assertTrue(isset($seven_regions['test_region']), 'Altered theme info was returned by system_region_list().');
|
|
|
|
|
$system_list_themes = system_list('theme');
|
|
|
|
|
$info = $system_list_themes['seven']->info;
|
|
|
|
|
$this->assertTrue(isset($info['regions']['test_region']), t('Altered theme info was returned by system_list().'));
|
|
|
|
|
$this->assertTrue(isset($info['regions']['test_region']), 'Altered theme info was returned by system_list().');
|
|
|
|
|
$list_themes = list_themes();
|
|
|
|
|
$this->assertTrue(isset($list_themes['seven']->info['regions']['test_region']), t('Altered theme info was returned by list_themes().'));
|
|
|
|
|
$this->assertTrue(isset($list_themes['seven']->info['regions']['test_region']), 'Altered theme info was returned by list_themes().');
|
|
|
|
|
|
|
|
|
|
// Disable the module and verify that {system}.info is rebuilt without it.
|
|
|
|
|
module_disable(array('module_test'), FALSE);
|
|
|
|
|
drupal_flush_all_caches();
|
|
|
|
|
$this->assertFalse(module_exists('module_test'), t('Test module is disabled.'));
|
|
|
|
|
$this->assertFalse(module_exists('module_test'), 'Test module is disabled.');
|
|
|
|
|
|
|
|
|
|
$info = $this->getSystemInfo('seven', 'theme');
|
|
|
|
|
$this->assertFalse(isset($info['regions']['test_region']), t('Altered theme info was removed from {system}.info.'));
|
|
|
|
|
$this->assertFalse(isset($info['regions']['test_region']), 'Altered theme info was removed from {system}.info.');
|
|
|
|
|
$seven_regions = system_region_list('seven');
|
|
|
|
|
$this->assertFalse(isset($seven_regions['test_region']), t('Altered theme info was not returned by system_region_list().'));
|
|
|
|
|
$this->assertFalse(isset($seven_regions['test_region']), 'Altered theme info was not returned by system_region_list().');
|
|
|
|
|
$system_list_themes = system_list('theme');
|
|
|
|
|
$info = $system_list_themes['seven']->info;
|
|
|
|
|
$this->assertFalse(isset($info['regions']['test_region']), t('Altered theme info was not returned by system_list().'));
|
|
|
|
|
$this->assertFalse(isset($info['regions']['test_region']), 'Altered theme info was not returned by system_list().');
|
|
|
|
|
$list_themes = list_themes();
|
|
|
|
|
$this->assertFalse(isset($list_themes['seven']->info['regions']['test_region']), t('Altered theme info was not returned by list_themes().'));
|
|
|
|
|
$this->assertFalse(isset($list_themes['seven']->info['regions']['test_region']), 'Altered theme info was not returned by list_themes().');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -2256,7 +2256,7 @@ class UpdateScriptFunctionalTest extends DrupalWebTestCase {
|
|
|
|
|
// go through the update process uninterrupted.
|
|
|
|
|
$this->drupalGet($this->update_url, array('external' => TRUE));
|
|
|
|
|
$this->drupalPost(NULL, array(), t('Continue'));
|
|
|
|
|
$this->assertText(t('No pending updates.'), t('End of update process was reached.'));
|
|
|
|
|
$this->assertText(t('No pending updates.'), 'End of update process was reached.');
|
|
|
|
|
// Confirm that all caches were cleared.
|
|
|
|
|
$this->assertText(t('hook_flush_caches() invoked for update_script_test.module.'), 'Caches were cleared when there were no requirements warnings or errors.');
|
|
|
|
|
|
|
|
|
@@ -2274,7 +2274,7 @@ class UpdateScriptFunctionalTest extends DrupalWebTestCase {
|
|
|
|
|
$this->assertNoText('This is a requirements warning provided by the update_script_test module.');
|
|
|
|
|
$this->drupalPost(NULL, array(), t('Continue'));
|
|
|
|
|
$this->drupalPost(NULL, array(), t('Apply pending updates'));
|
|
|
|
|
$this->assertText(t('The update_script_test_update_7000() update was executed successfully.'), t('End of update process was reached.'));
|
|
|
|
|
$this->assertText(t('The update_script_test_update_7000() update was executed successfully.'), 'End of update process was reached.');
|
|
|
|
|
// Confirm that all caches were cleared.
|
|
|
|
|
$this->assertText(t('hook_flush_caches() invoked for update_script_test.module.'), 'Caches were cleared after resolving a requirements warning and applying updates.');
|
|
|
|
|
|
|
|
|
@@ -2284,7 +2284,7 @@ class UpdateScriptFunctionalTest extends DrupalWebTestCase {
|
|
|
|
|
$this->clickLink('try again');
|
|
|
|
|
$this->assertNoText('This is a requirements warning provided by the update_script_test module.');
|
|
|
|
|
$this->drupalPost(NULL, array(), t('Continue'));
|
|
|
|
|
$this->assertText(t('No pending updates.'), t('End of update process was reached.'));
|
|
|
|
|
$this->assertText(t('No pending updates.'), 'End of update process was reached.');
|
|
|
|
|
// Confirm that all caches were cleared.
|
|
|
|
|
$this->assertText(t('hook_flush_caches() invoked for update_script_test.module.'), 'Caches were cleared after applying updates and re-running the script.');
|
|
|
|
|
|
|
|
|
@@ -2309,7 +2309,7 @@ class UpdateScriptFunctionalTest extends DrupalWebTestCase {
|
|
|
|
|
$this->drupalLogin($this->update_user);
|
|
|
|
|
$this->drupalGet($this->update_url, array('external' => TRUE));
|
|
|
|
|
$final_theme_data = db_query("SELECT * FROM {system} WHERE type = 'theme' ORDER BY name")->fetchAll();
|
|
|
|
|
$this->assertEqual($original_theme_data, $final_theme_data, t('Visiting update.php does not alter the information about themes stored in the database.'));
|
|
|
|
|
$this->assertEqual($original_theme_data, $final_theme_data, 'Visiting update.php does not alter the information about themes stored in the database.');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -2422,7 +2422,7 @@ class RetrieveFileTestCase extends DrupalWebTestCase {
|
|
|
|
|
$filename = 'Файл для тестирования ' . $this->randomName();
|
|
|
|
|
$url = file_create_url($sourcedir . '/' . $filename);
|
|
|
|
|
$retrieved_file = system_retrieve_file($url);
|
|
|
|
|
$this->assertFalse($retrieved_file, t('Non-existent file not fetched.'));
|
|
|
|
|
$this->assertFalse($retrieved_file, 'Non-existent file not fetched.');
|
|
|
|
|
|
|
|
|
|
// Actually create that file, download it via HTTP and test the returned path.
|
|
|
|
|
file_put_contents($sourcedir . '/' . $filename, 'testing');
|
|
|
|
@@ -2432,17 +2432,17 @@ class RetrieveFileTestCase extends DrupalWebTestCase {
|
|
|
|
|
// has to be encoded.
|
|
|
|
|
$encoded_filename = rawurlencode($filename);
|
|
|
|
|
|
|
|
|
|
$this->assertEqual($retrieved_file, 'public://' . $encoded_filename, t('Sane path for downloaded file returned (public:// scheme).'));
|
|
|
|
|
$this->assertTrue(is_file($retrieved_file), t('Downloaded file does exist (public:// scheme).'));
|
|
|
|
|
$this->assertEqual(filesize($retrieved_file), 7, t('File size of downloaded file is correct (public:// scheme).'));
|
|
|
|
|
$this->assertEqual($retrieved_file, 'public://' . $encoded_filename, 'Sane path for downloaded file returned (public:// scheme).');
|
|
|
|
|
$this->assertTrue(is_file($retrieved_file), 'Downloaded file does exist (public:// scheme).');
|
|
|
|
|
$this->assertEqual(filesize($retrieved_file), 7, 'File size of downloaded file is correct (public:// scheme).');
|
|
|
|
|
file_unmanaged_delete($retrieved_file);
|
|
|
|
|
|
|
|
|
|
// Test downloading file to a different location.
|
|
|
|
|
drupal_mkdir($targetdir = 'temporary://' . $this->randomName());
|
|
|
|
|
$retrieved_file = system_retrieve_file($url, $targetdir);
|
|
|
|
|
$this->assertEqual($retrieved_file, "$targetdir/$encoded_filename", t('Sane path for downloaded file returned (temporary:// scheme).'));
|
|
|
|
|
$this->assertTrue(is_file($retrieved_file), t('Downloaded file does exist (temporary:// scheme).'));
|
|
|
|
|
$this->assertEqual(filesize($retrieved_file), 7, t('File size of downloaded file is correct (temporary:// scheme).'));
|
|
|
|
|
$this->assertEqual($retrieved_file, "$targetdir/$encoded_filename", 'Sane path for downloaded file returned (temporary:// scheme).');
|
|
|
|
|
$this->assertTrue(is_file($retrieved_file), 'Downloaded file does exist (temporary:// scheme).');
|
|
|
|
|
$this->assertEqual(filesize($retrieved_file), 7, 'File size of downloaded file is correct (temporary:// scheme).');
|
|
|
|
|
file_unmanaged_delete($retrieved_file);
|
|
|
|
|
|
|
|
|
|
file_unmanaged_delete_recursive($sourcedir);
|
|
|
|
@@ -2580,18 +2580,18 @@ class SystemAdminTestCase extends DrupalWebTestCase {
|
|
|
|
|
*/
|
|
|
|
|
function testCompactMode() {
|
|
|
|
|
$this->drupalGet('admin/compact/on');
|
|
|
|
|
$this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], t('Compact mode turns on.'));
|
|
|
|
|
$this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'Compact mode turns on.');
|
|
|
|
|
$this->drupalGet('admin/compact/on');
|
|
|
|
|
$this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], t('Compact mode remains on after a repeat call.'));
|
|
|
|
|
$this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'Compact mode remains on after a repeat call.');
|
|
|
|
|
$this->drupalGet('');
|
|
|
|
|
$this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], t('Compact mode persists on new requests.'));
|
|
|
|
|
$this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'Compact mode persists on new requests.');
|
|
|
|
|
|
|
|
|
|
$this->drupalGet('admin/compact/off');
|
|
|
|
|
$this->assertEqual($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'deleted', t('Compact mode turns off.'));
|
|
|
|
|
$this->assertEqual($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'deleted', 'Compact mode turns off.');
|
|
|
|
|
$this->drupalGet('admin/compact/off');
|
|
|
|
|
$this->assertEqual($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'deleted', t('Compact mode remains off after a repeat call.'));
|
|
|
|
|
$this->assertEqual($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'deleted', 'Compact mode remains off after a repeat call.');
|
|
|
|
|
$this->drupalGet('');
|
|
|
|
|
$this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], t('Compact mode persists on new requests.'));
|
|
|
|
|
$this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'Compact mode persists on new requests.');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -2671,13 +2671,13 @@ class SystemIndexPhpTest extends DrupalWebTestCase {
|
|
|
|
|
$index_php = $GLOBALS['base_url'] . '/index.php';
|
|
|
|
|
|
|
|
|
|
$this->drupalGet($index_php, array('external' => TRUE));
|
|
|
|
|
$this->assertResponse(200, t('Make sure index.php returns a valid page.'));
|
|
|
|
|
$this->assertResponse(200, 'Make sure index.php returns a valid page.');
|
|
|
|
|
|
|
|
|
|
$this->drupalGet($index_php, array('external' => TRUE, 'query' => array('q' => 'user')));
|
|
|
|
|
$this->assertResponse(200, t('Make sure index.php?q=user returns a valid page.'));
|
|
|
|
|
$this->assertResponse(200, 'Make sure index.php?q=user returns a valid page.');
|
|
|
|
|
|
|
|
|
|
$this->drupalGet($index_php .'/user', array('external' => TRUE));
|
|
|
|
|
$this->assertResponse(404, t("Make sure index.php/user returns a 'page not found'."));
|
|
|
|
|
$this->assertResponse(404, "Make sure index.php/user returns a 'page not found'.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|