update to drupal 7.23

This commit is contained in:
Bachir Soussi Chiadmi
2013-09-24 09:05:59 +02:00
parent db5f70501a
commit e539e701f8
247 changed files with 4921 additions and 4058 deletions

View File

@@ -84,25 +84,23 @@ function hook_hook_info_alter(&$hooks) {
* Defaults to TRUE.
* - load hook: The name of the hook which should be invoked by
* DrupalDefaultEntityController:attachLoad(), for example 'node_load'.
* - uri callback: A function taking an entity as argument and returning the
* URI elements of the entity, e.g. 'path' and 'options'. The actual entity
* URI can be constructed by passing these elements to url().
* - label callback: (optional) A function taking an entity and an entity type
* as arguments and returning the label of the entity. The entity label is
* the main string associated with an entity; for example, the title of a
* node or the subject of a comment. If there is an entity object property
* that defines the label, use the 'label' element of the 'entity keys'
* return value component to provide this information (see below). If more
* complex logic is needed to determine the label of an entity, you can
* instead specify a callback function here, which will be called to
* determine the entity label. See also the entity_label() function, which
* implements this logic.
* - language callback: (optional) A function taking an entity and an entity
* type as arguments and returning a language code. In most situations, when
* needing to determine this value, inspecting a property named after the
* 'language' element of the 'entity keys' should be enough. The language
* callback is meant to be used primarily for temporary alterations of the
* property value: entity-defining modules are encouraged to always define a
* - uri callback: The name of an implementation of
* callback_entity_info_uri().
* - label callback: (optional) The name of an implementation of
* callback_entity_info_label(), which returns the label of the entity. The
* entity label is the main string associated with an entity; for example,
* the title of a node or the subject of a comment. If there is an entity
* object property that defines the label, then using the 'label' element of
* the 'entity keys' return value component suffices to provide this
* information (see below). Alternatively, specifying this callback allows
* more complex logic to determine the label of an entity. See also the
* entity_label() function, which implements this logic.
* - language callback: (optional) The name of an implementation of
* callback_entity_info_language(). In most situations, when needing to
* determine this value, inspecting a property named after the 'language'
* element of the 'entity keys' should be enough. The language callback is
* meant to be used primarily for temporary alterations of the property
* value: entity-defining modules are encouraged to always define a
* language property, instead of using the callback as main entity language
* source. In fact not having a language property defined is likely to
* prevent an entity from being queried by language. Moreover, given that
@@ -709,9 +707,10 @@ function hook_element_info_alter(&$type) {
/**
* Perform cleanup tasks.
*
* This hook is run at the end of each page request. It is often used for
* page logging and specialized cleanup. This hook MUST NOT print anything
* because by the time it runs the response is already sent to the browser.
* This hook is run at the end of most regular page requests. It is often
* used for page logging and specialized cleanup. This hook MUST NOT print
* anything because by the time it runs the response is already sent to
* the browser.
*
* Only use this hook if your code must run even for cached page views.
* If you have code which must run once on all non-cached pages, use
@@ -958,6 +957,7 @@ function hook_menu_get_item_alter(&$router_item, $path, $original_map) {
* paths and whose values are an associative array of properties for each
* path. (The complete list of properties is in the return value section below.)
*
* @section sec_callback_funcs Callback Functions
* The definition for each path may include a page callback function, which is
* invoked when the registered path is requested. If there is no other
* registered path that fits the requested path better, any further path
@@ -982,6 +982,7 @@ function hook_menu_get_item_alter(&$router_item, $path, $original_map) {
* $jkl will be 'foo'. Note that this automatic passing of optional path
* arguments applies only to page and theme callback functions.
*
* @subsection sub_callback_arguments Callback Arguments
* In addition to optional path arguments, the page callback and other callback
* functions may specify argument lists as arrays. These argument lists may
* contain both fixed/hard-coded argument values and integers that correspond
@@ -1024,6 +1025,8 @@ function hook_menu_get_item_alter(&$router_item, $path, $original_map) {
* @endcode
* See @link form_api Form API documentation @endlink for details.
*
* @section sec_path_wildcards Wildcards in Paths
* @subsection sub_simple_wildcards Simple Wildcards
* Wildcards within paths also work with integer substitution. For example,
* your module could register path 'my-module/%/edit':
* @code
@@ -1036,6 +1039,7 @@ function hook_menu_get_item_alter(&$router_item, $path, $original_map) {
* with 'foo' and passed to the callback function. Note that wildcards may not
* be used as the first component.
*
* @subsection sub_autoload_wildcards Auto-Loader Wildcards
* Registered paths may also contain special "auto-loader" wildcard components
* in the form of '%mymodule_abc', where the '%' part means that this path
* component is a wildcard, and the 'mymodule_abc' part defines the prefix for a
@@ -1067,6 +1071,7 @@ function hook_menu_get_item_alter(&$router_item, $path, $original_map) {
* return FALSE for the path 'node/999/edit' if a node with a node ID of 999
* does not exist. The menu routing system will return a 404 error in this case.
*
* @subsection sub_argument_wildcards Argument Wildcards
* You can also define a %wildcard_to_arg() function (for the example menu
* entry above this would be 'mymodule_abc_to_arg()'). The _to_arg() function
* is invoked to retrieve a value that is used in the path in place of the
@@ -1091,6 +1096,7 @@ function hook_menu_get_item_alter(&$router_item, $path, $original_map) {
* are called when the menu system is generating links to related paths, such
* as the tabs for a set of MENU_LOCAL_TASK items.
*
* @section sec_render_tabs Rendering Menu Items As Tabs
* You can also make groups of menu items to be rendered (by default) as tabs
* on a page. To do that, first create one menu item of type MENU_NORMAL_ITEM,
* with your chosen path, such as 'foo'. Then duplicate that menu item, using a
@@ -2302,7 +2308,7 @@ function hook_theme_registry_alter(&$theme_registry) {
* @return
* The machine-readable name of the theme that should be used for the current
* page request. The value returned from this function will only have an
* effect if it corresponds to a currently-active theme on the site. Do not
* effect if it corresponds to a currently-active theme on the site. Do not
* return a value if you do not wish to set a custom theme.
*/
function hook_custom_theme() {
@@ -2826,7 +2832,15 @@ function hook_file_insert($file) {
* @see file_save()
*/
function hook_file_update($file) {
$file_user = user_load($file->uid);
// Make sure that the file name starts with the owner's user name.
if (strpos($file->filename, $file_user->name) !== 0) {
$old_filename = $file->filename;
$file->filename = $file_user->name . '_' . $file->filename;
$file->save();
watchdog('file', t('%source has been renamed to %destination', array('%source' => $old_filename, '%destination' => $file->filename)));
}
}
/**
@@ -2840,7 +2854,14 @@ function hook_file_update($file) {
* @see file_copy()
*/
function hook_file_copy($file, $source) {
$file_user = user_load($file->uid);
// Make sure that the file name starts with the owner's user name.
if (strpos($file->filename, $file_user->name) !== 0) {
$file->filename = $file_user->name . '_' . $file->filename;
$file->save();
watchdog('file', t('Copied file %source has been renamed to %destination', array('%source' => $source->filename, '%destination' => $file->filename)));
}
}
/**
@@ -2854,7 +2875,14 @@ function hook_file_copy($file, $source) {
* @see file_move()
*/
function hook_file_move($file, $source) {
$file_user = user_load($file->uid);
// Make sure that the file name starts with the owner's user name.
if (strpos($file->filename, $file_user->name) !== 0) {
$file->filename = $file_user->name . '_' . $file->filename;
$file->save();
watchdog('file', t('Moved file %source has been renamed to %destination', array('%source' => $source->filename, '%destination' => $file->filename)));
}
}
/**
@@ -3006,8 +3034,9 @@ function hook_file_url_alter(&$uri) {
* status report page.
*
* @return
* A keyed array of requirements. Each requirement is itself an array with
* the following items:
* An associative array where the keys are arbitrary but must be unique (it
* is suggested to use the module short name as a prefix) and the values are
* themselves associative arrays with the following elements:
* - title: The name of the requirement.
* - value: The current value (e.g., version, time, level, etc). During
* install phase, this should only be used for version numbers, do not set
@@ -3165,6 +3194,8 @@ function hook_schema() {
*
* @param $schema
* Nested array describing the schemas for all modules.
*
* @ingroup schemaapi
*/
function hook_schema_alter(&$schema) {
// Add field to existing schema.
@@ -3638,63 +3669,56 @@ function hook_registry_files_alter(&$files, $modules) {
* inspect later. It is important to remove any temporary variables using
* variable_del() before your last task has completed and control is handed
* back to the installer.
*
*
* @param array $install_state
* An array of information about the current installation state.
*
* @return
* @return array
* A keyed array of tasks the profile will perform during the final stage of
* the installation. Each key represents the name of a function (usually a
* function defined by this profile, although that is not strictly required)
* that is called when that task is run. The values are associative arrays
* containing the following key-value pairs (all of which are optional):
* - 'display_name'
* The human-readable name of the task. This will be displayed to the
* user while the installer is running, along with a list of other tasks
* that are being run. Leave this unset to prevent the task from
* appearing in the list.
* - 'display'
* This is a boolean which can be used to provide finer-grained control
* over whether or not the task will display. This is mostly useful for
* tasks that are intended to display only under certain conditions; for
* these tasks, you can set 'display_name' to the name that you want to
* display, but then use this boolean to hide the task only when certain
* conditions apply.
* - 'type'
* A string representing the type of task. This parameter has three
* possible values:
* - 'normal': This indicates that the task will be treated as a regular
* callback function, which does its processing and optionally returns
* HTML output. This is the default behavior which is used when 'type' is
* not set.
* - 'batch': This indicates that the task function will return a batch
* API definition suitable for batch_set(). The installer will then take
* care of automatically running the task via batch processing.
* - 'form': This indicates that the task function will return a standard
* - display_name: The human-readable name of the task. This will be
* displayed to the user while the installer is running, along with a list
* of other tasks that are being run. Leave this unset to prevent the task
* from appearing in the list.
* - display: This is a boolean which can be used to provide finer-grained
* control over whether or not the task will display. This is mostly useful
* for tasks that are intended to display only under certain conditions;
* for these tasks, you can set 'display_name' to the name that you want to
* display, but then use this boolean to hide the task only when certain
* conditions apply.
* - type: A string representing the type of task. This parameter has three
* possible values:
* - normal: (default) This indicates that the task will be treated as a
* regular callback function, which does its processing and optionally
* returns HTML output.
* - batch: This indicates that the task function will return a batch API
* definition suitable for batch_set(). The installer will then take care
* of automatically running the task via batch processing.
* - form: This indicates that the task function will return a standard
* form API definition (and separately define validation and submit
* handlers, as appropriate). The installer will then take care of
* automatically directing the user through the form submission process.
* - 'run'
* A constant representing the manner in which the task will be run. This
* parameter has three possible values:
* - INSTALL_TASK_RUN_IF_NOT_COMPLETED: This indicates that the task will
* run once during the installation of the profile. This is the default
* behavior which is used when 'run' is not set.
* - INSTALL_TASK_SKIP: This indicates that the task will not run during
* - run: A constant representing the manner in which the task will be run.
* This parameter has three possible values:
* - INSTALL_TASK_RUN_IF_NOT_COMPLETED: (default) This indicates that the
* task will run once during the installation of the profile.
* - INSTALL_TASK_SKIP: This indicates that the task will not run during
* the current installation page request. It can be used to skip running
* an installation task when certain conditions are met, even though the
* task may still show on the list of installation tasks presented to the
* user.
* - INSTALL_TASK_RUN_IF_REACHED: This indicates that the task will run
* on each installation page request that reaches it. This is rarely
* - INSTALL_TASK_RUN_IF_REACHED: This indicates that the task will run on
* each installation page request that reaches it. This is rarely
* necessary for an installation profile to use; it is primarily used by
* the Drupal installer for bootstrap-related tasks.
* - 'function'
* Normally this does not need to be set, but it can be used to force the
* installer to call a different function when the task is run (rather
* than the function whose name is given by the array key). This could be
* used, for example, to allow the same function to be called by two
* different tasks.
* - function: Normally this does not need to be set, but it can be used to
* force the installer to call a different function when the task is run
* (rather than the function whose name is given by the array key). This
* could be used, for example, to allow the same function to be called by
* two different tasks.
*
* @see install_state_defaults()
* @see batch_set()
@@ -4688,6 +4712,77 @@ function hook_filetransfer_info_alter(&$filetransfer_info) {
* @} End of "addtogroup hooks".
*/
/**
* @addtogroup callbacks
* @{
*/
/**
* Return the URI for an entity.
*
* Callback for hook_entity_info().
*
* @param $entity
* The entity to return the URI for.
*
* @return
* An associative array with the following elements:
* - 'path': The URL path for the entity.
* - 'options': (optional) An array of options for the url() function.
* The actual entity URI can be constructed by passing these elements to
* url().
*/
function callback_entity_info_uri($entity) {
return array(
'path' => 'node/' . $entity->nid,
);
}
/**
* Return the label of an entity.
*
* Callback for hook_entity_info().
*
* @param $entity
* The entity for which to generate the label.
* @param $entity_type
* The entity type; e.g., 'node' or 'user'.
*
* @return
* An unsanitized string with the label of the entity.
*
* @see entity_label()
*/
function callback_entity_info_label($entity, $entity_type) {
return empty($entity->title) ? 'Untitled entity' : $entity->title;
}
/**
* Return the language code of the entity.
*
* Callback for hook_entity_info().
*
* The language callback is meant to be used primarily for temporary alterations
* of the property value.
*
* @param $entity
* The entity for which to return the language.
* @param $entity_type
* The entity type; e.g., 'node' or 'user'.
*
* @return
* The language code for the language of the entity.
*
* @see entity_language()
*/
function callback_entity_info_language($entity, $entity_type) {
return $entity->language;
}
/**
* @} End of "addtogroup callbacks".
*/
/**
* @defgroup update_api Update versions of API functions
* @{

View File

@@ -12,8 +12,8 @@ files[] = system.test
required = TRUE
configure = admin/config/system
; Information added by drupal.org packaging script on 2013-04-03
version = "7.22"
; Information added by drupal.org packaging script on 2013-08-08
version = "7.23"
project = "drupal"
datestamp = "1365027012"
datestamp = "1375928238"

View File

@@ -208,7 +208,7 @@ function system_requirements($phase) {
'value' => $memory_limit == -1 ? t('-1 (Unlimited)') : $memory_limit,
);
if ($memory_limit && $memory_limit != -1 && parse_size($memory_limit) < parse_size(DRUPAL_MINIMUM_PHP_MEMORY_LIMIT)) {
if (!drupal_check_memory_limit(DRUPAL_MINIMUM_PHP_MEMORY_LIMIT, $memory_limit)) {
$description = '';
if ($phase == 'install') {
$description = $t('Consider increasing your PHP memory limit to %memory_minimum_limit to help prevent errors in the installation process.', array('%memory_minimum_limit' => DRUPAL_MINIMUM_PHP_MEMORY_LIMIT));
@@ -1983,7 +1983,7 @@ function system_update_7013() {
$timezone = 'UTC';
}
variable_set('date_default_timezone', $timezone);
drupal_set_message('The default time zone has been set to <em>' . check_plain($timezone) . '</em>. Check the ' . l('date and time configuration page', 'admin/config/regional/settings') . ' to configure it correctly.', 'warning');
drupal_set_message(format_string('The default time zone has been set to %timezone. Check the <a href="@config-url">date and time configuration page</a> to configure it correctly.', array('%timezone' => $timezone, '@config-url' => url('admin/config/regional/settings'))), 'warning');
// Remove temporary override.
variable_del('date_temporary_timezone');
}

View File

@@ -97,13 +97,6 @@ class DrupalQueue {
}
interface DrupalQueueInterface {
/**
* Start working with a queue.
*
* @param $name
* Arbitrary string. The name of the queue to work with.
*/
public function __construct($name);
/**
* Add a queue item and store it directly to the queue.
@@ -315,6 +308,12 @@ class MemoryQueue implements DrupalQueueInterface {
*/
protected $id_sequence;
/**
* Start working with a queue.
*
* @param $name
* Arbitrary string. The name of the queue to work with.
*/
public function __construct($name) {
$this->queue = array();
$this->id_sequence = 0;

View File

@@ -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'.");
}
}

View File

@@ -62,6 +62,8 @@
*
* @see theme()
* @see hook_theme()
* @see hooks
* @see callbacks
*
* @} End of "defgroup themeable".
*/