diff --git a/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php b/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php index f5e493d9623..2961aebffc3 100644 --- a/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php +++ b/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php @@ -140,8 +140,13 @@ class Schema extends DatabaseSchema { protected function createFieldSql($name, $spec) { $sql = "`" . $name . "` " . $spec['mysql_type']; - if (in_array($spec['mysql_type'], array('VARCHAR', 'CHAR', 'TINYTEXT', 'MEDIUMTEXT', 'LONGTEXT', 'TEXT')) && isset($spec['length'])) { - $sql .= '(' . $spec['length'] . ')'; + if (in_array($spec['mysql_type'], array('VARCHAR', 'CHAR', 'TINYTEXT', 'MEDIUMTEXT', 'LONGTEXT', 'TEXT'))) { + if (isset($spec['length'])) { + $sql .= '(' . $spec['length'] . ')'; + } + if (!empty($spec['binary'])) { + $sql .= ' BINARY'; + } } elseif (isset($spec['precision']) && isset($spec['scale'])) { $sql .= '(' . $spec['precision'] . ', ' . $spec['scale'] . ')'; diff --git a/core/lib/Drupal/Core/Database/Schema.php b/core/lib/Drupal/Core/Database/Schema.php index 9e2f22e3883..62e132761d6 100644 --- a/core/lib/Drupal/Core/Database/Schema.php +++ b/core/lib/Drupal/Core/Database/Schema.php @@ -80,6 +80,10 @@ use Drupal\Core\Database\Query\PlaceholderInterface; * the precision (total number of significant digits) and scale * (decimal digits right of the decimal point). Both values are * mandatory. Ignored for other field types. + * - 'binary': A boolean indicating that MySQL should force 'char', + * 'varchar' or 'text' fields to use case-sensitive binary collation. + * This has no effect on other database types for which case sensitivity + * is already the default behavior. * All parameters apart from 'type' are optional except that type * 'numeric' columns must specify 'precision' and 'scale', and type * 'varchar' must specify the 'length' parameter. diff --git a/core/lib/Drupal/Core/Database/StatementEmpty.php b/core/lib/Drupal/Core/Database/StatementEmpty.php index 84ccb6a2ab5..4336fa11f4b 100644 --- a/core/lib/Drupal/Core/Database/StatementEmpty.php +++ b/core/lib/Drupal/Core/Database/StatementEmpty.php @@ -18,7 +18,7 @@ use Iterator; * database. Calling code can then treat it the same as if it were an actual * result set that happens to contain no records. * - * @see SearchQuery + * @see Drupal\search\SearchQuery */ class StatementEmpty implements Iterator, StatementInterface { diff --git a/core/modules/aggregator/aggregator.module b/core/modules/aggregator/aggregator.module index fec4f0be0ff..9a266baf579 100644 --- a/core/modules/aggregator/aggregator.module +++ b/core/modules/aggregator/aggregator.module @@ -396,6 +396,7 @@ function aggregator_block_view($delta = '') { if (user_access('access news feeds')) { $block = array(); list($type, $id) = explode('-', $delta); + $result = FALSE; switch ($type) { case 'feed': if ($feed = db_query('SELECT fid, title, block FROM {aggregator_feed} WHERE block <> 0 AND fid = :fid', array(':fid' => $id))->fetchObject()) { @@ -413,9 +414,12 @@ function aggregator_block_view($delta = '') { } break; } + $items = array(); - foreach ($result as $item) { - $items[] = theme('aggregator_block_item', array('item' => $item)); + if (!empty($result)) { + foreach ($result as $item) { + $items[] = theme('aggregator_block_item', array('item' => $item)); + } } // Only display the block if there are items to show. diff --git a/core/modules/aggregator/aggregator.test b/core/modules/aggregator/aggregator.test index 2149bed535e..61ad16b2d81 100644 --- a/core/modules/aggregator/aggregator.test +++ b/core/modules/aggregator/aggregator.test @@ -887,6 +887,16 @@ class AggregatorRenderingTestCase extends AggregatorTestCase { $this->drupalGet($href); $correct_titles = $this->xpath('//h1[normalize-space(text())=:title]', array(':title' => $feed->title)); $this->assertFalse(empty($correct_titles), t('Aggregator feed page is available and has the correct title.')); + + // Set the number of news items to 0 to test that the block does not show + // up. + $feed->block = 0; + aggregator_save_feed((array) $feed); + // It is nescessary to flush the cache after saving the number of items. + drupal_flush_all_caches(); + // Check that the block is no longer displayed. + $this->drupalGet('node'); + $this->assertNoText(t($block['title']), 'Feed block is not displayed on the page when number of items is set to 0.'); } /** diff --git a/core/modules/comment/comment.admin.inc b/core/modules/comment/comment.admin.inc index c0f92d98cee..d84b785c278 100644 --- a/core/modules/comment/comment.admin.inc +++ b/core/modules/comment/comment.admin.inc @@ -264,7 +264,7 @@ function comment_confirm_delete_page($cid) { /** * Form constructor for the confirmation form for comment deletion. * - * @param $comment + * @param Comment $comment * The comment that is about to be deleted. * * @ingroup forms @@ -272,7 +272,7 @@ function comment_confirm_delete_page($cid) { * @see comment_confirm_delete_submit() * @see confirm_form() */ -function comment_confirm_delete($form, &$form_state, $comment) { +function comment_confirm_delete($form, &$form_state, Comment $comment) { $form['#comment'] = $comment; // Always provide entity id in the same form key as in the entity edit form. $form['cid'] = array('#type' => 'value', '#value' => $comment->cid); diff --git a/core/modules/comment/comment.api.php b/core/modules/comment/comment.api.php index f270aadade1..eb9f34d4acf 100644 --- a/core/modules/comment/comment.api.php +++ b/core/modules/comment/comment.api.php @@ -16,10 +16,10 @@ * This hook is invoked from comment_save() before the comment is saved to the * database. * - * @param $comment + * @param Comment $comment * The comment object. */ -function hook_comment_presave($comment) { +function hook_comment_presave(Comment $comment) { // Remove leading & trailing spaces from the comment subject. $comment->subject = trim($comment->subject); } @@ -27,10 +27,10 @@ function hook_comment_presave($comment) { /** * Respond to creation of a new comment. * - * @param $comment + * @param Comment $comment * The comment object. */ -function hook_comment_insert($comment) { +function hook_comment_insert(Comment $comment) { // Reindex the node when comments are added. search_touch_node($comment->nid); } @@ -38,10 +38,10 @@ function hook_comment_insert($comment) { /** * Respond to updates to a comment. * - * @param $comment + * @param Comment $comment * The comment object. */ -function hook_comment_update($comment) { +function hook_comment_update(Comment $comment) { // Reindex the node when comments are updated. search_touch_node($comment->nid); } @@ -49,10 +49,10 @@ function hook_comment_update($comment) { /** * Act on comments being loaded from the database. * - * @param $comments + * @param array $comments * An array of comment objects indexed by cid. */ -function hook_comment_load($comments) { +function hook_comment_load(Comment $comments) { $result = db_query('SELECT cid, foo FROM {mytable} WHERE cid IN (:cids)', array(':cids' => array_keys($comments))); foreach ($result as $record) { $comments[$record->cid]->foo = $record->foo; @@ -62,7 +62,7 @@ function hook_comment_load($comments) { /** * Act on a comment that is being assembled before rendering. * - * @param $comment + * @param Comment $comment * Passes in the comment the action is being performed on. * @param $view_mode * View mode, e.g. 'full', 'teaser'... @@ -71,7 +71,7 @@ function hook_comment_load($comments) { * * @see hook_entity_view() */ -function hook_comment_view($comment, $view_mode, $langcode) { +function hook_comment_view(Comment $comment, $view_mode, $langcode) { // how old is the comment $comment->time_ago = time() - $comment->changed; } @@ -108,20 +108,20 @@ function hook_comment_view_alter(&$build) { /** * Respond to a comment being published by a moderator. * - * @param $comment + * @param Comment $comment * The comment the action is being performed on. */ -function hook_comment_publish($comment) { +function hook_comment_publish(Comment $comment) { drupal_set_message(t('Comment: @subject has been published', array('@subject' => $comment->subject))); } /** * Respond to a comment being unpublished by a moderator. * - * @param $comment + * @param Comment $comment * The comment the action is being performed on. */ -function hook_comment_unpublish($comment) { +function hook_comment_unpublish(Comment $comment) { drupal_set_message(t('Comment: @subject has been unpublished', array('@subject' => $comment->subject))); } @@ -132,14 +132,14 @@ function hook_comment_unpublish($comment) { * field_attach_delete() is called and before the comment is actually removed * from the database. * - * @param $comment + * @param Comment $comment * The comment object for the comment that is about to be deleted. * * @see hook_comment_delete() * @see comment_delete_multiple() * @see entity_delete_multiple() */ -function hook_comment_predelete($comment) { +function hook_comment_predelete(Comment $comment) { // Delete a record associated with the comment in a custom table. db_delete('example_comment_table') ->condition('cid', $comment->cid) @@ -153,14 +153,14 @@ function hook_comment_predelete($comment) { * field_attach_delete() has called and after the comment has been removed from * the database. * - * @param $comment + * @param Comment $comment * The comment object for the comment that has been deleted. * * @see hook_comment_predelete() * @see comment_delete_multiple() * @see entity_delete_multiple() */ -function hook_comment_delete($comment) { +function hook_comment_delete(Comment $comment) { drupal_set_message(t('Comment: @subject has been deleted', array('@subject' => $comment->subject))); } diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index 2c28b3533b7..e4dab80f06e 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -164,7 +164,7 @@ function comment_node_type_load($name) { /** * Entity uri callback. */ -function comment_uri($comment) { +function comment_uri(Comment $comment) { return array( 'path' => 'comment/' . $comment->cid, 'options' => array('fragment' => 'comment-' . $comment->cid), @@ -935,7 +935,7 @@ function comment_prepare_thread(&$comments) { /** * Generates an array for rendering a comment. * - * @param $comment + * @param Comment $comment * The comment object. * @param $node * The node the comment is attached to. @@ -948,7 +948,7 @@ function comment_prepare_thread(&$comments) { * @return * An array as expected by drupal_render(). */ -function comment_view($comment, $node, $view_mode = 'full', $langcode = NULL) { +function comment_view(Comment $comment, $node, $view_mode = 'full', $langcode = NULL) { if (!isset($langcode)) { $langcode = $GLOBALS['language_content']->langcode; } @@ -1005,7 +1005,7 @@ function comment_view($comment, $node, $view_mode = 'full', $langcode = NULL) { * The content built for the comment (field values, comments, file attachments * or other comment components) will vary depending on the $view_mode parameter. * - * @param $comment + * @param Comment $comment * A comment object. * @param $node * The node the comment is attached to. @@ -1015,7 +1015,7 @@ function comment_view($comment, $node, $view_mode = 'full', $langcode = NULL) { * (optional) A language code to use for rendering. Defaults to the global * content language of the current request. */ -function comment_build_content($comment, $node, $view_mode = 'full', $langcode = NULL) { +function comment_build_content(Comment $comment, $node, $view_mode = 'full', $langcode = NULL) { if (!isset($langcode)) { $langcode = $GLOBALS['language_content']->langcode; } @@ -1049,7 +1049,7 @@ function comment_build_content($comment, $node, $view_mode = 'full', $langcode = /** * Adds reply, edit, delete, etc. links, depending on user permissions. * - * @param $comment + * @param Comment $comment * The comment object. * @param $node * The node the comment is attached to. @@ -1057,7 +1057,7 @@ function comment_build_content($comment, $node, $view_mode = 'full', $langcode = * @return * A structured array of links. */ -function comment_links($comment, $node) { +function comment_links(Comment $comment, $node) { $links = array(); if ($node->comment == COMMENT_NODE_OPEN) { if (user_access('administer comments') && user_access('post comments')) { @@ -1451,13 +1451,13 @@ function comment_user_predelete($account) { * @param $op * The operation that is to be performed on the comment. Only 'edit' is * recognized now. - * @param $comment + * @param Comment $comment * The comment object. * * @return * TRUE if the current user has acces to the comment, FALSE otherwise. */ -function comment_access($op, $comment) { +function comment_access($op, Comment $comment) { global $user; if ($op == 'edit') { @@ -1468,10 +1468,10 @@ function comment_access($op, $comment) { /** * Accepts a submission of new or changed comment content. * - * @param $comment + * @param Comment $comment * A comment object. */ -function comment_save($comment) { +function comment_save(Comment $comment) { $comment->save(); } @@ -1644,12 +1644,12 @@ function comment_get_display_page($cid, $node_type) { /** * Page callback: Displays the comment editing form. * - * @param $comment + * @param Comment $comment * The comment object representing the comment to be edited. * * @see comment_menu() */ -function comment_edit_page($comment) { +function comment_edit_page(Comment $comment) { drupal_set_title(t('Edit comment %comment', array('%comment' => $comment->subject)), PASS_THROUGH); $node = node_load($comment->nid); return drupal_get_form("comment_node_{$node->type}_form", $comment); @@ -1674,7 +1674,7 @@ function comment_forms() { * @see comment_form_build_preview() * @ingroup forms */ -function comment_form($form, &$form_state, $comment) { +function comment_form($form, &$form_state, Comment $comment) { global $user, $language_content; // During initial form build, add the comment entity to the form state for @@ -1888,9 +1888,11 @@ function comment_form_build_preview($form, &$form_state) { /** * Generates a comment preview. * + * @param Comment $comment + * * @see comment_form_build_preview() */ -function comment_preview($comment) { +function comment_preview(Comment $comment) { global $user; drupal_set_title(t('Preview comment'), PASS_THROUGH); @@ -1987,8 +1989,11 @@ function comment_form_validate($form, &$form_state) { /** * Prepare a comment for submission. + * + * @param Comment $comment + * */ -function comment_submit($comment) { +function comment_submit(Comment $comment) { if (empty($comment->date)) { $comment->date = 'now'; } @@ -2328,15 +2333,15 @@ function comment_action_info() { /** * Publishes a comment. * - * @param $comment - * An optional comment object. + * @param Comment $comment + * (optional) A comment object to publish. * @param array $context * Array with components: * - 'cid': Comment ID. Required if $comment is not given. * * @ingroup actions */ -function comment_publish_action($comment, $context = array()) { +function comment_publish_action(Comment $comment = NULL, $context = array()) { if (isset($comment->subject)) { $subject = $comment->subject; $comment->status = COMMENT_PUBLISHED; @@ -2355,15 +2360,15 @@ function comment_publish_action($comment, $context = array()) { /** * Unpublishes a comment. * - * @param $comment - * An optional comment object. + * @param Comment|null $comment + * (optional) A comment object to unpublish. * @param array $context * Array with components: * - 'cid': Comment ID. Required if $comment is not given. * * @ingroup actions */ -function comment_unpublish_action($comment, $context = array()) { +function comment_unpublish_action(Comment $comment = NULL, $context = array()) { if (isset($comment->subject)) { $subject = $comment->subject; $comment->status = COMMENT_NOT_PUBLISHED; @@ -2382,7 +2387,7 @@ function comment_unpublish_action($comment, $context = array()) { /** * Unpublishes a comment if it contains certain keywords. * - * @param $comment + * @param Comment $comment * Comment object to modify. * @param array $context * Array with components: @@ -2393,7 +2398,7 @@ function comment_unpublish_action($comment, $context = array()) { * @see comment_unpublish_by_keyword_action_form() * @see comment_unpublish_by_keyword_action_submit() */ -function comment_unpublish_by_keyword_action($comment, $context) { +function comment_unpublish_by_keyword_action(Comment $comment, $context) { foreach ($context['keywords'] as $keyword) { $text = drupal_render($comment); if (strpos($text, $keyword) !== FALSE) { @@ -2434,9 +2439,11 @@ function comment_unpublish_by_keyword_action_submit($form, $form_state) { /** * Saves a comment. * + * @param Comment $comment + * * @ingroup actions */ -function comment_save_action($comment) { +function comment_save_action(Comment $comment) { comment_save($comment); cache_clear_all(); watchdog('action', 'Saved comment %title', array('%title' => $comment->subject)); diff --git a/core/modules/comment/comment.pages.inc b/core/modules/comment/comment.pages.inc index c9cc96a10ea..02020ffbcda 100644 --- a/core/modules/comment/comment.pages.inc +++ b/core/modules/comment/comment.pages.inc @@ -47,12 +47,9 @@ function comment_reply($node, $pid = NULL) { // $pid indicates that this is a reply to a comment. if ($pid) { if (user_access('access comments')) { - // Load the comment whose cid = $pid - $comment = db_query('SELECT c.*, u.uid, u.name AS registered_name, u.signature, u.signature_format, u.picture, u.data FROM {comment} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = :cid AND c.status = :status', array( - ':cid' => $pid, - ':status' => COMMENT_PUBLISHED, - ))->fetchObject(); - if ($comment) { + // Load the parent comment. + $comment = comment_load($pid); + if ($comment->status = COMMENT_PUBLISHED) { // If that comment exists, make sure that the current comment and the // parent comment both belong to the same parent node. if ($comment->nid != $node->nid) { diff --git a/core/modules/comment/comment.test b/core/modules/comment/comment.test index 925751398ed..259e420c979 100644 --- a/core/modules/comment/comment.test +++ b/core/modules/comment/comment.test @@ -96,7 +96,7 @@ class CommentHelperCase extends DrupalWebTestCase { /** * Checks current page for specified comment. * - * @param object $comment + * @param Comment $comment * The comment object. * @param boolean $reply * Boolean indicating whether the comment is a reply to another comment. @@ -104,8 +104,8 @@ class CommentHelperCase extends DrupalWebTestCase { * @return boolean * Boolean indicating whether the comment was found. */ - function commentExists($comment, $reply = FALSE) { - if ($comment && is_object($comment)) { + function commentExists(Comment $comment = NULL, $reply = FALSE) { + if ($comment) { $regex = '/' . ($reply ? '
(.*?)' : ''); $regex .= 'drupalPost('comment/' . $comment->id . '/delete', array(), t('Delete')); $this->assertText(t('The comment and all its replies have been deleted.'), t('Comment deleted.')); } diff --git a/core/modules/entity/entity.class.inc b/core/modules/entity/entity.class.inc index 2311af54019..9136c5856ff 100644 --- a/core/modules/entity/entity.class.inc +++ b/core/modules/entity/entity.class.inc @@ -92,6 +92,60 @@ interface EntityInterface { */ public function uri(); + /** + * Returns the default language of a language-specific entity. + * + * @return + * The language object of the entity's default language, or FALSE if the + * entity is not language-specific. + * + * @see EntityInterface::translations() + */ + public function language(); + + /** + * Returns the languages the entity is translated to. + * + * @return + * An array of language objects, keyed by language codes. + * + * @see EntityInterface::language() + */ + public function translations(); + + /** + * Returns the value of an entity property. + * + * @param $property_name + * The name of the property to return; e.g., 'title'. + * @param $langcode + * (optional) If the property is translatable, the language code of the + * language that should be used for getting the property. If set to NULL, + * the entity's default language is being used. + * + * @return + * The property value, or NULL if it is not defined. + * + * @see EntityInterface::language() + */ + public function get($property_name, $langcode = NULL); + + /** + * Sets the value of an entity property. + * + * @param $property_name + * The name of the property to set; e.g., 'title'. + * @param $value + * The value to set, or NULL to unset the property. + * @param $langcode + * (optional) If the property is translatable, the language code of the + * language that should be used for getting the property. If set to + * NULL, the entity's default language is being used. + * + * @see EntityInterface::language() + */ + public function set($property_name, $value, $langcode = NULL); + /** * Saves an entity permanently. * @@ -138,6 +192,13 @@ interface EntityInterface { */ class Entity implements EntityInterface { + /** + * The language code of the entity's default language. + * + * @var string + */ + public $langcode = LANGUAGE_NOT_SPECIFIED; + /** * The entity type. * @@ -246,6 +307,92 @@ class Entity implements EntityInterface { } } + /** + * Implements EntityInterface::language(). + */ + public function language() { + // @todo: Check for language.module instead, once Field API language + // handling depends upon it too. + return module_exists('locale') ? language_load($this->langcode) : FALSE; + } + + /** + * Implements EntityInterface::translations(). + */ + public function translations() { + $languages = array(); + $entity_info = $this->entityInfo(); + if ($entity_info['fieldable'] && ($default_language = $this->language())) { + // Go through translatable properties and determine all languages for + // which translated values are available. + foreach (field_info_instances($this->entityType, $this->bundle()) as $field_name => $instance) { + $field = field_info_field($field_name); + if (field_is_translatable($this->entityType, $field) && isset($this->$field_name)) { + foreach ($this->$field_name as $langcode => $value) { + $languages[$langcode] = TRUE; + } + } + } + // Remove the default language from the translations. + unset($languages[$default_language->langcode]); + $languages = array_intersect_key(language_list(), $languages); + } + return $languages; + } + + /** + * Implements EntityInterface::get(). + */ + public function get($property_name, $langcode = NULL) { + // Handle fields. + $entity_info = $this->entityInfo(); + if ($entity_info['fieldable'] && field_info_instance($this->entityType, $property_name, $this->bundle())) { + $field = field_info_field($property_name); + $langcode = $this->getFieldLangcode($field, $langcode); + return isset($this->{$property_name}[$langcode]) ? $this->{$property_name}[$langcode] : NULL; + } + else { + // Handle properties being not fields. + // @todo: Add support for translatable properties being not fields. + return isset($this->{$property_name}) ? $this->{$property_name} : NULL; + } + } + + /** + * Implements EntityInterface::set(). + */ + public function set($property_name, $value, $langcode = NULL) { + // Handle fields. + $entity_info = $this->entityInfo(); + if ($entity_info['fieldable'] && field_info_instance($this->entityType, $property_name, $this->bundle())) { + $field = field_info_field($property_name); + $langcode = $this->getFieldLangcode($field, $langcode); + $this->{$property_name}[$langcode] = $value; + } + else { + // Handle properties being not fields. + // @todo: Add support for translatable properties being not fields. + $this->{$property_name} = $value; + } + } + + /** + * Determines the language code to use for accessing a field value in a certain language. + */ + protected function getFieldLangcode($field, $langcode = NULL) { + // Only apply the given langcode if the entity is language-specific. + // Otherwise translatable fields are handled as non-translatable fields. + if (field_is_translatable($this->entityType, $field) && ($default_language = $this->language())) { + // For translatable fields the values in default language are stored using + // the language code of the default language. + return isset($langcode) ? $langcode : $default_language->langcode; + } + else { + // Non-translatable fields always use LANGUAGE_NOT_SPECIFIED. + return LANGUAGE_NOT_SPECIFIED; + } + } + /** * Implements EntityInterface::save(). */ diff --git a/core/modules/entity/tests/entity.test b/core/modules/entity/tests/entity.test index 35b6ab1c262..57600a35f65 100644 --- a/core/modules/entity/tests/entity.test +++ b/core/modules/entity/tests/entity.test @@ -65,6 +65,138 @@ class EntityAPITestCase extends DrupalWebTestCase { $all = entity_test_load_multiple(FALSE); $this->assertTrue(empty($all), 'Deleted all entities.'); } + + /** + * Tests Entity getters/setters. + */ + function testEntityGettersSetters() { + $entity = entity_create('entity_test', array('name' => 'test', 'uid' => NULL)); + $this->assertNull($entity->get('uid'), 'Property is not set.'); + + $entity->set('uid', $GLOBALS['user']->uid); + $this->assertEqual($entity->uid, $GLOBALS['user']->uid, 'Property has been set.'); + + $value = $entity->get('uid'); + $this->assertEqual($value, $entity->uid, 'Property has been retrieved.'); + + // Make sure setting/getting translations boils down to setting/getting the + // regular value as the entity and property are not translatable. + $entity->set('uid', NULL, 'en'); + $this->assertNull($entity->uid, 'Language neutral property has been set.'); + + $value = $entity->get('uid', 'en'); + $this->assertNull($value, 'Language neutral property has been retrieved.'); + } +} + +/** + * Tests entity translation. + */ +class EntityTranslationTestCase extends DrupalWebTestCase { + + public static function getInfo() { + return array( + 'name' => 'Entity Translation', + 'description' => 'Tests entity translation functionality.', + 'group' => 'Entity API', + ); + } + + function setUp() { + // Enable translations for the test entity type. We cannot use + // variable_set() here as variables are cleared by parent::setUp(); + $GLOBALS['entity_test_translation'] = TRUE; + parent::setUp('entity_test', 'language', 'locale'); + + // Create a translatable test field. + $this->field_name = drupal_strtolower($this->randomName() . '_field_name'); + $field = array( + 'field_name' => $this->field_name, + 'type' => 'text', + 'cardinality' => 4, + 'translatable' => TRUE, + ); + field_create_field($field); + $this->field = field_read_field($this->field_name); + + $instance = array( + 'field_name' => $this->field_name, + 'entity_type' => 'entity_test', + 'bundle' => 'entity_test', + ); + field_create_instance($instance); + $this->instance = field_read_instance('entity_test', $this->field_name, 'entity_test'); + + // Create test languages. + $this->langcodes = array(); + for ($i = 0; $i < 3; ++$i) { + $language = (object) array( + 'langcode' => 'l' . $i, + 'name' => $this->randomString(), + ); + $this->langcodes[$i] = $language->langcode; + language_save($language); + } + } + + /** + * Tests language related methods of the Entity class. + */ + function testEntityLanguageMethods() { + $entity = entity_create('entity_test', array( + 'name' => 'test', + 'uid' => $GLOBALS['user']->uid, + )); + $this->assertFalse($entity->language(), 'No entity language has been specified.'); + $this->assertFalse($entity->translations(), 'No translations are available'); + + // Set the value in default language. + $entity->set($this->field_name, array(0 => array('value' => 'default value'))); + // Get the value. + $value = $entity->get($this->field_name); + $this->assertEqual($value, array(0 => array('value' => 'default value')), 'Untranslated value retrieved.'); + + // Set the value in a certain language. As the entity is not + // language-specific it should use the default language and so ignore the + // specified language. + $entity->set($this->field_name, array(0 => array('value' => 'default value2')), $this->langcodes[1]); + $value = $entity->get($this->field_name); + $this->assertEqual($value, array(0 => array('value' => 'default value2')), 'Untranslated value updated.'); + $this->assertFalse($entity->translations(), 'No translations are available'); + + // Test getting a field value using the default language for a not + // language-specific entity. + $value = $entity->get($this->field_name, $this->langcodes[1]); + $this->assertEqual($value, array(0 => array('value' => 'default value2')), 'Untranslated value retrieved.'); + + // Now, make the entity language-specific by assigning a language and test + // translating it. + $entity->langcode = $this->langcodes[0]; + $entity->{$this->field_name} = array(); + $this->assertEqual($entity->language(), language_load($this->langcodes[0]), 'Entity language retrieved.'); + $this->assertFalse($entity->translations(), 'No translations are available'); + + // Set the value in default language. + $entity->set($this->field_name, array(0 => array('value' => 'default value'))); + // Get the value. + $value = $entity->get($this->field_name); + $this->assertEqual($value, array(0 => array('value' => 'default value')), 'Untranslated value retrieved.'); + + // Set a translation. + $entity->set($this->field_name, array(0 => array('value' => 'translation 1')), $this->langcodes[1]); + $value = $entity->get($this->field_name, $this->langcodes[1]); + $this->assertEqual($value, array(0 => array('value' => 'translation 1')), 'Translated value set.'); + // Make sure the untranslated value stays. + $value = $entity->get($this->field_name); + $this->assertEqual($value, array(0 => array('value' => 'default value')), 'Untranslated value stays.'); + + $translations[$this->langcodes[1]] = language_load($this->langcodes[1]); + $this->assertEqual($entity->translations(), $translations, 'Translations retrieved.'); + + // Try to get a not available translation. + $value = $entity->get($this->field_name, $this->langcodes[2]); + $this->assertNull($value, 'A translation that is not available is NULL.'); + } } /** diff --git a/core/modules/entity/tests/entity_cache_test.info b/core/modules/entity/tests/modules/entity_cache_test/entity_cache_test.info similarity index 100% rename from core/modules/entity/tests/entity_cache_test.info rename to core/modules/entity/tests/modules/entity_cache_test/entity_cache_test.info diff --git a/core/modules/entity/tests/entity_cache_test.module b/core/modules/entity/tests/modules/entity_cache_test/entity_cache_test.module similarity index 100% rename from core/modules/entity/tests/entity_cache_test.module rename to core/modules/entity/tests/modules/entity_cache_test/entity_cache_test.module diff --git a/core/modules/entity/tests/entity_cache_test_dependency.info b/core/modules/entity/tests/modules/entity_cache_test_dependency/entity_cache_test_dependency.info similarity index 100% rename from core/modules/entity/tests/entity_cache_test_dependency.info rename to core/modules/entity/tests/modules/entity_cache_test_dependency/entity_cache_test_dependency.info diff --git a/core/modules/entity/tests/entity_cache_test_dependency.module b/core/modules/entity/tests/modules/entity_cache_test_dependency/entity_cache_test_dependency.module similarity index 100% rename from core/modules/entity/tests/entity_cache_test_dependency.module rename to core/modules/entity/tests/modules/entity_cache_test_dependency/entity_cache_test_dependency.module diff --git a/core/modules/entity/tests/entity_crud_hook_test.info b/core/modules/entity/tests/modules/entity_crud_hook_test/entity_crud_hook_test.info similarity index 100% rename from core/modules/entity/tests/entity_crud_hook_test.info rename to core/modules/entity/tests/modules/entity_crud_hook_test/entity_crud_hook_test.info diff --git a/core/modules/entity/tests/entity_crud_hook_test.module b/core/modules/entity/tests/modules/entity_crud_hook_test/entity_crud_hook_test.module similarity index 100% rename from core/modules/entity/tests/entity_crud_hook_test.module rename to core/modules/entity/tests/modules/entity_crud_hook_test/entity_crud_hook_test.module diff --git a/core/modules/entity/tests/entity_test.info b/core/modules/entity/tests/modules/entity_test/entity_test.info similarity index 100% rename from core/modules/entity/tests/entity_test.info rename to core/modules/entity/tests/modules/entity_test/entity_test.info diff --git a/core/modules/entity/tests/entity_test.install b/core/modules/entity/tests/modules/entity_test/entity_test.install similarity index 88% rename from core/modules/entity/tests/entity_test.install rename to core/modules/entity/tests/modules/entity_test/entity_test.install index ec2e5bd8245..c0c77039103 100644 --- a/core/modules/entity/tests/entity_test.install +++ b/core/modules/entity/tests/modules/entity_test/entity_test.install @@ -57,6 +57,13 @@ function entity_test_schema() { 'default' => NULL, 'description' => "The {users}.uid of the associated user.", ), + 'langcode' => array( + 'description' => 'The {language}.langcode of the test entity.', + 'type' => 'varchar', + 'length' => 12, + 'not null' => TRUE, + 'default' => '', + ), ), 'indexes' => array( 'uid' => array('uid'), diff --git a/core/modules/entity/tests/entity_test.module b/core/modules/entity/tests/modules/entity_test/entity_test.module similarity index 73% rename from core/modules/entity/tests/entity_test.module rename to core/modules/entity/tests/modules/entity_test/entity_test.module index 6034b06ece4..f7dffa0ac3c 100644 --- a/core/modules/entity/tests/entity_test.module +++ b/core/modules/entity/tests/modules/entity_test/entity_test.module @@ -9,19 +9,21 @@ * Implements hook_entity_info(). */ function entity_test_entity_info() { - $return = array( - 'entity_test' => array( - 'label' => t('Test entity'), - 'entity class' => 'Entity', - 'controller class' => 'EntityDatabaseStorageController', - 'base table' => 'entity_test', - 'fieldable' => TRUE, - 'entity keys' => array( - 'id' => 'id', - ), + $items['entity_test'] = array( + 'label' => t('Test entity'), + 'entity class' => 'Entity', + 'controller class' => 'EntityDatabaseStorageController', + 'base table' => 'entity_test', + 'fieldable' => TRUE, + 'entity keys' => array( + 'id' => 'id', ), ); - return $return; + // Optionally specify a translation handler for testing translations. + if (!empty($GLOBALS['entity_test_translation'])) { + $items['entity_test']['translation']['entity_test'] = TRUE; + } + return $items; } /** diff --git a/core/modules/node/node.module b/core/modules/node/node.module index b5ed7e8e0c7..a59a5c7efb3 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -1725,7 +1725,7 @@ function node_search_admin() { */ function node_search_execute($keys = NULL, $conditions = NULL) { // Build matching conditions - $query = db_select('search_index', 'i', array('target' => 'slave'))->extend('SearchQuery')->extend('PagerDefault'); + $query = db_select('search_index', 'i', array('target' => 'slave'))->extend('Drupal\search\SearchQuery')->extend('PagerDefault'); $query->join('node', 'n', 'n.nid = i.sid'); $query ->condition('n.status', 1) diff --git a/core/modules/node/tests/node_access_test.info b/core/modules/node/tests/modules/node_access_test/node_access_test.info similarity index 100% rename from core/modules/node/tests/node_access_test.info rename to core/modules/node/tests/modules/node_access_test/node_access_test.info diff --git a/core/modules/node/tests/node_access_test.install b/core/modules/node/tests/modules/node_access_test/node_access_test.install similarity index 100% rename from core/modules/node/tests/node_access_test.install rename to core/modules/node/tests/modules/node_access_test/node_access_test.install diff --git a/core/modules/node/tests/node_access_test.module b/core/modules/node/tests/modules/node_access_test/node_access_test.module similarity index 100% rename from core/modules/node/tests/node_access_test.module rename to core/modules/node/tests/modules/node_access_test/node_access_test.module diff --git a/core/modules/node/tests/node_test.info b/core/modules/node/tests/modules/node_test/node_test.info similarity index 100% rename from core/modules/node/tests/node_test.info rename to core/modules/node/tests/modules/node_test/node_test.info diff --git a/core/modules/node/tests/node_test.module b/core/modules/node/tests/modules/node_test/node_test.module similarity index 100% rename from core/modules/node/tests/node_test.module rename to core/modules/node/tests/modules/node_test/node_test.module diff --git a/core/modules/node/tests/node_test_exception.info b/core/modules/node/tests/modules/node_test_exception/node_test_exception.info similarity index 100% rename from core/modules/node/tests/node_test_exception.info rename to core/modules/node/tests/modules/node_test_exception/node_test_exception.info diff --git a/core/modules/node/tests/node_test_exception.module b/core/modules/node/tests/modules/node_test_exception/node_test_exception.module similarity index 100% rename from core/modules/node/tests/node_test_exception.module rename to core/modules/node/tests/modules/node_test_exception/node_test_exception.module diff --git a/core/modules/search/search.extender.inc b/core/modules/search/lib/Drupal/search/SearchQuery.php similarity index 99% rename from core/modules/search/search.extender.inc rename to core/modules/search/lib/Drupal/search/SearchQuery.php index 73f783652f6..95103a670f0 100644 --- a/core/modules/search/search.extender.inc +++ b/core/modules/search/lib/Drupal/search/SearchQuery.php @@ -1,5 +1,12 @@ 'slave'))->extend('SearchQuery')->extend('PagerDefault'); + $query = db_select('search_index', 'i', array('target' => 'slave'))->extend('Drupal\search\SearchQuery')->extend('PagerDefault'); $query->join('node', 'n', 'n.nid = i.sid'); $query ->condition('n.status', 1) diff --git a/core/modules/search/search.info b/core/modules/search/search.info index 1d47c96f2e1..a5a019ece1f 100644 --- a/core/modules/search/search.info +++ b/core/modules/search/search.info @@ -3,7 +3,6 @@ description = Enables site-wide keyword searching. package = Core version = VERSION core = 8.x -files[] = search.extender.inc files[] = search.test configure = admin/config/search/settings stylesheets[all][] = search.theme.css diff --git a/core/modules/search/search.test b/core/modules/search/search.test index 8b67b0bdf8b..89444752e34 100644 --- a/core/modules/search/search.test +++ b/core/modules/search/search.test @@ -159,7 +159,7 @@ class SearchMatchTestCase extends SearchWebTestCase { ); foreach ($queries as $query => $results) { $result = db_select('search_index', 'i') - ->extend('SearchQuery') + ->extend('Drupal\search\SearchQuery') ->searchExpression($query, SEARCH_TYPE) ->execute(); @@ -179,7 +179,7 @@ class SearchMatchTestCase extends SearchWebTestCase { ); foreach ($queries as $query => $results) { $result = db_select('search_index', 'i') - ->extend('SearchQuery') + ->extend('Drupal\search\SearchQuery') ->searchExpression($query, SEARCH_TYPE_2) ->execute(); @@ -202,7 +202,7 @@ class SearchMatchTestCase extends SearchWebTestCase { ); foreach ($queries as $query => $results) { $result = db_select('search_index', 'i') - ->extend('SearchQuery') + ->extend('Drupal\search\SearchQuery') ->searchExpression($query, SEARCH_TYPE_JPN) ->execute(); diff --git a/core/modules/search/tests/search_embedded_form.info b/core/modules/search/tests/modules/search_embedded_form/search_embedded_form.info similarity index 100% rename from core/modules/search/tests/search_embedded_form.info rename to core/modules/search/tests/modules/search_embedded_form/search_embedded_form.info diff --git a/core/modules/search/tests/search_embedded_form.module b/core/modules/search/tests/modules/search_embedded_form/search_embedded_form.module similarity index 100% rename from core/modules/search/tests/search_embedded_form.module rename to core/modules/search/tests/modules/search_embedded_form/search_embedded_form.module diff --git a/core/modules/search/tests/search_extra_type.info b/core/modules/search/tests/modules/search_extra_type/search_extra_type.info similarity index 100% rename from core/modules/search/tests/search_extra_type.info rename to core/modules/search/tests/modules/search_extra_type/search_extra_type.info diff --git a/core/modules/search/tests/search_extra_type.module b/core/modules/search/tests/modules/search_extra_type/search_extra_type.module similarity index 100% rename from core/modules/search/tests/search_extra_type.module rename to core/modules/search/tests/modules/search_extra_type/search_extra_type.module diff --git a/core/modules/simpletest/simpletest.info b/core/modules/simpletest/simpletest.info index cf55121f3f3..7797fc5882c 100644 --- a/core/modules/simpletest/simpletest.info +++ b/core/modules/simpletest/simpletest.info @@ -6,41 +6,3 @@ core = 8.x files[] = simpletest.test files[] = drupal_web_test_case.php configure = admin/config/development/testing/settings - -; Tests in tests directory. -files[] = tests/actions.test -files[] = tests/ajax.test -files[] = tests/batch.test -files[] = tests/bootstrap.test -files[] = tests/cache.test -files[] = tests/common.test -files[] = tests/database_test.test -files[] = tests/error.test -files[] = tests/file.test -files[] = tests/filetransfer.test -files[] = tests/form.test -files[] = tests/graph.test -files[] = tests/image.test -files[] = tests/installer.test -files[] = tests/lock.test -files[] = tests/mail.test -files[] = tests/menu.test -files[] = tests/module.test -files[] = tests/pager.test -files[] = tests/password.test -files[] = tests/path.test -files[] = tests/queue.test -files[] = tests/registry.test -files[] = tests/schema.test -files[] = tests/session.test -files[] = tests/symfony.test -files[] = tests/tablesort.test -files[] = tests/theme.test -files[] = tests/unicode.test -files[] = tests/update.test -files[] = tests/uuid.test -files[] = tests/xmlrpc.test -files[] = tests/upgrade/upgrade.test -files[] = tests/upgrade/upgrade_bare.test -files[] = tests/upgrade/upgrade_filled.test -files[] = tests/upgrade/upgrade.language.test diff --git a/core/modules/simpletest/simpletest.test b/core/modules/simpletest/simpletest.test index 55a48be95c2..4cecbe6b8af 100644 --- a/core/modules/simpletest/simpletest.test +++ b/core/modules/simpletest/simpletest.test @@ -86,9 +86,9 @@ class SimpleTestFunctionalTest extends DrupalWebTestCase { function testUserAgentValidation() { if (!$this->inCURL()) { global $base_url; - $simpletest_path = $base_url . '/' . drupal_get_path('module', 'simpletest'); - $HTTP_path = $simpletest_path .'/tests/http.php?q=node'; - $https_path = $simpletest_path .'/tests/https.php?q=node'; + $system_path = $base_url . '/' . drupal_get_path('module', 'system'); + $HTTP_path = $system_path .'/tests/http.php?q=node'; + $https_path = $system_path .'/tests/https.php?q=node'; // Generate a valid simpletest User-Agent to pass validation. $this->assertTrue(preg_match('/simpletest\d+/', $this->databasePrefix, $matches), t('Database prefix contains simpletest prefix.')); $test_ua = drupal_generate_test_ua($matches[0]); diff --git a/core/modules/system/system.info b/core/modules/system/system.info index f082cd5c2d7..41495f3f2b2 100644 --- a/core/modules/system/system.info +++ b/core/modules/system/system.info @@ -6,3 +6,40 @@ core = 8.x files[] = system.test required = TRUE configure = admin/config/system + +; Tests in tests directory. +files[] = tests/actions.test +files[] = tests/ajax.test +files[] = tests/batch.test +files[] = tests/bootstrap.test +files[] = tests/cache.test +files[] = tests/common.test +files[] = tests/database_test.test +files[] = tests/error.test +files[] = tests/file.test +files[] = tests/filetransfer.test +files[] = tests/form.test +files[] = tests/image.test +files[] = tests/installer.test +files[] = tests/lock.test +files[] = tests/mail.test +files[] = tests/menu.test +files[] = tests/module.test +files[] = tests/pager.test +files[] = tests/password.test +files[] = tests/path.test +files[] = tests/queue.test +files[] = tests/registry.test +files[] = tests/schema.test +files[] = tests/session.test +files[] = tests/symfony.test +files[] = tests/tablesort.test +files[] = tests/theme.test +files[] = tests/unicode.test +files[] = tests/update.test +files[] = tests/uuid.test +files[] = tests/xmlrpc.test +files[] = tests/upgrade/upgrade.test +files[] = tests/upgrade/upgrade_bare.test +files[] = tests/upgrade/upgrade_filled.test +files[] = tests/upgrade/upgrade.language.test diff --git a/core/modules/simpletest/tests/actions.test b/core/modules/system/tests/actions.test similarity index 100% rename from core/modules/simpletest/tests/actions.test rename to core/modules/system/tests/actions.test diff --git a/core/modules/simpletest/tests/ajax.test b/core/modules/system/tests/ajax.test similarity index 100% rename from core/modules/simpletest/tests/ajax.test rename to core/modules/system/tests/ajax.test diff --git a/core/modules/simpletest/tests/batch.test b/core/modules/system/tests/batch.test similarity index 100% rename from core/modules/simpletest/tests/batch.test rename to core/modules/system/tests/batch.test diff --git a/core/modules/simpletest/tests/bootstrap.test b/core/modules/system/tests/bootstrap.test similarity index 100% rename from core/modules/simpletest/tests/bootstrap.test rename to core/modules/system/tests/bootstrap.test diff --git a/core/modules/simpletest/tests/cache.test b/core/modules/system/tests/cache.test similarity index 100% rename from core/modules/simpletest/tests/cache.test rename to core/modules/system/tests/cache.test diff --git a/core/modules/simpletest/tests/common.test b/core/modules/system/tests/common.test similarity index 99% rename from core/modules/simpletest/tests/common.test rename to core/modules/system/tests/common.test index 12df48caaf8..dbb471e7c11 100644 --- a/core/modules/simpletest/tests/common.test +++ b/core/modules/system/tests/common.test @@ -615,14 +615,14 @@ class CommonCascadingStylesheetsTestCase extends DrupalWebTestCase { // Verify common_test.css in a STYLE media="all" tag. $elements = $this->xpath('//style[@media=:media and contains(text(), :filename)]', array( ':media' => 'all', - ':filename' => 'tests/common_test.css', + ':filename' => 'tests/modules/common_test/common_test.css', )); $this->assertTrue(count($elements), "Stylesheet with media 'all' in module .info file found."); // Verify common_test.print.css in a STYLE media="print" tag. $elements = $this->xpath('//style[@media=:media and contains(text(), :filename)]', array( ':media' => 'print', - ':filename' => 'tests/common_test.print.css', + ':filename' => 'tests/modules/common_test/common_test.print.css', )); $this->assertTrue(count($elements), "Stylesheet with media 'print' in module .info file found."); } @@ -767,23 +767,22 @@ class CommonCascadingStylesheetsTestCase extends DrupalWebTestCase { */ function testRenderOverride() { $system = drupal_get_path('module', 'system'); - $simpletest = drupal_get_path('module', 'simpletest'); drupal_add_css($system . '/system.base.css'); - drupal_add_css($simpletest . '/tests/system.base.css'); + drupal_add_css($system . '/tests/system.base.css'); // The dummy stylesheet should be the only one included. $styles = drupal_get_css(); - $this->assert(strpos($styles, $simpletest . '/tests/system.base.css') !== FALSE, t('The overriding CSS file is output.')); + $this->assert(strpos($styles, $system . '/tests/system.base.css') !== FALSE, t('The overriding CSS file is output.')); $this->assert(strpos($styles, $system . '/system.base.css') === FALSE, t('The overridden CSS file is not output.')); - drupal_add_css($simpletest . '/tests/system.base.css'); + drupal_add_css($system . '/tests/system.base.css'); drupal_add_css($system . '/system.base.css'); // The standard stylesheet should be the only one included. $styles = drupal_get_css(); $this->assert(strpos($styles, $system . '/system.base.css') !== FALSE, t('The overriding CSS file is output.')); - $this->assert(strpos($styles, $simpletest . '/tests/system.base.css') === FALSE, t('The overridden CSS file is not output.')); + $this->assert(strpos($styles, $system . '/tests/system.base.css') === FALSE, t('The overridden CSS file is not output.')); } /** @@ -2316,7 +2315,7 @@ class CommonDrupalParseInfoFileTestCase extends DrupalUnitTestCase { * Parse an example .info file an verify the results. */ function testParseInfoFile() { - $info_values = drupal_parse_info_file(drupal_get_path('module', 'simpletest') . '/tests/common_test_info.txt'); + $info_values = drupal_parse_info_file(drupal_get_path('module', 'system') . '/tests/common_test_info.txt'); $this->assertEqual($info_values['simple_string'], 'A simple string', t('Simple string value was parsed correctly.'), t('System')); $this->assertEqual($info_values['simple_constant'], WATCHDOG_INFO, t('Constant value was parsed correctly.'), t('System')); $this->assertEqual($info_values['double_colon'], 'dummyClassName::', t('Value containing double-colon was parsed correctly.'), t('System')); @@ -2346,14 +2345,14 @@ class CommonDrupalSystemListingTestCase extends DrupalWebTestCase { // with Drupal core, the copy in the core modules directory takes // precedence. 'drupal_system_listing_incompatible_test' => array( - 'core/modules/simpletest/tests', + 'core/modules/system/tests/modules', 'profiles/testing/modules', ), // When both copies of the module are compatible with Drupal core, the // copy in the profile directory takes precedence. 'drupal_system_listing_compatible_test' => array( 'profiles/testing/modules', - 'core/modules/simpletest/tests', + 'core/modules/system/tests/modules', ), ); diff --git a/core/modules/simpletest/tests/common_test_info.txt b/core/modules/system/tests/common_test_info.txt similarity index 100% rename from core/modules/simpletest/tests/common_test_info.txt rename to core/modules/system/tests/common_test_info.txt diff --git a/core/modules/simpletest/tests/error.test b/core/modules/system/tests/error.test similarity index 90% rename from core/modules/simpletest/tests/error.test rename to core/modules/system/tests/error.test index 8c5a8487255..ead3526f033 100644 --- a/core/modules/simpletest/tests/error.test +++ b/core/modules/system/tests/error.test @@ -24,19 +24,19 @@ class DrupalErrorHandlerUnitTest extends DrupalWebTestCase { '%type' => 'Notice', '!message' => 'Undefined variable: bananas', '%function' => 'error_test_generate_warnings()', - '%file' => drupal_realpath('core/modules/simpletest/tests/error_test.module'), + '%file' => drupal_get_path('module', 'error_test') . '/error_test.module', ); $error_warning = array( '%type' => 'Warning', '!message' => 'Division by zero', '%function' => 'error_test_generate_warnings()', - '%file' => drupal_realpath('core/modules/simpletest/tests/error_test.module'), + '%file' => drupal_get_path('module', 'error_test') . '/error_test.module', ); $error_user_notice = array( '%type' => 'User warning', '!message' => 'Drupal is awesome', '%function' => 'error_test_generate_warnings()', - '%file' => drupal_realpath('core/modules/simpletest/tests/error_test.module'), + '%file' => drupal_get_path('module', 'error_test') . '/error_test.module', ); // Set error reporting to collect notices. @@ -73,14 +73,14 @@ class DrupalErrorHandlerUnitTest extends DrupalWebTestCase { '!message' => 'Drupal is awesome', '%function' => 'error_test_trigger_exception()', '%line' => 57, - '%file' => drupal_realpath('core/modules/simpletest/tests/error_test.module'), + '%file' => drupal_get_path('module', 'error_test') . '/error_test.module', ); $error_pdo_exception = array( '%type' => 'PDOException', '!message' => 'SELECT * FROM bananas_are_awesome', '%function' => 'error_test_trigger_pdo_exception()', '%line' => 65, - '%file' => drupal_realpath('core/modules/simpletest/tests/error_test.module'), + '%file' => drupal_get_path('module', 'error_test') . '/error_test.module', ); $this->drupalGet('error-test/trigger-exception'); diff --git a/core/modules/simpletest/tests/file.test b/core/modules/system/tests/file.test similarity index 100% rename from core/modules/simpletest/tests/file.test rename to core/modules/system/tests/file.test diff --git a/core/modules/simpletest/tests/filetransfer.test b/core/modules/system/tests/filetransfer.test similarity index 100% rename from core/modules/simpletest/tests/filetransfer.test rename to core/modules/system/tests/filetransfer.test diff --git a/core/modules/simpletest/tests/form.test b/core/modules/system/tests/form.test similarity index 100% rename from core/modules/simpletest/tests/form.test rename to core/modules/system/tests/form.test diff --git a/core/modules/simpletest/tests/http.php b/core/modules/system/tests/http.php similarity index 89% rename from core/modules/simpletest/tests/http.php rename to core/modules/system/tests/http.php index 91985a63eed..2481d16b51e 100644 --- a/core/modules/simpletest/tests/http.php +++ b/core/modules/system/tests/http.php @@ -12,7 +12,7 @@ $is_http_mock = !empty($_SERVER['HTTPS']); $_SERVER['HTTPS'] = NULL; ini_set('session.cookie_secure', FALSE); foreach ($_SERVER as $key => $value) { - $_SERVER[$key] = str_replace('core/modules/simpletest/tests/http.php', 'index.php', $value); + $_SERVER[$key] = str_replace('core/modules/system/tests/http.php', 'index.php', $value); $_SERVER[$key] = str_replace('https://', 'http://', $_SERVER[$key]); } diff --git a/core/modules/simpletest/tests/https.php b/core/modules/system/tests/https.php similarity index 89% rename from core/modules/simpletest/tests/https.php rename to core/modules/system/tests/https.php index c342abcf773..3d07f0c8291 100644 --- a/core/modules/simpletest/tests/https.php +++ b/core/modules/system/tests/https.php @@ -11,7 +11,7 @@ $is_https_mock = empty($_SERVER['HTTPS']); // Change to https. $_SERVER['HTTPS'] = 'on'; foreach ($_SERVER as $key => $value) { - $_SERVER[$key] = str_replace('core/modules/simpletest/tests/https.php', 'index.php', $value); + $_SERVER[$key] = str_replace('core/modules/system/tests/https.php', 'index.php', $value); $_SERVER[$key] = str_replace('http://', 'https://', $_SERVER[$key]); } diff --git a/core/modules/simpletest/tests/image.test b/core/modules/system/tests/image.test similarity index 100% rename from core/modules/simpletest/tests/image.test rename to core/modules/system/tests/image.test diff --git a/core/modules/simpletest/tests/installer.test b/core/modules/system/tests/installer.test similarity index 100% rename from core/modules/simpletest/tests/installer.test rename to core/modules/system/tests/installer.test diff --git a/core/modules/simpletest/tests/lock.test b/core/modules/system/tests/lock.test similarity index 100% rename from core/modules/simpletest/tests/lock.test rename to core/modules/system/tests/lock.test diff --git a/core/modules/simpletest/tests/mail.test b/core/modules/system/tests/mail.test similarity index 100% rename from core/modules/simpletest/tests/mail.test rename to core/modules/system/tests/mail.test diff --git a/core/modules/simpletest/tests/menu.test b/core/modules/system/tests/menu.test similarity index 100% rename from core/modules/simpletest/tests/menu.test rename to core/modules/system/tests/menu.test diff --git a/core/modules/simpletest/tests/module.test b/core/modules/system/tests/module.test similarity index 100% rename from core/modules/simpletest/tests/module.test rename to core/modules/system/tests/module.test diff --git a/core/modules/simpletest/tests/actions_loop_test.info b/core/modules/system/tests/modules/actions_loop_test/actions_loop_test.info similarity index 100% rename from core/modules/simpletest/tests/actions_loop_test.info rename to core/modules/system/tests/modules/actions_loop_test/actions_loop_test.info diff --git a/core/modules/simpletest/tests/actions_loop_test.install b/core/modules/system/tests/modules/actions_loop_test/actions_loop_test.install similarity index 100% rename from core/modules/simpletest/tests/actions_loop_test.install rename to core/modules/system/tests/modules/actions_loop_test/actions_loop_test.install diff --git a/core/modules/simpletest/tests/actions_loop_test.module b/core/modules/system/tests/modules/actions_loop_test/actions_loop_test.module similarity index 100% rename from core/modules/simpletest/tests/actions_loop_test.module rename to core/modules/system/tests/modules/actions_loop_test/actions_loop_test.module diff --git a/core/modules/simpletest/tests/ajax_forms_test.info b/core/modules/system/tests/modules/ajax_forms_test/ajax_forms_test.info similarity index 100% rename from core/modules/simpletest/tests/ajax_forms_test.info rename to core/modules/system/tests/modules/ajax_forms_test/ajax_forms_test.info diff --git a/core/modules/simpletest/tests/ajax_forms_test.module b/core/modules/system/tests/modules/ajax_forms_test/ajax_forms_test.module similarity index 100% rename from core/modules/simpletest/tests/ajax_forms_test.module rename to core/modules/system/tests/modules/ajax_forms_test/ajax_forms_test.module diff --git a/core/modules/simpletest/tests/ajax_test.info b/core/modules/system/tests/modules/ajax_test/ajax_test.info similarity index 100% rename from core/modules/simpletest/tests/ajax_test.info rename to core/modules/system/tests/modules/ajax_test/ajax_test.info diff --git a/core/modules/simpletest/tests/ajax_test.module b/core/modules/system/tests/modules/ajax_test/ajax_test.module similarity index 94% rename from core/modules/simpletest/tests/ajax_test.module rename to core/modules/system/tests/modules/ajax_test/ajax_test.module index 21be019422a..27b3161847c 100644 --- a/core/modules/simpletest/tests/ajax_test.module +++ b/core/modules/system/tests/modules/ajax_test/ajax_test.module @@ -35,7 +35,7 @@ function ajax_test_menu() { * Implements hook_system_theme_info(). */ function ajax_test_system_theme_info() { - $themes['test_theme'] = drupal_get_path('module', 'ajax_test') . '/themes/test_theme/test_theme.info'; + $themes['test_theme'] = drupal_get_path('module', 'system') . '/tests/themes/test_theme/test_theme.info'; return $themes; } diff --git a/core/modules/simpletest/tests/batch_test.callbacks.inc b/core/modules/system/tests/modules/batch_test/batch_test.callbacks.inc similarity index 100% rename from core/modules/simpletest/tests/batch_test.callbacks.inc rename to core/modules/system/tests/modules/batch_test/batch_test.callbacks.inc diff --git a/core/modules/simpletest/tests/batch_test.info b/core/modules/system/tests/modules/batch_test/batch_test.info similarity index 100% rename from core/modules/simpletest/tests/batch_test.info rename to core/modules/system/tests/modules/batch_test/batch_test.info diff --git a/core/modules/simpletest/tests/batch_test.module b/core/modules/system/tests/modules/batch_test/batch_test.module similarity index 100% rename from core/modules/simpletest/tests/batch_test.module rename to core/modules/system/tests/modules/batch_test/batch_test.module diff --git a/core/modules/simpletest/tests/common_test.css b/core/modules/system/tests/modules/common_test/common_test.css similarity index 100% rename from core/modules/simpletest/tests/common_test.css rename to core/modules/system/tests/modules/common_test/common_test.css diff --git a/core/modules/simpletest/tests/common_test.info b/core/modules/system/tests/modules/common_test/common_test.info similarity index 100% rename from core/modules/simpletest/tests/common_test.info rename to core/modules/system/tests/modules/common_test/common_test.info diff --git a/core/modules/simpletest/tests/common_test.module b/core/modules/system/tests/modules/common_test/common_test.module similarity index 100% rename from core/modules/simpletest/tests/common_test.module rename to core/modules/system/tests/modules/common_test/common_test.module diff --git a/core/modules/simpletest/tests/common_test.print.css b/core/modules/system/tests/modules/common_test/common_test.print.css similarity index 100% rename from core/modules/simpletest/tests/common_test.print.css rename to core/modules/system/tests/modules/common_test/common_test.print.css diff --git a/core/modules/simpletest/tests/common_test_cron_helper.info b/core/modules/system/tests/modules/common_test_cron_helper/common_test_cron_helper.info similarity index 100% rename from core/modules/simpletest/tests/common_test_cron_helper.info rename to core/modules/system/tests/modules/common_test_cron_helper/common_test_cron_helper.info diff --git a/core/modules/simpletest/tests/common_test_cron_helper.module b/core/modules/system/tests/modules/common_test_cron_helper/common_test_cron_helper.module similarity index 100% rename from core/modules/simpletest/tests/common_test_cron_helper.module rename to core/modules/system/tests/modules/common_test_cron_helper/common_test_cron_helper.module diff --git a/core/modules/simpletest/tests/config_upgrade/config/config.test.xml b/core/modules/system/tests/modules/config_upgrade/config/config.test.xml similarity index 100% rename from core/modules/simpletest/tests/config_upgrade/config/config.test.xml rename to core/modules/system/tests/modules/config_upgrade/config/config.test.xml diff --git a/core/modules/simpletest/tests/config_upgrade/config_upgrade.info b/core/modules/system/tests/modules/config_upgrade/config_upgrade.info similarity index 100% rename from core/modules/simpletest/tests/config_upgrade/config_upgrade.info rename to core/modules/system/tests/modules/config_upgrade/config_upgrade.info diff --git a/core/modules/simpletest/tests/config_upgrade/config_upgrade.module b/core/modules/system/tests/modules/config_upgrade/config_upgrade.module similarity index 100% rename from core/modules/simpletest/tests/config_upgrade/config_upgrade.module rename to core/modules/system/tests/modules/config_upgrade/config_upgrade.module diff --git a/core/modules/simpletest/tests/database_test.info b/core/modules/system/tests/modules/database_test/database_test.info similarity index 100% rename from core/modules/simpletest/tests/database_test.info rename to core/modules/system/tests/modules/database_test/database_test.info diff --git a/core/modules/simpletest/tests/database_test.install b/core/modules/system/tests/modules/database_test/database_test.install similarity index 99% rename from core/modules/simpletest/tests/database_test.install rename to core/modules/system/tests/modules/database_test/database_test.install index 4dce2b19af8..867d8132390 100644 --- a/core/modules/simpletest/tests/database_test.install +++ b/core/modules/system/tests/modules/database_test/database_test.install @@ -28,6 +28,7 @@ function database_test_schema() { 'length' => 255, 'not null' => TRUE, 'default' => '', + 'binary' => TRUE, ), 'age' => array( 'description' => "The person's age", diff --git a/core/modules/simpletest/tests/database_test.module b/core/modules/system/tests/modules/database_test/database_test.module similarity index 100% rename from core/modules/simpletest/tests/database_test.module rename to core/modules/system/tests/modules/database_test/database_test.module diff --git a/core/modules/simpletest/tests/database_test.test b/core/modules/system/tests/modules/database_test/database_test.test similarity index 99% rename from core/modules/simpletest/tests/database_test.test rename to core/modules/system/tests/modules/database_test/database_test.test index 04181b337dd..bec0c162494 100644 --- a/core/modules/simpletest/tests/database_test.test +++ b/core/modules/system/tests/modules/database_test/database_test.test @@ -3133,6 +3133,39 @@ class DatabaseBasicSyntaxTestCase extends DatabaseTestCase { } } +/** + * Test case sensitivity handling. + */ +class DatabaseCaseSensitivityTestCase extends DatabaseTestCase { + public static function getInfo() { + return array( + 'name' => 'Case sensitivity', + 'description' => 'Test handling case sensitive collation.', + 'group' => 'Database', + ); + } + + /** + * Test BINARY collation in MySQL. + */ + function testCaseSensitiveInsert() { + $num_records_before = db_query('SELECT COUNT(*) FROM {test}')->fetchField(); + + $john = db_insert('test') + ->fields(array( + 'name' => 'john', // <- A record already exists with name 'John'. + 'age' => 2, + 'job' => 'Baby', + )) + ->execute(); + + $num_records_after = db_query('SELECT COUNT(*) FROM {test}')->fetchField(); + $this->assertIdentical($num_records_before + 1, (int) $num_records_after, t('Record inserts correctly.')); + $saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'john'))->fetchField(); + $this->assertIdentical($saved_age, '2', t('Can retrieve after inserting.')); + } +} + /** * Test invalid data handling. */ diff --git a/core/modules/simpletest/tests/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info b/core/modules/system/tests/modules/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info similarity index 100% rename from core/modules/simpletest/tests/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info rename to core/modules/system/tests/modules/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info diff --git a/core/modules/simpletest/tests/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.module b/core/modules/system/tests/modules/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.module similarity index 100% rename from core/modules/simpletest/tests/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.module rename to core/modules/system/tests/modules/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.module diff --git a/core/modules/simpletest/tests/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info b/core/modules/system/tests/modules/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info similarity index 100% rename from core/modules/simpletest/tests/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info rename to core/modules/system/tests/modules/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info diff --git a/core/modules/simpletest/tests/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.module b/core/modules/system/tests/modules/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.module similarity index 100% rename from core/modules/simpletest/tests/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.module rename to core/modules/system/tests/modules/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.module diff --git a/core/modules/simpletest/tests/error_test.info b/core/modules/system/tests/modules/error_test/error_test.info similarity index 100% rename from core/modules/simpletest/tests/error_test.info rename to core/modules/system/tests/modules/error_test/error_test.info diff --git a/core/modules/simpletest/tests/error_test.module b/core/modules/system/tests/modules/error_test/error_test.module similarity index 100% rename from core/modules/simpletest/tests/error_test.module rename to core/modules/system/tests/modules/error_test/error_test.module diff --git a/core/modules/simpletest/tests/file_test.info b/core/modules/system/tests/modules/file_test/file_test.info similarity index 100% rename from core/modules/simpletest/tests/file_test.info rename to core/modules/system/tests/modules/file_test/file_test.info diff --git a/core/modules/simpletest/tests/file_test.module b/core/modules/system/tests/modules/file_test/file_test.module similarity index 100% rename from core/modules/simpletest/tests/file_test.module rename to core/modules/system/tests/modules/file_test/file_test.module diff --git a/core/modules/simpletest/tests/filter_test.info b/core/modules/system/tests/modules/filter_test/filter_test.info similarity index 100% rename from core/modules/simpletest/tests/filter_test.info rename to core/modules/system/tests/modules/filter_test/filter_test.info diff --git a/core/modules/simpletest/tests/filter_test.module b/core/modules/system/tests/modules/filter_test/filter_test.module similarity index 100% rename from core/modules/simpletest/tests/filter_test.module rename to core/modules/system/tests/modules/filter_test/filter_test.module diff --git a/core/modules/simpletest/tests/form_test.file.inc b/core/modules/system/tests/modules/form_test/form_test.file.inc similarity index 100% rename from core/modules/simpletest/tests/form_test.file.inc rename to core/modules/system/tests/modules/form_test/form_test.file.inc diff --git a/core/modules/simpletest/tests/form_test.info b/core/modules/system/tests/modules/form_test/form_test.info similarity index 100% rename from core/modules/simpletest/tests/form_test.info rename to core/modules/system/tests/modules/form_test/form_test.info diff --git a/core/modules/simpletest/tests/form_test.module b/core/modules/system/tests/modules/form_test/form_test.module similarity index 99% rename from core/modules/simpletest/tests/form_test.module rename to core/modules/system/tests/modules/form_test/form_test.module index 01908b9db5d..a2a2815155a 100644 --- a/core/modules/simpletest/tests/form_test.module +++ b/core/modules/system/tests/modules/form_test/form_test.module @@ -1972,7 +1972,7 @@ function form_test_load_include_custom($form, &$form_state) { // Specify the include file and enable form caching. That way the form is // cached when it is submitted, but needs to find the specified submit handler // in the include. - // Filename is a bit weird here: modules/simpletest/tests/form_test.file.inc + // Filename is a bit weird here: modules/system/tests/form_test.file.inc form_load_include($form_state, 'inc', 'form_test', 'form_test.file'); $form_state['cache'] = TRUE; return $form; diff --git a/core/modules/simpletest/tests/image_test.info b/core/modules/system/tests/modules/image_test/image_test.info similarity index 100% rename from core/modules/simpletest/tests/image_test.info rename to core/modules/system/tests/modules/image_test/image_test.info diff --git a/core/modules/simpletest/tests/image_test.module b/core/modules/system/tests/modules/image_test/image_test.module similarity index 100% rename from core/modules/simpletest/tests/image_test.module rename to core/modules/system/tests/modules/image_test/image_test.module diff --git a/core/modules/simpletest/tests/menu_test.info b/core/modules/system/tests/modules/menu_test/menu_test.info similarity index 100% rename from core/modules/simpletest/tests/menu_test.info rename to core/modules/system/tests/modules/menu_test/menu_test.info diff --git a/core/modules/simpletest/tests/menu_test.module b/core/modules/system/tests/modules/menu_test/menu_test.module similarity index 100% rename from core/modules/simpletest/tests/menu_test.module rename to core/modules/system/tests/modules/menu_test/menu_test.module diff --git a/core/modules/simpletest/tests/module_autoload_test/lib/Drupal/module_autoload_test/SomeClass.php b/core/modules/system/tests/modules/module_autoload_test/lib/Drupal/module_autoload_test/SomeClass.php similarity index 100% rename from core/modules/simpletest/tests/module_autoload_test/lib/Drupal/module_autoload_test/SomeClass.php rename to core/modules/system/tests/modules/module_autoload_test/lib/Drupal/module_autoload_test/SomeClass.php diff --git a/core/modules/simpletest/tests/module_autoload_test/module_autoload_test.info b/core/modules/system/tests/modules/module_autoload_test/module_autoload_test.info similarity index 100% rename from core/modules/simpletest/tests/module_autoload_test/module_autoload_test.info rename to core/modules/system/tests/modules/module_autoload_test/module_autoload_test.info diff --git a/core/modules/simpletest/tests/module_autoload_test/module_autoload_test.module b/core/modules/system/tests/modules/module_autoload_test/module_autoload_test.module similarity index 100% rename from core/modules/simpletest/tests/module_autoload_test/module_autoload_test.module rename to core/modules/system/tests/modules/module_autoload_test/module_autoload_test.module diff --git a/core/modules/simpletest/tests/module_test.file.inc b/core/modules/system/tests/modules/module_test/module_test.file.inc similarity index 100% rename from core/modules/simpletest/tests/module_test.file.inc rename to core/modules/system/tests/modules/module_test/module_test.file.inc diff --git a/core/modules/simpletest/tests/module_test.info b/core/modules/system/tests/modules/module_test/module_test.info similarity index 100% rename from core/modules/simpletest/tests/module_test.info rename to core/modules/system/tests/modules/module_test/module_test.info diff --git a/core/modules/simpletest/tests/module_test.install b/core/modules/system/tests/modules/module_test/module_test.install similarity index 100% rename from core/modules/simpletest/tests/module_test.install rename to core/modules/system/tests/modules/module_test/module_test.install diff --git a/core/modules/simpletest/tests/module_test.module b/core/modules/system/tests/modules/module_test/module_test.module similarity index 100% rename from core/modules/simpletest/tests/module_test.module rename to core/modules/system/tests/modules/module_test/module_test.module diff --git a/core/modules/simpletest/tests/path_test.info b/core/modules/system/tests/modules/path_test/path_test.info similarity index 100% rename from core/modules/simpletest/tests/path_test.info rename to core/modules/system/tests/modules/path_test/path_test.info diff --git a/core/modules/simpletest/tests/path_test.module b/core/modules/system/tests/modules/path_test/path_test.module similarity index 100% rename from core/modules/simpletest/tests/path_test.module rename to core/modules/system/tests/modules/path_test/path_test.module diff --git a/core/modules/simpletest/tests/requirements1_test.info b/core/modules/system/tests/modules/requirements1_test/requirements1_test.info similarity index 100% rename from core/modules/simpletest/tests/requirements1_test.info rename to core/modules/system/tests/modules/requirements1_test/requirements1_test.info diff --git a/core/modules/simpletest/tests/requirements1_test.install b/core/modules/system/tests/modules/requirements1_test/requirements1_test.install similarity index 100% rename from core/modules/simpletest/tests/requirements1_test.install rename to core/modules/system/tests/modules/requirements1_test/requirements1_test.install diff --git a/core/modules/simpletest/tests/requirements1_test.module b/core/modules/system/tests/modules/requirements1_test/requirements1_test.module similarity index 100% rename from core/modules/simpletest/tests/requirements1_test.module rename to core/modules/system/tests/modules/requirements1_test/requirements1_test.module diff --git a/core/modules/simpletest/tests/requirements2_test.info b/core/modules/system/tests/modules/requirements2_test/requirements2_test.info similarity index 100% rename from core/modules/simpletest/tests/requirements2_test.info rename to core/modules/system/tests/modules/requirements2_test/requirements2_test.info diff --git a/core/modules/simpletest/tests/requirements2_test.module b/core/modules/system/tests/modules/requirements2_test/requirements2_test.module similarity index 100% rename from core/modules/simpletest/tests/requirements2_test.module rename to core/modules/system/tests/modules/requirements2_test/requirements2_test.module diff --git a/core/modules/simpletest/tests/session_test.info b/core/modules/system/tests/modules/session_test/session_test.info similarity index 100% rename from core/modules/simpletest/tests/session_test.info rename to core/modules/system/tests/modules/session_test/session_test.info diff --git a/core/modules/simpletest/tests/session_test.module b/core/modules/system/tests/modules/session_test/session_test.module similarity index 100% rename from core/modules/simpletest/tests/session_test.module rename to core/modules/system/tests/modules/session_test/session_test.module diff --git a/core/modules/simpletest/tests/system_dependencies_test.info b/core/modules/system/tests/modules/system_dependencies_test/system_dependencies_test.info similarity index 100% rename from core/modules/simpletest/tests/system_dependencies_test.info rename to core/modules/system/tests/modules/system_dependencies_test/system_dependencies_test.info diff --git a/core/modules/simpletest/tests/system_dependencies_test.module b/core/modules/system/tests/modules/system_dependencies_test/system_dependencies_test.module similarity index 100% rename from core/modules/simpletest/tests/system_dependencies_test.module rename to core/modules/system/tests/modules/system_dependencies_test/system_dependencies_test.module diff --git a/core/modules/simpletest/tests/system_incompatible_core_version_dependencies_test.info b/core/modules/system/tests/modules/system_incompatible_core_version_dependencies_test/system_incompatible_core_version_dependencies_test.info similarity index 100% rename from core/modules/simpletest/tests/system_incompatible_core_version_dependencies_test.info rename to core/modules/system/tests/modules/system_incompatible_core_version_dependencies_test/system_incompatible_core_version_dependencies_test.info diff --git a/core/modules/simpletest/tests/system_incompatible_core_version_dependencies_test.module b/core/modules/system/tests/modules/system_incompatible_core_version_dependencies_test/system_incompatible_core_version_dependencies_test.module similarity index 100% rename from core/modules/simpletest/tests/system_incompatible_core_version_dependencies_test.module rename to core/modules/system/tests/modules/system_incompatible_core_version_dependencies_test/system_incompatible_core_version_dependencies_test.module diff --git a/core/modules/simpletest/tests/system_incompatible_core_version_test.info b/core/modules/system/tests/modules/system_incompatible_core_version_test/system_incompatible_core_version_test.info similarity index 100% rename from core/modules/simpletest/tests/system_incompatible_core_version_test.info rename to core/modules/system/tests/modules/system_incompatible_core_version_test/system_incompatible_core_version_test.info diff --git a/core/modules/simpletest/tests/system_incompatible_core_version_test.module b/core/modules/system/tests/modules/system_incompatible_core_version_test/system_incompatible_core_version_test.module similarity index 100% rename from core/modules/simpletest/tests/system_incompatible_core_version_test.module rename to core/modules/system/tests/modules/system_incompatible_core_version_test/system_incompatible_core_version_test.module diff --git a/core/modules/simpletest/tests/system_incompatible_module_version_dependencies_test.info b/core/modules/system/tests/modules/system_incompatible_module_version_dependencies_test/system_incompatible_module_version_dependencies_test.info similarity index 100% rename from core/modules/simpletest/tests/system_incompatible_module_version_dependencies_test.info rename to core/modules/system/tests/modules/system_incompatible_module_version_dependencies_test/system_incompatible_module_version_dependencies_test.info diff --git a/core/modules/simpletest/tests/system_incompatible_module_version_dependencies_test.module b/core/modules/system/tests/modules/system_incompatible_module_version_dependencies_test/system_incompatible_module_version_dependencies_test.module similarity index 100% rename from core/modules/simpletest/tests/system_incompatible_module_version_dependencies_test.module rename to core/modules/system/tests/modules/system_incompatible_module_version_dependencies_test/system_incompatible_module_version_dependencies_test.module diff --git a/core/modules/simpletest/tests/system_incompatible_module_version_test.info b/core/modules/system/tests/modules/system_incompatible_module_version_test/system_incompatible_module_version_test.info similarity index 100% rename from core/modules/simpletest/tests/system_incompatible_module_version_test.info rename to core/modules/system/tests/modules/system_incompatible_module_version_test/system_incompatible_module_version_test.info diff --git a/core/modules/simpletest/tests/system_incompatible_module_version_test.module b/core/modules/system/tests/modules/system_incompatible_module_version_test/system_incompatible_module_version_test.module similarity index 100% rename from core/modules/simpletest/tests/system_incompatible_module_version_test.module rename to core/modules/system/tests/modules/system_incompatible_module_version_test/system_incompatible_module_version_test.module diff --git a/core/modules/simpletest/tests/system_test.info b/core/modules/system/tests/modules/system_test/system_test.info similarity index 100% rename from core/modules/simpletest/tests/system_test.info rename to core/modules/system/tests/modules/system_test/system_test.info diff --git a/core/modules/simpletest/tests/system_test.module b/core/modules/system/tests/modules/system_test/system_test.module similarity index 100% rename from core/modules/simpletest/tests/system_test.module rename to core/modules/system/tests/modules/system_test/system_test.module diff --git a/core/modules/simpletest/tests/taxonomy_test.info b/core/modules/system/tests/modules/taxonomy_test/taxonomy_test.info similarity index 100% rename from core/modules/simpletest/tests/taxonomy_test.info rename to core/modules/system/tests/modules/taxonomy_test/taxonomy_test.info diff --git a/core/modules/simpletest/tests/taxonomy_test.install b/core/modules/system/tests/modules/taxonomy_test/taxonomy_test.install similarity index 100% rename from core/modules/simpletest/tests/taxonomy_test.install rename to core/modules/system/tests/modules/taxonomy_test/taxonomy_test.install diff --git a/core/modules/simpletest/tests/taxonomy_test.module b/core/modules/system/tests/modules/taxonomy_test/taxonomy_test.module similarity index 100% rename from core/modules/simpletest/tests/taxonomy_test.module rename to core/modules/system/tests/modules/taxonomy_test/taxonomy_test.module diff --git a/core/modules/simpletest/tests/theme_test.inc b/core/modules/system/tests/modules/theme_test/theme_test.inc similarity index 100% rename from core/modules/simpletest/tests/theme_test.inc rename to core/modules/system/tests/modules/theme_test/theme_test.inc diff --git a/core/modules/simpletest/tests/theme_test.info b/core/modules/system/tests/modules/theme_test/theme_test.info similarity index 100% rename from core/modules/simpletest/tests/theme_test.info rename to core/modules/system/tests/modules/theme_test/theme_test.info diff --git a/core/modules/simpletest/tests/theme_test.module b/core/modules/system/tests/modules/theme_test/theme_test.module similarity index 91% rename from core/modules/simpletest/tests/theme_test.module rename to core/modules/system/tests/modules/theme_test/theme_test.module index f6065f22497..f2cd4a01df5 100644 --- a/core/modules/simpletest/tests/theme_test.module +++ b/core/modules/system/tests/modules/theme_test/theme_test.module @@ -21,9 +21,9 @@ function theme_test_theme($existing, $type, $theme, $path) { * Implements hook_system_theme_info(). */ function theme_test_system_theme_info() { - $themes['test_theme'] = drupal_get_path('module', 'theme_test') . '/themes/test_theme/test_theme.info'; - $themes['test_basetheme'] = drupal_get_path('module', 'theme_test') . '/themes/test_basetheme/test_basetheme.info'; - $themes['test_subtheme'] = drupal_get_path('module', 'theme_test') . '/themes/test_subtheme/test_subtheme.info'; + $themes['test_theme'] = drupal_get_path('module', 'system') . '/tests/themes/test_theme/test_theme.info'; + $themes['test_basetheme'] = drupal_get_path('module', 'system') . '/tests/themes/test_basetheme/test_basetheme.info'; + $themes['test_subtheme'] = drupal_get_path('module', 'system') . '/tests/themes/test_subtheme/test_subtheme.info'; return $themes; } diff --git a/core/modules/simpletest/tests/theme_test.template_test.tpl.php b/core/modules/system/tests/modules/theme_test/theme_test.template_test.tpl.php similarity index 100% rename from core/modules/simpletest/tests/theme_test.template_test.tpl.php rename to core/modules/system/tests/modules/theme_test/theme_test.template_test.tpl.php diff --git a/core/modules/simpletest/tests/update_script_test.info b/core/modules/system/tests/modules/update_script_test/update_script_test.info similarity index 100% rename from core/modules/simpletest/tests/update_script_test.info rename to core/modules/system/tests/modules/update_script_test/update_script_test.info diff --git a/core/modules/simpletest/tests/update_script_test.install b/core/modules/system/tests/modules/update_script_test/update_script_test.install similarity index 100% rename from core/modules/simpletest/tests/update_script_test.install rename to core/modules/system/tests/modules/update_script_test/update_script_test.install diff --git a/core/modules/simpletest/tests/update_script_test.module b/core/modules/system/tests/modules/update_script_test/update_script_test.module similarity index 100% rename from core/modules/simpletest/tests/update_script_test.module rename to core/modules/system/tests/modules/update_script_test/update_script_test.module diff --git a/core/modules/simpletest/tests/update_test_1.info b/core/modules/system/tests/modules/update_test_1/update_test_1.info similarity index 100% rename from core/modules/simpletest/tests/update_test_1.info rename to core/modules/system/tests/modules/update_test_1/update_test_1.info diff --git a/core/modules/simpletest/tests/update_test_1.install b/core/modules/system/tests/modules/update_test_1/update_test_1.install similarity index 100% rename from core/modules/simpletest/tests/update_test_1.install rename to core/modules/system/tests/modules/update_test_1/update_test_1.install diff --git a/core/modules/simpletest/tests/update_test_1.module b/core/modules/system/tests/modules/update_test_1/update_test_1.module similarity index 100% rename from core/modules/simpletest/tests/update_test_1.module rename to core/modules/system/tests/modules/update_test_1/update_test_1.module diff --git a/core/modules/simpletest/tests/update_test_2.info b/core/modules/system/tests/modules/update_test_2/update_test_2.info similarity index 100% rename from core/modules/simpletest/tests/update_test_2.info rename to core/modules/system/tests/modules/update_test_2/update_test_2.info diff --git a/core/modules/simpletest/tests/update_test_2.install b/core/modules/system/tests/modules/update_test_2/update_test_2.install similarity index 100% rename from core/modules/simpletest/tests/update_test_2.install rename to core/modules/system/tests/modules/update_test_2/update_test_2.install diff --git a/core/modules/simpletest/tests/update_test_2.module b/core/modules/system/tests/modules/update_test_2/update_test_2.module similarity index 100% rename from core/modules/simpletest/tests/update_test_2.module rename to core/modules/system/tests/modules/update_test_2/update_test_2.module diff --git a/core/modules/simpletest/tests/update_test_3.info b/core/modules/system/tests/modules/update_test_3/update_test_3.info similarity index 100% rename from core/modules/simpletest/tests/update_test_3.info rename to core/modules/system/tests/modules/update_test_3/update_test_3.info diff --git a/core/modules/simpletest/tests/update_test_3.install b/core/modules/system/tests/modules/update_test_3/update_test_3.install similarity index 100% rename from core/modules/simpletest/tests/update_test_3.install rename to core/modules/system/tests/modules/update_test_3/update_test_3.install diff --git a/core/modules/simpletest/tests/update_test_3.module b/core/modules/system/tests/modules/update_test_3/update_test_3.module similarity index 100% rename from core/modules/simpletest/tests/update_test_3.module rename to core/modules/system/tests/modules/update_test_3/update_test_3.module diff --git a/core/modules/simpletest/tests/url_alter_test.info b/core/modules/system/tests/modules/url_alter_test/url_alter_test.info similarity index 100% rename from core/modules/simpletest/tests/url_alter_test.info rename to core/modules/system/tests/modules/url_alter_test/url_alter_test.info diff --git a/core/modules/simpletest/tests/url_alter_test.install b/core/modules/system/tests/modules/url_alter_test/url_alter_test.install similarity index 100% rename from core/modules/simpletest/tests/url_alter_test.install rename to core/modules/system/tests/modules/url_alter_test/url_alter_test.install diff --git a/core/modules/simpletest/tests/url_alter_test.module b/core/modules/system/tests/modules/url_alter_test/url_alter_test.module similarity index 100% rename from core/modules/simpletest/tests/url_alter_test.module rename to core/modules/system/tests/modules/url_alter_test/url_alter_test.module diff --git a/core/modules/simpletest/tests/xmlrpc_test.info b/core/modules/system/tests/modules/xmlrpc_test/xmlrpc_test.info similarity index 100% rename from core/modules/simpletest/tests/xmlrpc_test.info rename to core/modules/system/tests/modules/xmlrpc_test/xmlrpc_test.info diff --git a/core/modules/simpletest/tests/xmlrpc_test.module b/core/modules/system/tests/modules/xmlrpc_test/xmlrpc_test.module similarity index 100% rename from core/modules/simpletest/tests/xmlrpc_test.module rename to core/modules/system/tests/modules/xmlrpc_test/xmlrpc_test.module diff --git a/core/modules/simpletest/tests/pager.test b/core/modules/system/tests/pager.test similarity index 100% rename from core/modules/simpletest/tests/pager.test rename to core/modules/system/tests/pager.test diff --git a/core/modules/simpletest/tests/password.test b/core/modules/system/tests/password.test similarity index 100% rename from core/modules/simpletest/tests/password.test rename to core/modules/system/tests/password.test diff --git a/core/modules/simpletest/tests/path.test b/core/modules/system/tests/path.test similarity index 100% rename from core/modules/simpletest/tests/path.test rename to core/modules/system/tests/path.test diff --git a/core/modules/simpletest/tests/queue.test b/core/modules/system/tests/queue.test similarity index 100% rename from core/modules/simpletest/tests/queue.test rename to core/modules/system/tests/queue.test diff --git a/core/modules/simpletest/tests/registry.test b/core/modules/system/tests/registry.test similarity index 100% rename from core/modules/simpletest/tests/registry.test rename to core/modules/system/tests/registry.test diff --git a/core/modules/simpletest/tests/schema.test b/core/modules/system/tests/schema.test similarity index 100% rename from core/modules/simpletest/tests/schema.test rename to core/modules/system/tests/schema.test diff --git a/core/modules/simpletest/tests/session.test b/core/modules/system/tests/session.test similarity index 99% rename from core/modules/simpletest/tests/session.test rename to core/modules/system/tests/session.test index 6303ca5b21b..017a8babffe 100644 --- a/core/modules/simpletest/tests/session.test +++ b/core/modules/system/tests/session.test @@ -513,7 +513,7 @@ class SessionHttpsTestCase extends DrupalWebTestCase { */ protected function httpsUrl($url) { global $base_url; - return $base_url . '/core/modules/simpletest/tests/https.php?q=' . $url; + return $base_url . '/core/modules/system/tests/https.php?q=' . $url; } /** @@ -527,7 +527,7 @@ class SessionHttpsTestCase extends DrupalWebTestCase { */ protected function httpUrl($url) { global $base_url; - return $base_url . '/core/modules/simpletest/tests/http.php?q=' . $url; + return $base_url . '/core/modules/system/tests/http.php?q=' . $url; } } diff --git a/core/modules/simpletest/tests/symfony.test b/core/modules/system/tests/symfony.test similarity index 100% rename from core/modules/simpletest/tests/symfony.test rename to core/modules/system/tests/symfony.test diff --git a/core/modules/simpletest/tests/system.base.css b/core/modules/system/tests/system.base.css similarity index 100% rename from core/modules/simpletest/tests/system.base.css rename to core/modules/system/tests/system.base.css diff --git a/core/modules/simpletest/tests/tablesort.test b/core/modules/system/tests/tablesort.test similarity index 100% rename from core/modules/simpletest/tests/tablesort.test rename to core/modules/system/tests/tablesort.test diff --git a/core/modules/simpletest/tests/theme.test b/core/modules/system/tests/theme.test similarity index 100% rename from core/modules/simpletest/tests/theme.test rename to core/modules/system/tests/theme.test diff --git a/core/modules/simpletest/tests/themes/test_basetheme/test_basetheme.info b/core/modules/system/tests/themes/test_basetheme/test_basetheme.info similarity index 100% rename from core/modules/simpletest/tests/themes/test_basetheme/test_basetheme.info rename to core/modules/system/tests/themes/test_basetheme/test_basetheme.info diff --git a/core/modules/simpletest/tests/themes/test_subtheme/test_subtheme.info b/core/modules/system/tests/themes/test_subtheme/test_subtheme.info similarity index 100% rename from core/modules/simpletest/tests/themes/test_subtheme/test_subtheme.info rename to core/modules/system/tests/themes/test_subtheme/test_subtheme.info diff --git a/core/modules/simpletest/tests/themes/test_theme/template.php b/core/modules/system/tests/themes/test_theme/template.php similarity index 100% rename from core/modules/simpletest/tests/themes/test_theme/template.php rename to core/modules/system/tests/themes/test_theme/template.php diff --git a/core/modules/simpletest/tests/themes/test_theme/test_theme.info b/core/modules/system/tests/themes/test_theme/test_theme.info similarity index 100% rename from core/modules/simpletest/tests/themes/test_theme/test_theme.info rename to core/modules/system/tests/themes/test_theme/test_theme.info diff --git a/core/modules/simpletest/tests/themes/test_theme/theme_test.template_test.tpl.php b/core/modules/system/tests/themes/test_theme/theme_test.template_test.tpl.php similarity index 100% rename from core/modules/simpletest/tests/themes/test_theme/theme_test.template_test.tpl.php rename to core/modules/system/tests/themes/test_theme/theme_test.template_test.tpl.php diff --git a/core/modules/simpletest/tests/unicode.test b/core/modules/system/tests/unicode.test similarity index 100% rename from core/modules/simpletest/tests/unicode.test rename to core/modules/system/tests/unicode.test diff --git a/core/modules/simpletest/tests/update.test b/core/modules/system/tests/update.test similarity index 100% rename from core/modules/simpletest/tests/update.test rename to core/modules/system/tests/update.test diff --git a/core/modules/simpletest/tests/upgrade/drupal-7.bare.database.php.gz b/core/modules/system/tests/upgrade/drupal-7.bare.database.php.gz similarity index 100% rename from core/modules/simpletest/tests/upgrade/drupal-7.bare.database.php.gz rename to core/modules/system/tests/upgrade/drupal-7.bare.database.php.gz diff --git a/core/modules/simpletest/tests/upgrade/drupal-7.filled.database.php.gz b/core/modules/system/tests/upgrade/drupal-7.filled.database.php.gz similarity index 100% rename from core/modules/simpletest/tests/upgrade/drupal-7.filled.database.php.gz rename to core/modules/system/tests/upgrade/drupal-7.filled.database.php.gz diff --git a/core/modules/simpletest/tests/upgrade/drupal-7.language.database.php b/core/modules/system/tests/upgrade/drupal-7.language.database.php similarity index 100% rename from core/modules/simpletest/tests/upgrade/drupal-7.language.database.php rename to core/modules/system/tests/upgrade/drupal-7.language.database.php diff --git a/core/modules/simpletest/tests/upgrade/upgrade.language.test b/core/modules/system/tests/upgrade/upgrade.language.test similarity index 97% rename from core/modules/simpletest/tests/upgrade/upgrade.language.test rename to core/modules/system/tests/upgrade/upgrade.language.test index bcf73a19827..e473c631cf2 100644 --- a/core/modules/simpletest/tests/upgrade/upgrade.language.test +++ b/core/modules/system/tests/upgrade/upgrade.language.test @@ -22,8 +22,8 @@ class LanguageUpgradePathTestCase extends UpgradePathTestCase { public function setUp() { // Path to the database dump files. $this->databaseDumpFiles = array( - drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-7.filled.database.php.gz', - drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-7.language.database.php', + drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.filled.database.php.gz', + drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.language.database.php', ); parent::setUp(); } diff --git a/core/modules/simpletest/tests/upgrade/upgrade.test b/core/modules/system/tests/upgrade/upgrade.test similarity index 100% rename from core/modules/simpletest/tests/upgrade/upgrade.test rename to core/modules/system/tests/upgrade/upgrade.test diff --git a/core/modules/simpletest/tests/upgrade/upgrade_bare.test b/core/modules/system/tests/upgrade/upgrade_bare.test similarity index 89% rename from core/modules/simpletest/tests/upgrade/upgrade_bare.test rename to core/modules/system/tests/upgrade/upgrade_bare.test index f507aea56cc..71553d3ec63 100644 --- a/core/modules/simpletest/tests/upgrade/upgrade_bare.test +++ b/core/modules/system/tests/upgrade/upgrade_bare.test @@ -17,7 +17,7 @@ class BareUpgradePathTestCase extends UpgradePathTestCase { public function setUp() { // Path to the database dump. $this->databaseDumpFiles = array( - drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-7.bare.database.php.gz', + drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.bare.database.php.gz', ); parent::setUp(); } diff --git a/core/modules/simpletest/tests/upgrade/upgrade_filled.test b/core/modules/system/tests/upgrade/upgrade_filled.test similarity index 87% rename from core/modules/simpletest/tests/upgrade/upgrade_filled.test rename to core/modules/system/tests/upgrade/upgrade_filled.test index 9b17bda4caa..947d83078ef 100644 --- a/core/modules/simpletest/tests/upgrade/upgrade_filled.test +++ b/core/modules/system/tests/upgrade/upgrade_filled.test @@ -17,7 +17,7 @@ class FilledUpgradePathTestCase extends UpgradePathTestCase { public function setUp() { // Path to the database dump. $this->databaseDumpFiles = array( - drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-7.filled.database.php.gz', + drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.filled.database.php.gz', ); parent::setUp(); } diff --git a/core/modules/simpletest/tests/uuid.test b/core/modules/system/tests/uuid.test similarity index 100% rename from core/modules/simpletest/tests/uuid.test rename to core/modules/system/tests/uuid.test diff --git a/core/modules/simpletest/tests/xmlrpc.test b/core/modules/system/tests/xmlrpc.test similarity index 100% rename from core/modules/simpletest/tests/xmlrpc.test rename to core/modules/system/tests/xmlrpc.test diff --git a/core/modules/update/tests/aaa_update_test.info b/core/modules/update/tests/modules/aaa_update_test/aaa_update_test.info similarity index 100% rename from core/modules/update/tests/aaa_update_test.info rename to core/modules/update/tests/modules/aaa_update_test/aaa_update_test.info diff --git a/core/modules/update/tests/aaa_update_test.module b/core/modules/update/tests/modules/aaa_update_test/aaa_update_test.module similarity index 100% rename from core/modules/update/tests/aaa_update_test.module rename to core/modules/update/tests/modules/aaa_update_test/aaa_update_test.module diff --git a/core/modules/update/tests/bbb_update_test.info b/core/modules/update/tests/modules/bbb_update_test/bbb_update_test.info similarity index 100% rename from core/modules/update/tests/bbb_update_test.info rename to core/modules/update/tests/modules/bbb_update_test/bbb_update_test.info diff --git a/core/modules/update/tests/bbb_update_test.module b/core/modules/update/tests/modules/bbb_update_test/bbb_update_test.module similarity index 100% rename from core/modules/update/tests/bbb_update_test.module rename to core/modules/update/tests/modules/bbb_update_test/bbb_update_test.module diff --git a/core/modules/update/tests/ccc_update_test.info b/core/modules/update/tests/modules/ccc_update_test/ccc_update_test.info similarity index 100% rename from core/modules/update/tests/ccc_update_test.info rename to core/modules/update/tests/modules/ccc_update_test/ccc_update_test.info diff --git a/core/modules/update/tests/ccc_update_test.module b/core/modules/update/tests/modules/ccc_update_test/ccc_update_test.module similarity index 100% rename from core/modules/update/tests/ccc_update_test.module rename to core/modules/update/tests/modules/ccc_update_test/ccc_update_test.module diff --git a/core/modules/update/tests/aaa_update_test.1_0.xml b/core/modules/update/tests/modules/update_test/aaa_update_test.1_0.xml similarity index 100% rename from core/modules/update/tests/aaa_update_test.1_0.xml rename to core/modules/update/tests/modules/update_test/aaa_update_test.1_0.xml diff --git a/core/modules/update/tests/aaa_update_test.no-releases.xml b/core/modules/update/tests/modules/update_test/aaa_update_test.no-releases.xml similarity index 100% rename from core/modules/update/tests/aaa_update_test.no-releases.xml rename to core/modules/update/tests/modules/update_test/aaa_update_test.no-releases.xml diff --git a/core/modules/update/tests/bbb_update_test.1_0.xml b/core/modules/update/tests/modules/update_test/bbb_update_test.1_0.xml similarity index 100% rename from core/modules/update/tests/bbb_update_test.1_0.xml rename to core/modules/update/tests/modules/update_test/bbb_update_test.1_0.xml diff --git a/core/modules/update/tests/ccc_update_test.1_0.xml b/core/modules/update/tests/modules/update_test/ccc_update_test.1_0.xml similarity index 100% rename from core/modules/update/tests/ccc_update_test.1_0.xml rename to core/modules/update/tests/modules/update_test/ccc_update_test.1_0.xml diff --git a/core/modules/update/tests/drupal.0.xml b/core/modules/update/tests/modules/update_test/drupal.0.xml similarity index 100% rename from core/modules/update/tests/drupal.0.xml rename to core/modules/update/tests/modules/update_test/drupal.0.xml diff --git a/core/modules/update/tests/drupal.1.xml b/core/modules/update/tests/modules/update_test/drupal.1.xml similarity index 100% rename from core/modules/update/tests/drupal.1.xml rename to core/modules/update/tests/modules/update_test/drupal.1.xml diff --git a/core/modules/update/tests/drupal.2-sec.xml b/core/modules/update/tests/modules/update_test/drupal.2-sec.xml similarity index 100% rename from core/modules/update/tests/drupal.2-sec.xml rename to core/modules/update/tests/modules/update_test/drupal.2-sec.xml diff --git a/core/modules/update/tests/drupal.dev.xml b/core/modules/update/tests/modules/update_test/drupal.dev.xml similarity index 100% rename from core/modules/update/tests/drupal.dev.xml rename to core/modules/update/tests/modules/update_test/drupal.dev.xml diff --git a/core/modules/update/tests/update_test.info b/core/modules/update/tests/modules/update_test/update_test.info similarity index 100% rename from core/modules/update/tests/update_test.info rename to core/modules/update/tests/modules/update_test/update_test.info diff --git a/core/modules/update/tests/update_test.module b/core/modules/update/tests/modules/update_test/update_test.module similarity index 97% rename from core/modules/update/tests/update_test.module rename to core/modules/update/tests/modules/update_test/update_test.module index 312a6dddeba..ff5aad5c2f5 100644 --- a/core/modules/update/tests/update_test.module +++ b/core/modules/update/tests/modules/update_test/update_test.module @@ -4,8 +4,8 @@ * Implements hook_system_theme_info(). */ function update_test_system_theme_info() { - $themes['update_test_basetheme'] = drupal_get_path('module', 'update_test') . '/themes/update_test_basetheme/update_test_basetheme.info'; - $themes['update_test_subtheme'] = drupal_get_path('module', 'update_test') . '/themes/update_test_subtheme/update_test_subtheme.info'; + $themes['update_test_basetheme'] = drupal_get_path('module', 'update') . '/tests/themes/update_test_basetheme/update_test_basetheme.info'; + $themes['update_test_subtheme'] = drupal_get_path('module', 'update') . '/tests/themes/update_test_subtheme/update_test_subtheme.info'; return $themes; } diff --git a/core/modules/update/tests/update_test_basetheme.1_1-sec.xml b/core/modules/update/tests/modules/update_test/update_test_basetheme.1_1-sec.xml similarity index 100% rename from core/modules/update/tests/update_test_basetheme.1_1-sec.xml rename to core/modules/update/tests/modules/update_test/update_test_basetheme.1_1-sec.xml diff --git a/core/modules/update/tests/update_test_subtheme.1_0.xml b/core/modules/update/tests/modules/update_test/update_test_subtheme.1_0.xml similarity index 100% rename from core/modules/update/tests/update_test_subtheme.1_0.xml rename to core/modules/update/tests/modules/update_test/update_test_subtheme.1_0.xml diff --git a/core/modules/user/user.module b/core/modules/user/user.module index 865f17b3b3e..3b1d9cb5f63 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -947,11 +947,14 @@ function user_account_form(&$form, &$form_state) { '#weight' => -10, ); + // The mail field is NOT required if account originally had no mail set + // and the user performing the edit has 'administer users' permission. + // This allows users without e-mail address to be edited and deleted. $form['account']['mail'] = array( '#type' => 'email', '#title' => t('E-mail address'), '#description' => t('A valid e-mail address. All e-mails from the system will be sent to this address. The e-mail address is not made public and will only be used if you wish to receive a new password or wish to receive certain news or notifications by e-mail.'), - '#required' => TRUE, + '#required' => !(empty($account->mail) && user_access('administer users')), '#default_value' => (!$register ? $account->mail : ''), ); @@ -1133,7 +1136,7 @@ function user_account_form_validate($form, &$form_state) { $mail = $form_state['values']['mail']; - if ((bool) db_select('users')->fields('users', array('uid'))->condition('uid', $account->uid, '<>')->condition('mail', db_like($mail), 'LIKE')->range(0, 1)->execute()->fetchField()) { + if (!empty($mail) && (bool) db_select('users')->fields('users', array('uid'))->condition('uid', $account->uid, '<>')->condition('mail', db_like($mail), 'LIKE')->range(0, 1)->execute()->fetchField()) { // Format error message dependent on whether the user is logged in or not. if ($GLOBALS['user']->uid) { form_set_error('mail', t('The e-mail address %email is already taken.', array('%email' => $mail))); @@ -3794,14 +3797,19 @@ function user_register_submit($form, &$form_state) { } // No administrator approval required. elseif ($account->status || $notify) { - $op = $notify ? 'register_admin_created' : 'register_no_approval_required'; - _user_mail_notify($op, $account); - if ($notify) { - drupal_set_message(t('A welcome message with further instructions has been e-mailed to the new user %name.', array('@url' => url($uri['path'], $uri['options']), '%name' => $account->name))); + if (empty($account->mail) && $notify) { + drupal_set_message(t('The new user %name was created without an email address, so no welcome message was sent.', array('@url' => url($uri['path'], $uri['options']), '%name' => $account->name))); } else { - drupal_set_message(t('A welcome message with further instructions has been sent to your e-mail address.')); - $form_state['redirect'] = ''; + $op = $notify ? 'register_admin_created' : 'register_no_approval_required'; + _user_mail_notify($op, $account); + if ($notify) { + drupal_set_message(t('A welcome message with further instructions has been e-mailed to the new user %name.', array('@url' => url($uri['path'], $uri['options']), '%name' => $account->name))); + } + else { + drupal_set_message(t('A welcome message with further instructions has been sent to your e-mail address.')); + $form_state['redirect'] = ''; + } } } // Administrator approval required. diff --git a/core/modules/user/user.test b/core/modules/user/user.test index 06fbc954fbd..3a3a71300f3 100644 --- a/core/modules/user/user.test +++ b/core/modules/user/user.test @@ -836,6 +836,34 @@ class UserCancelTestCase extends DrupalWebTestCase { $this->assertFalse(user_load($account->uid), t('User is not found in the database.')); } + /** + * Tests deletion of a user account without an e-mail address. + */ + function testUserWithoutEmailCancelByAdmin() { + variable_set('user_cancel_method', 'user_cancel_reassign'); + + // Create a regular user. + $account = $this->drupalCreateUser(array()); + // This user has no e-mail address. + $edit = array('mail' => ''); + $account = user_save($account, $edit); + + // Create administrative user. + $admin_user = $this->drupalCreateUser(array('administer users')); + $this->drupalLogin($admin_user); + + // Delete regular user without e-mail address. + $this->drupalGet('user/' . $account->uid . '/edit'); + $this->drupalPost(NULL, NULL, t('Cancel account')); + $this->assertRaw(t('Are you sure you want to cancel the account %name?', array('%name' => $account->name)), t('Confirmation form to cancel account displayed.')); + $this->assertText(t('Select the method to cancel the account above.'), t('Allows to select account cancellation method.')); + + // Confirm deletion. + $this->drupalPost(NULL, NULL, t('Cancel account')); + $this->assertRaw(t('%name has been deleted.', array('%name' => $account->name)), t('User deleted.')); + $this->assertFalse(user_load($account->uid), t('User is not found in the database.')); + } + /** * Create an administrative user and mass-delete other users. */ @@ -1786,6 +1814,22 @@ class UserEditTestCase extends DrupalWebTestCase { $this->drupalLogin($user1); $this->drupalLogout(); } + + /** + * Tests editing of a user account without an e-mail address. + */ + function testUserWithoutEmailEdit() { + // Test that an admin can edit users without an e-mail address. + $admin = $this->drupalCreateUser(array('administer users')); + $this->drupalLogin($admin); + // Create a regular user. + $user1 = $this->drupalCreateUser(array()); + // This user has no e-mail address. + $edit = array('mail' => ''); + $user1 = user_save($user1, $edit); + $this->drupalPost("user/$user1->uid/edit", $edit, t('Save')); + $this->assertRaw(t("The changes have been saved.")); + } } /**