update to drupal 7.23
This commit is contained in:
@@ -189,7 +189,7 @@ function hook_aggregator_process($feed) {
|
||||
*
|
||||
* @ingroup aggregator
|
||||
*/
|
||||
function hook_aggregator_process_info($feed) {
|
||||
function hook_aggregator_process_info() {
|
||||
return array(
|
||||
'title' => t('Default processor'),
|
||||
'description' => t('Creates lightweight records of feed items.'),
|
||||
|
@@ -7,8 +7,8 @@ files[] = aggregator.test
|
||||
configure = admin/config/services/aggregator/settings
|
||||
stylesheets[all][] = aggregator.css
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
files[] = block.test
|
||||
configure = admin/structure/block
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -840,15 +840,42 @@ function _block_render_blocks($region_blocks) {
|
||||
// preserve the submission of forms in blocks, by fetching from cache only
|
||||
// if the request method is 'GET' (or 'HEAD').
|
||||
$cacheable = !count(module_implements('node_grants')) && ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'HEAD');
|
||||
|
||||
// Proceed to loop over all blocks in order to compute their respective cache
|
||||
// identifiers; this allows us to do one single cache_get_multiple() call
|
||||
// instead of doing one cache_get() call per block.
|
||||
$cached_blocks = array();
|
||||
$cids = array();
|
||||
|
||||
if ($cacheable) {
|
||||
foreach ($region_blocks as $key => $block) {
|
||||
if (!isset($block->content)) {
|
||||
if (($cid = _block_get_cache_id($block))) {
|
||||
$cids[$key] = $cid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($cids) {
|
||||
// We cannot pass $cids in directly because cache_get_multiple() will
|
||||
// modify it, and we need to use it later on in this function.
|
||||
$cid_values = array_values($cids);
|
||||
$cached_blocks = cache_get_multiple($cid_values, 'cache_block');
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($region_blocks as $key => $block) {
|
||||
// Render the block content if it has not been created already.
|
||||
if (!isset($block->content)) {
|
||||
// Erase the block from the static array - we'll put it back if it has
|
||||
// content.
|
||||
unset($region_blocks[$key]);
|
||||
// Try fetching the block from cache.
|
||||
if ($cacheable && ($cid = _block_get_cache_id($block)) && ($cache = cache_get($cid, 'cache_block'))) {
|
||||
$array = $cache->data;
|
||||
|
||||
$cid = empty($cids[$key]) ? NULL : $cids[$key];
|
||||
|
||||
// Try fetching the block from the previously loaded cache entries.
|
||||
if (isset($cached_blocks[$cid])) {
|
||||
$array = $cached_blocks[$cid]->data;
|
||||
}
|
||||
else {
|
||||
$array = module_invoke($block->module, 'block_view', $block->delta);
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -13,8 +13,8 @@ regions[footer] = Footer
|
||||
regions[highlighted] = Highlighted
|
||||
regions[help] = Help
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
files[] = blog.test
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -7,8 +7,8 @@ files[] = book.test
|
||||
configure = admin/content/book/settings
|
||||
stylesheets[all][] = book.css
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -1375,7 +1375,7 @@ function book_link_load($mlid) {
|
||||
* A fully loaded menu link.
|
||||
*
|
||||
* @return
|
||||
* An subtree of menu links in an array, in the order they should be rendered.
|
||||
* A subtree of menu links in an array, in the order they should be rendered.
|
||||
*/
|
||||
function book_menu_subtree_data($link) {
|
||||
$tree = &drupal_static(__FUNCTION__, array());
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
files[] = color.test
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -346,9 +346,10 @@ function color_scheme_form_submit($form, &$form_state) {
|
||||
// memory_get_usage(), therefore we won't inadvertently reject a color
|
||||
// scheme change based on a faulty memory calculation.
|
||||
$usage = memory_get_usage(TRUE);
|
||||
$limit = parse_size(ini_get('memory_limit'));
|
||||
if ($usage + $required > $limit) {
|
||||
drupal_set_message(t('There is not enough memory available to PHP to change this theme\'s color scheme. You need at least %size more. Check the <a href="@url">PHP documentation</a> for more information.', array('%size' => format_size($usage + $required - $limit), '@url' => 'http://www.php.net/manual/ini.core.php#ini.sect.resource-limits')), 'error');
|
||||
$memory_limit = ini_get('memory_limit');
|
||||
$size = parse_size($memory_limit);
|
||||
if (!drupal_check_memory_limit($usage + $required, $memory_limit)) {
|
||||
drupal_set_message(t('There is not enough memory available to PHP to change this theme\'s color scheme. You need at least %size more. Check the <a href="@url">PHP documentation</a> for more information.', array('%size' => format_size($usage + $required - $size), '@url' => 'http://www.php.net/manual/ini.core.php#ini.sect.resource-limits')), 'error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@@ -9,8 +9,8 @@ files[] = comment.test
|
||||
configure = admin/content/comment
|
||||
stylesheets[all][] = comment.css
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -152,7 +152,7 @@ function comment_node_type_load($name) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Entity URI callback.
|
||||
* Implements callback_entity_info_uri().
|
||||
*/
|
||||
function comment_uri($comment) {
|
||||
return array(
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
files[] = contact.test
|
||||
configure = admin/structure/contact
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -36,7 +36,7 @@ class ContactSitewideTestCase extends DrupalWebTestCase {
|
||||
$edit = array();
|
||||
$edit['contact_default_status'] = TRUE;
|
||||
$this->drupalPost('admin/config/people/accounts', $edit, t('Save configuration'));
|
||||
$this->assertText(t('The configuration options have been saved.'), t('Setting successfully saved.'));
|
||||
$this->assertText(t('The configuration options have been saved.'), 'Setting successfully saved.');
|
||||
|
||||
// Delete old categories to ensure that new categories are used.
|
||||
$this->deleteCategories();
|
||||
@@ -56,21 +56,21 @@ class ContactSitewideTestCase extends DrupalWebTestCase {
|
||||
$invalid_recipients = array('invalid', 'invalid@', 'invalid@site.', '@site.', '@site.com');
|
||||
foreach ($invalid_recipients as $invalid_recipient) {
|
||||
$this->addCategory($this->randomName(16), $invalid_recipient, '', FALSE);
|
||||
$this->assertRaw(t('%recipient is an invalid e-mail address.', array('%recipient' => $invalid_recipient)), t('Caught invalid recipient (' . $invalid_recipient . ').'));
|
||||
$this->assertRaw(t('%recipient is an invalid e-mail address.', array('%recipient' => $invalid_recipient)), format_string('Caught invalid recipient (@invalid_recipient).', array('@invalid_recipient' => $invalid_recipient)));
|
||||
}
|
||||
|
||||
// Test validation of empty category and recipients fields.
|
||||
$this->addCategory($category = '', '', '', TRUE);
|
||||
$this->assertText(t('Category field is required.'), t('Caught empty category field'));
|
||||
$this->assertText(t('Recipients field is required.'), t('Caught empty recipients field.'));
|
||||
$this->assertText(t('Category field is required.'), 'Caught empty category field');
|
||||
$this->assertText(t('Recipients field is required.'), 'Caught empty recipients field.');
|
||||
|
||||
// Create first valid category.
|
||||
$recipients = array('simpletest@example.com', 'simpletest2@example.com', 'simpletest3@example.com');
|
||||
$this->addCategory($category = $this->randomName(16), implode(',', array($recipients[0])), '', TRUE);
|
||||
$this->assertRaw(t('Category %category has been saved.', array('%category' => $category)), t('Category successfully saved.'));
|
||||
$this->assertRaw(t('Category %category has been saved.', array('%category' => $category)), 'Category successfully saved.');
|
||||
|
||||
// Make sure the newly created category is included in the list of categories.
|
||||
$this->assertNoUniqueText($category, t('New category included in categories list.'));
|
||||
$this->assertNoUniqueText($category, 'New category included in categories list.');
|
||||
|
||||
// Test update contact form category.
|
||||
$categories = $this->getCategories();
|
||||
@@ -80,80 +80,80 @@ class ContactSitewideTestCase extends DrupalWebTestCase {
|
||||
$this->assertEqual($category_array['recipients'], $recipients_str);
|
||||
$this->assertEqual($category_array['reply'], $reply);
|
||||
$this->assertFalse($category_array['selected']);
|
||||
$this->assertRaw(t('Category %category has been saved.', array('%category' => $category)), t('Category successfully saved.'));
|
||||
$this->assertRaw(t('Category %category has been saved.', array('%category' => $category)), 'Category successfully saved.');
|
||||
|
||||
// Ensure that the contact form is shown without a category selection input.
|
||||
user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access site-wide contact form'));
|
||||
$this->drupalLogout();
|
||||
$this->drupalGet('contact');
|
||||
$this->assertText(t('Your e-mail address'), t('Contact form is shown when there is one category.'));
|
||||
$this->assertNoText(t('Category'), t('When there is only one category, the category selection element is hidden.'));
|
||||
$this->assertText(t('Your e-mail address'), 'Contact form is shown when there is one category.');
|
||||
$this->assertNoText(t('Category'), 'When there is only one category, the category selection element is hidden.');
|
||||
$this->drupalLogin($admin_user);
|
||||
|
||||
// Add more categories.
|
||||
$this->addCategory($category = $this->randomName(16), implode(',', array($recipients[0], $recipients[1])), '', FALSE);
|
||||
$this->assertRaw(t('Category %category has been saved.', array('%category' => $category)), t('Category successfully saved.'));
|
||||
$this->assertRaw(t('Category %category has been saved.', array('%category' => $category)), 'Category successfully saved.');
|
||||
|
||||
$this->addCategory($category = $this->randomName(16), implode(',', array($recipients[0], $recipients[1], $recipients[2])), '', FALSE);
|
||||
$this->assertRaw(t('Category %category has been saved.', array('%category' => $category)), t('Category successfully saved.'));
|
||||
$this->assertRaw(t('Category %category has been saved.', array('%category' => $category)), 'Category successfully saved.');
|
||||
|
||||
// Try adding a category that already exists.
|
||||
$this->addCategory($category, '', '', FALSE);
|
||||
$this->assertNoRaw(t('Category %category has been saved.', array('%category' => $category)), t('Category not saved.'));
|
||||
$this->assertRaw(t('A contact form with category %category already exists.', array('%category' => $category)), t('Duplicate category error found.'));
|
||||
$this->assertNoRaw(t('Category %category has been saved.', array('%category' => $category)), 'Category not saved.');
|
||||
$this->assertRaw(t('A contact form with category %category already exists.', array('%category' => $category)), 'Duplicate category error found.');
|
||||
|
||||
// Clear flood table in preparation for flood test and allow other checks to complete.
|
||||
db_delete('flood')->execute();
|
||||
$num_records_after = db_query("SELECT COUNT(*) FROM {flood}")->fetchField();
|
||||
$this->assertIdentical($num_records_after, '0', t('Flood table emptied.'));
|
||||
$this->assertIdentical($num_records_after, '0', 'Flood table emptied.');
|
||||
$this->drupalLogout();
|
||||
|
||||
// Check to see that anonymous user cannot see contact page without permission.
|
||||
user_role_revoke_permissions(DRUPAL_ANONYMOUS_RID, array('access site-wide contact form'));
|
||||
$this->drupalGet('contact');
|
||||
$this->assertResponse(403, t('Access denied to anonymous user without permission.'));
|
||||
$this->assertResponse(403, 'Access denied to anonymous user without permission.');
|
||||
|
||||
// Give anonymous user permission and see that page is viewable.
|
||||
user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access site-wide contact form'));
|
||||
$this->drupalGet('contact');
|
||||
$this->assertResponse(200, t('Access granted to anonymous user with permission.'));
|
||||
$this->assertResponse(200, 'Access granted to anonymous user with permission.');
|
||||
|
||||
// Submit contact form with invalid values.
|
||||
$this->submitContact('', $recipients[0], $this->randomName(16), $categories[0], $this->randomName(64));
|
||||
$this->assertText(t('Your name field is required.'), t('Name required.'));
|
||||
$this->assertText(t('Your name field is required.'), 'Name required.');
|
||||
|
||||
$this->submitContact($this->randomName(16), '', $this->randomName(16), $categories[0], $this->randomName(64));
|
||||
$this->assertText(t('Your e-mail address field is required.'), t('E-mail required.'));
|
||||
$this->assertText(t('Your e-mail address field is required.'), 'E-mail required.');
|
||||
|
||||
$this->submitContact($this->randomName(16), $invalid_recipients[0], $this->randomName(16), $categories[0], $this->randomName(64));
|
||||
$this->assertText(t('You must enter a valid e-mail address.'), t('Valid e-mail required.'));
|
||||
$this->assertText(t('You must enter a valid e-mail address.'), 'Valid e-mail required.');
|
||||
|
||||
$this->submitContact($this->randomName(16), $recipients[0], '', $categories[0], $this->randomName(64));
|
||||
$this->assertText(t('Subject field is required.'), t('Subject required.'));
|
||||
$this->assertText(t('Subject field is required.'), 'Subject required.');
|
||||
|
||||
$this->submitContact($this->randomName(16), $recipients[0], $this->randomName(16), $categories[0], '');
|
||||
$this->assertText(t('Message field is required.'), t('Message required.'));
|
||||
$this->assertText(t('Message field is required.'), 'Message required.');
|
||||
|
||||
// Test contact form with no default category selected.
|
||||
db_update('contact')
|
||||
->fields(array('selected' => 0))
|
||||
->execute();
|
||||
$this->drupalGet('contact');
|
||||
$this->assertRaw(t('- Please choose -'), t('Without selected categories the visitor is asked to chose a category.'));
|
||||
$this->assertRaw(t('- Please choose -'), 'Without selected categories the visitor is asked to chose a category.');
|
||||
|
||||
// Submit contact form with invalid category id (cid 0).
|
||||
$this->submitContact($this->randomName(16), $recipients[0], $this->randomName(16), 0, '');
|
||||
$this->assertText(t('You must select a valid category.'), t('Valid category required.'));
|
||||
$this->assertText(t('You must select a valid category.'), 'Valid category required.');
|
||||
|
||||
// Submit contact form with correct values and check flood interval.
|
||||
for ($i = 0; $i < $flood_limit; $i++) {
|
||||
$this->submitContact($this->randomName(16), $recipients[0], $this->randomName(16), $categories[0], $this->randomName(64));
|
||||
$this->assertText(t('Your message has been sent.'), t('Message sent.'));
|
||||
$this->assertText(t('Your message has been sent.'), 'Message sent.');
|
||||
}
|
||||
// Submit contact form one over limit.
|
||||
$this->drupalGet('contact');
|
||||
$this->assertResponse(403, t('Access denied to anonymous user after reaching message treshold.'));
|
||||
$this->assertRaw(t('You cannot send more than %number messages in @interval. Try again later.', array('%number' => variable_get('contact_threshold_limit', 3), '@interval' => format_interval(600))), t('Message threshold reached.'));
|
||||
$this->assertResponse(403, 'Access denied to anonymous user after reaching message treshold.');
|
||||
$this->assertRaw(t('You cannot send more than %number messages in @interval. Try again later.', array('%number' => variable_get('contact_threshold_limit', 3), '@interval' => format_interval(600))), 'Message threshold reached.');
|
||||
|
||||
// Delete created categories.
|
||||
$this->drupalLogin($admin_user);
|
||||
@@ -182,8 +182,8 @@ class ContactSitewideTestCase extends DrupalWebTestCase {
|
||||
|
||||
// We are testing the auto-reply, so there should be one e-mail going to the sender.
|
||||
$captured_emails = $this->drupalGetMails(array('id' => 'contact_page_autoreply', 'to' => $email, 'from' => 'foo@example.com'));
|
||||
$this->assertEqual(count($captured_emails), 1, t('Auto-reply e-mail was sent to the sender for category "foo".'), t('Contact'));
|
||||
$this->assertEqual($captured_emails[0]['body'], drupal_html_to_text($foo_autoreply), t('Auto-reply e-mail body is correct for category "foo".'), t('Contact'));
|
||||
$this->assertEqual(count($captured_emails), 1, 'Auto-reply e-mail was sent to the sender for category "foo".', 'Contact');
|
||||
$this->assertEqual($captured_emails[0]['body'], drupal_html_to_text($foo_autoreply), 'Auto-reply e-mail body is correct for category "foo".', 'Contact');
|
||||
|
||||
// Test the auto-reply for category 'bar'.
|
||||
$email = $this->randomName(32) . '@example.com';
|
||||
@@ -191,14 +191,14 @@ class ContactSitewideTestCase extends DrupalWebTestCase {
|
||||
|
||||
// Auto-reply for category 'bar' should result in one auto-reply e-mail to the sender.
|
||||
$captured_emails = $this->drupalGetMails(array('id' => 'contact_page_autoreply', 'to' => $email, 'from' => 'bar@example.com'));
|
||||
$this->assertEqual(count($captured_emails), 1, t('Auto-reply e-mail was sent to the sender for category "bar".'), t('Contact'));
|
||||
$this->assertEqual($captured_emails[0]['body'], drupal_html_to_text($bar_autoreply), t('Auto-reply e-mail body is correct for category "bar".'), t('Contact'));
|
||||
$this->assertEqual(count($captured_emails), 1, 'Auto-reply e-mail was sent to the sender for category "bar".', 'Contact');
|
||||
$this->assertEqual($captured_emails[0]['body'], drupal_html_to_text($bar_autoreply), 'Auto-reply e-mail body is correct for category "bar".', 'Contact');
|
||||
|
||||
// Verify that no auto-reply is sent when the auto-reply field is left blank.
|
||||
$email = $this->randomName(32) . '@example.com';
|
||||
$this->submitContact($this->randomName(16), $email, $this->randomString(64), 4, $this->randomString(128));
|
||||
$captured_emails = $this->drupalGetMails(array('id' => 'contact_page_autoreply', 'to' => $email, 'from' => 'no_autoreply@example.com'));
|
||||
$this->assertEqual(count($captured_emails), 0, t('No auto-reply e-mail was sent to the sender for category "no-autoreply".'), t('Contact'));
|
||||
$this->assertEqual(count($captured_emails), 0, 'No auto-reply e-mail was sent to the sender for category "no-autoreply".', 'Contact');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -279,7 +279,7 @@ class ContactSitewideTestCase extends DrupalWebTestCase {
|
||||
foreach ($categories as $category) {
|
||||
$category_name = db_query("SELECT category FROM {contact} WHERE cid = :cid", array(':cid' => $category))->fetchField();
|
||||
$this->drupalPost('admin/structure/contact/delete/' . $category, array(), t('Delete'));
|
||||
$this->assertRaw(t('Category %category has been deleted.', array('%category' => $category_name)), t('Category deleted successfully.'));
|
||||
$this->assertRaw(t('Category %category has been deleted.', array('%category' => $category_name)), 'Category deleted successfully.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -355,7 +355,7 @@ class ContactPersonalTestCase extends DrupalWebTestCase {
|
||||
$this->drupalLogin($this->admin_user);
|
||||
$edit = array('contact_default_status' => FALSE);
|
||||
$this->drupalPost('admin/config/people/accounts', $edit, t('Save configuration'));
|
||||
$this->assertText(t('The configuration options have been saved.'), t('Setting successfully saved.'));
|
||||
$this->assertText(t('The configuration options have been saved.'), 'Setting successfully saved.');
|
||||
$this->drupalLogout();
|
||||
|
||||
// Re-create our contacted user with personal contact forms disabled by
|
||||
|
@@ -77,7 +77,7 @@ div.contextual-links-wrapper ul.contextual-links {
|
||||
-webkit-border-top-left-radius: 4px; /* LTR */
|
||||
border-radius: 4px 0 4px 4px; /* LTR */
|
||||
}
|
||||
.contextual-links-region:hover a.contextual-links-trigger,
|
||||
a.contextual-links-trigger-active,
|
||||
div.contextual-links-active a.contextual-links-trigger,
|
||||
div.contextual-links-active ul.contextual-links {
|
||||
display: block;
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
files[] = contextual.test
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -30,6 +30,10 @@ Drupal.behaviors.contextualLinks = {
|
||||
);
|
||||
// Hide the contextual links when user clicks a link or rolls out of the .contextual-links-region.
|
||||
$region.bind('mouseleave click', Drupal.contextualLinks.mouseleave);
|
||||
$region.hover(
|
||||
function() { $trigger.addClass('contextual-links-trigger-active'); },
|
||||
function() { $trigger.removeClass('contextual-links-trigger-active'); }
|
||||
);
|
||||
// Prepend the trigger.
|
||||
$wrapper.prepend($trigger);
|
||||
});
|
||||
|
@@ -7,8 +7,8 @@ files[] = dashboard.test
|
||||
dependencies[] = block
|
||||
configure = admin/dashboard/customize
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -9,7 +9,7 @@
|
||||
* Implements Drupal.behaviors for the Dashboard module.
|
||||
*/
|
||||
Drupal.behaviors.dashboard = {
|
||||
attach: function (context, settings) {
|
||||
attach: function (context, settings) {
|
||||
$('#dashboard', context).once(function () {
|
||||
$(this).prepend('<div class="customize clearfix"><ul class="action-links"><li><a href="#">' + Drupal.t('Customize dashboard') + '</a></li></ul><div class="canvas"></div></div>');
|
||||
$('.customize .action-links a', this).click(Drupal.behaviors.dashboard.enterCustomizeMode);
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
files[] = dblog.test
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -79,10 +79,10 @@ class DBLogTestCase extends DrupalWebTestCase {
|
||||
|
||||
// Check row limit variable.
|
||||
$current_limit = variable_get('dblog_row_limit', 1000);
|
||||
$this->assertTrue($current_limit == $row_limit, t('[Cache] Row limit variable of @count equals row limit of @limit', array('@count' => $current_limit, '@limit' => $row_limit)));
|
||||
$this->assertTrue($current_limit == $row_limit, format_string('[Cache] Row limit variable of @count equals row limit of @limit', array('@count' => $current_limit, '@limit' => $row_limit)));
|
||||
// Verify dblog row limit equals specified row limit.
|
||||
$current_limit = unserialize(db_query("SELECT value FROM {variable} WHERE name = :dblog_limit", array(':dblog_limit' => 'dblog_row_limit'))->fetchField());
|
||||
$this->assertTrue($current_limit == $row_limit, t('[Variable table] Row limit variable of @count equals row limit of @limit', array('@count' => $current_limit, '@limit' => $row_limit)));
|
||||
$this->assertTrue($current_limit == $row_limit, format_string('[Variable table] Row limit variable of @count equals row limit of @limit', array('@count' => $current_limit, '@limit' => $row_limit)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -96,14 +96,14 @@ class DBLogTestCase extends DrupalWebTestCase {
|
||||
$this->generateLogEntries($row_limit + 10);
|
||||
// Verify that the database log row count exceeds the row limit.
|
||||
$count = db_query('SELECT COUNT(wid) FROM {watchdog}')->fetchField();
|
||||
$this->assertTrue($count > $row_limit, t('Dblog row count of @count exceeds row limit of @limit', array('@count' => $count, '@limit' => $row_limit)));
|
||||
$this->assertTrue($count > $row_limit, format_string('Dblog row count of @count exceeds row limit of @limit', array('@count' => $count, '@limit' => $row_limit)));
|
||||
|
||||
// Run a cron job.
|
||||
$this->cronRun();
|
||||
// Verify that the database log row count equals the row limit plus one
|
||||
// because cron adds a record after it runs.
|
||||
$count = db_query('SELECT COUNT(wid) FROM {watchdog}')->fetchField();
|
||||
$this->assertTrue($count == $row_limit + 1, t('Dblog row count of @count equals row limit of @limit plus one', array('@count' => $count, '@limit' => $row_limit)));
|
||||
$this->assertTrue($count == $row_limit + 1, format_string('Dblog row count of @count equals row limit of @limit plus one', array('@count' => $count, '@limit' => $row_limit)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -153,35 +153,35 @@ class DBLogTestCase extends DrupalWebTestCase {
|
||||
$this->drupalGet('admin/help/dblog');
|
||||
$this->assertResponse($response);
|
||||
if ($response == 200) {
|
||||
$this->assertText(t('Database logging'), t('DBLog help was displayed'));
|
||||
$this->assertText(t('Database logging'), 'DBLog help was displayed');
|
||||
}
|
||||
|
||||
// View the database log report page.
|
||||
$this->drupalGet('admin/reports/dblog');
|
||||
$this->assertResponse($response);
|
||||
if ($response == 200) {
|
||||
$this->assertText(t('Recent log messages'), t('DBLog report was displayed'));
|
||||
$this->assertText(t('Recent log messages'), 'DBLog report was displayed');
|
||||
}
|
||||
|
||||
// View the database log page-not-found report page.
|
||||
$this->drupalGet('admin/reports/page-not-found');
|
||||
$this->assertResponse($response);
|
||||
if ($response == 200) {
|
||||
$this->assertText(t('Top ' . $quote . 'page not found' . $quote . ' errors'), t('DBLog page-not-found report was displayed'));
|
||||
$this->assertText(t('Top ' . $quote . 'page not found' . $quote . ' errors'), 'DBLog page-not-found report was displayed');
|
||||
}
|
||||
|
||||
// View the database log access-denied report page.
|
||||
$this->drupalGet('admin/reports/access-denied');
|
||||
$this->assertResponse($response);
|
||||
if ($response == 200) {
|
||||
$this->assertText(t('Top ' . $quote . 'access denied' . $quote . ' errors'), t('DBLog access-denied report was displayed'));
|
||||
$this->assertText(t('Top ' . $quote . 'access denied' . $quote . ' errors'), 'DBLog access-denied report was displayed');
|
||||
}
|
||||
|
||||
// View the database log event page.
|
||||
$this->drupalGet('admin/reports/event/1');
|
||||
$this->assertResponse($response);
|
||||
if ($response == 200) {
|
||||
$this->assertText(t('Details'), t('DBLog event node was displayed'));
|
||||
$this->assertText(t('Details'), 'DBLog event node was displayed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,7 +220,7 @@ class DBLogTestCase extends DrupalWebTestCase {
|
||||
$this->assertResponse(200);
|
||||
// Retrieve the user object.
|
||||
$user = user_load_by_name($name);
|
||||
$this->assertTrue($user != NULL, t('User @name was loaded', array('@name' => $name)));
|
||||
$this->assertTrue($user != NULL, format_string('User @name was loaded', array('@name' => $name)));
|
||||
// pass_raw property is needed by drupalLogin.
|
||||
$user->pass_raw = $pass;
|
||||
// Login user.
|
||||
@@ -233,7 +233,7 @@ class DBLogTestCase extends DrupalWebTestCase {
|
||||
$ids[] = $row->wid;
|
||||
}
|
||||
$count_before = (isset($ids)) ? count($ids) : 0;
|
||||
$this->assertTrue($count_before > 0, t('DBLog contains @count records for @name', array('@count' => $count_before, '@name' => $user->name)));
|
||||
$this->assertTrue($count_before > 0, format_string('DBLog contains @count records for @name', array('@count' => $count_before, '@name' => $user->name)));
|
||||
|
||||
// Login the admin user.
|
||||
$this->drupalLogin($this->big_user);
|
||||
@@ -249,11 +249,11 @@ class DBLogTestCase extends DrupalWebTestCase {
|
||||
// Add user.
|
||||
// Default display includes name and email address; if too long, the email
|
||||
// address is replaced by three periods.
|
||||
$this->assertLogMessage(t('New user: %name (%email).', array('%name' => $name, '%email' => $user->mail)), t('DBLog event was recorded: [add user]'));
|
||||
$this->assertLogMessage(t('New user: %name (%email).', array('%name' => $name, '%email' => $user->mail)), 'DBLog event was recorded: [add user]');
|
||||
// Login user.
|
||||
$this->assertLogMessage(t('Session opened for %name.', array('%name' => $name)), t('DBLog event was recorded: [login user]'));
|
||||
$this->assertLogMessage(t('Session opened for %name.', array('%name' => $name)), 'DBLog event was recorded: [login user]');
|
||||
// Logout user.
|
||||
$this->assertLogMessage(t('Session closed for %name.', array('%name' => $name)), t('DBLog event was recorded: [logout user]'));
|
||||
$this->assertLogMessage(t('Session closed for %name.', array('%name' => $name)), 'DBLog event was recorded: [logout user]');
|
||||
// Delete user.
|
||||
$message = t('Deleted user: %name %email.', array('%name' => $name, '%email' => '<' . $user->mail . '>'));
|
||||
$message_text = truncate_utf8(filter_xss($message, array()), 56, TRUE, TRUE);
|
||||
@@ -268,12 +268,12 @@ class DBLogTestCase extends DrupalWebTestCase {
|
||||
$link = drupal_substr($value, strpos($value, 'admin/reports/event/'));
|
||||
$this->drupalGet($link);
|
||||
// Check for full message text on the details page.
|
||||
$this->assertRaw($message, t('DBLog event details was found: [delete user]'));
|
||||
$this->assertRaw($message, 'DBLog event details was found: [delete user]');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->assertTrue($link, t('DBLog event was recorded: [delete user]'));
|
||||
$this->assertTrue($link, 'DBLog event was recorded: [delete user]');
|
||||
// Visit random URL (to generate page not found event).
|
||||
$not_found_url = $this->randomName(60);
|
||||
$this->drupalGet($not_found_url);
|
||||
@@ -282,7 +282,7 @@ class DBLogTestCase extends DrupalWebTestCase {
|
||||
$this->drupalGet('admin/reports/page-not-found');
|
||||
$this->assertResponse(200);
|
||||
// Check that full-length URL displayed.
|
||||
$this->assertText($not_found_url, t('DBLog event was recorded: [page not found]'));
|
||||
$this->assertText($not_found_url, 'DBLog event was recorded: [page not found]');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -307,7 +307,7 @@ class DBLogTestCase extends DrupalWebTestCase {
|
||||
$this->assertResponse(200);
|
||||
// Retrieve the node object.
|
||||
$node = $this->drupalGetNodeByTitle($title);
|
||||
$this->assertTrue($node != NULL, t('Node @title was loaded', array('@title' => $title)));
|
||||
$this->assertTrue($node != NULL, format_string('Node @title was loaded', array('@title' => $title)));
|
||||
// Edit the node.
|
||||
$edit = $this->getContentUpdate($type);
|
||||
$this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
|
||||
@@ -330,23 +330,23 @@ class DBLogTestCase extends DrupalWebTestCase {
|
||||
|
||||
// Verify that node events were recorded.
|
||||
// Was node content added?
|
||||
$this->assertLogMessage(t('@type: added %title.', array('@type' => $type, '%title' => $title)), t('DBLog event was recorded: [content added]'));
|
||||
$this->assertLogMessage(t('@type: added %title.', array('@type' => $type, '%title' => $title)), 'DBLog event was recorded: [content added]');
|
||||
// Was node content updated?
|
||||
$this->assertLogMessage(t('@type: updated %title.', array('@type' => $type, '%title' => $title)), t('DBLog event was recorded: [content updated]'));
|
||||
$this->assertLogMessage(t('@type: updated %title.', array('@type' => $type, '%title' => $title)), 'DBLog event was recorded: [content updated]');
|
||||
// Was node content deleted?
|
||||
$this->assertLogMessage(t('@type: deleted %title.', array('@type' => $type, '%title' => $title)), t('DBLog event was recorded: [content deleted]'));
|
||||
$this->assertLogMessage(t('@type: deleted %title.', array('@type' => $type, '%title' => $title)), 'DBLog event was recorded: [content deleted]');
|
||||
|
||||
// View the database log access-denied report page.
|
||||
$this->drupalGet('admin/reports/access-denied');
|
||||
$this->assertResponse(200);
|
||||
// Verify that the 'access denied' event was recorded.
|
||||
$this->assertText(t('admin/reports/dblog'), t('DBLog event was recorded: [access denied]'));
|
||||
$this->assertText(t('admin/reports/dblog'), 'DBLog event was recorded: [access denied]');
|
||||
|
||||
// View the database log page-not-found report page.
|
||||
$this->drupalGet('admin/reports/page-not-found');
|
||||
$this->assertResponse(200);
|
||||
// Verify that the 'page not found' event was recorded.
|
||||
$this->assertText(t('node/@nid', array('@nid' => $node->nid)), t('DBLog event was recorded: [page not found]'));
|
||||
$this->assertText(t('node/@nid', array('@nid' => $node->nid)), 'DBLog event was recorded: [page not found]');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -433,14 +433,14 @@ class DBLogTestCase extends DrupalWebTestCase {
|
||||
// Add a watchdog entry.
|
||||
dblog_watchdog($log);
|
||||
// Make sure the table count has actually been incremented.
|
||||
$this->assertEqual($count + 1, db_query('SELECT COUNT(*) FROM {watchdog}')->fetchField(), t('dblog_watchdog() added an entry to the dblog :count', array(':count' => $count)));
|
||||
$this->assertEqual($count + 1, db_query('SELECT COUNT(*) FROM {watchdog}')->fetchField(), format_string('dblog_watchdog() added an entry to the dblog :count', array(':count' => $count)));
|
||||
// Login the admin user.
|
||||
$this->drupalLogin($this->big_user);
|
||||
// Post in order to clear the database table.
|
||||
$this->drupalPost('admin/reports/dblog', array(), t('Clear log messages'));
|
||||
// Count the rows in watchdog that previously related to the deleted user.
|
||||
$count = db_query('SELECT COUNT(*) FROM {watchdog}')->fetchField();
|
||||
$this->assertEqual($count, 0, t('DBLog contains :count records after a clear.', array(':count' => $count)));
|
||||
$this->assertEqual($count, 0, format_string('DBLog contains :count records after a clear.', array(':count' => $count)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -512,7 +512,7 @@ class DBLogTestCase extends DrupalWebTestCase {
|
||||
|
||||
// Clear all logs and make sure the confirmation message is found.
|
||||
$this->drupalPost('admin/reports/dblog', array(), t('Clear log messages'));
|
||||
$this->assertText(t('Database log cleared.'), t('Confirmation message found'));
|
||||
$this->assertText(t('Database log cleared.'), 'Confirmation message found');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -23,14 +23,20 @@
|
||||
* @see hook_field_extra_fields_alter()
|
||||
*
|
||||
* @return
|
||||
* A nested array of 'pseudo-field' components. Each list is nested within
|
||||
* the following keys: entity type, bundle name, context (either 'form' or
|
||||
* A nested array of 'pseudo-field' elements. Each list is nested within the
|
||||
* following keys: entity type, bundle name, context (either 'form' or
|
||||
* 'display'). The keys are the name of the elements as appearing in the
|
||||
* renderable array (either the entity form or the displayed entity). The
|
||||
* value is an associative array:
|
||||
* - label: The human readable name of the component.
|
||||
* - description: A short description of the component contents.
|
||||
* - label: The human readable name of the element.
|
||||
* - description: A short description of the element contents.
|
||||
* - weight: The default weight of the element.
|
||||
* - edit: (optional) String containing markup (normally a link) used as the
|
||||
* element's 'edit' operation in the administration interface. Only for
|
||||
* 'form' context.
|
||||
* - delete: (optional) String containing markup (normally a link) used as the
|
||||
* element's 'delete' operation in the administration interface. Only for
|
||||
* 'form' context.
|
||||
*/
|
||||
function hook_field_extra_fields() {
|
||||
$extra['node']['poll'] = array(
|
||||
@@ -2508,7 +2514,7 @@ function hook_field_delete_field($field) {
|
||||
*
|
||||
* @param $instance
|
||||
* The instance as it is post-update.
|
||||
* @param $prior_$instance
|
||||
* @param $prior_instance
|
||||
* The instance as it was pre-update.
|
||||
*/
|
||||
function hook_field_update_instance($instance, $prior_instance) {
|
||||
|
@@ -244,9 +244,11 @@ function field_update_field($field) {
|
||||
// $prior_field may no longer be right.
|
||||
module_load_install($field['module']);
|
||||
$schema = (array) module_invoke($field['module'], 'field_schema', $field);
|
||||
$schema += array('columns' => array(), 'indexes' => array());
|
||||
$schema += array('columns' => array(), 'indexes' => array(), 'foreign keys' => array());
|
||||
// 'columns' are hardcoded in the field type.
|
||||
$field['columns'] = $schema['columns'];
|
||||
// 'foreign keys' are hardcoded in the field type.
|
||||
$field['foreign keys'] = $schema['foreign keys'];
|
||||
// 'indexes' can be both hardcoded in the field type, and specified in the
|
||||
// incoming $field definition.
|
||||
$field += array(
|
||||
@@ -522,17 +524,30 @@ function field_create_instance($instance) {
|
||||
* Updates an instance of a field.
|
||||
*
|
||||
* @param $instance
|
||||
* An associative array representing an instance structure. The required
|
||||
* keys and values are:
|
||||
* An associative array representing an instance structure. The following
|
||||
* required array elements specify which field instance is being updated:
|
||||
* - entity_type: The type of the entity the field is attached to.
|
||||
* - bundle: The bundle this field belongs to.
|
||||
* - field_name: The name of an existing field.
|
||||
* Read-only_id properties are assigned automatically. Any other
|
||||
* properties specified in $instance overwrite the existing values for
|
||||
* the instance.
|
||||
* The other array elements represent properties of the instance, and all
|
||||
* properties must be specified or their default values will be used (except
|
||||
* internal-use properties, which are assigned automatically). To avoid
|
||||
* losing the previously stored properties of the instance when making a
|
||||
* change, first load the instance with field_info_instance(), then override
|
||||
* the values you want to override, and finally save using this function.
|
||||
* Example:
|
||||
* @code
|
||||
* // Fetch an instance info array.
|
||||
* $instance_info = field_info_instance($entity_type, $field_name, $bundle_name);
|
||||
* // Change a single property in the instance definition.
|
||||
* $instance_info['definition']['required'] = TRUE;
|
||||
* // Write the changed definition back.
|
||||
* field_update_instance($instance_info['definition']);
|
||||
* @endcode
|
||||
*
|
||||
* @throws FieldException
|
||||
*
|
||||
* @see field_info_instance()
|
||||
* @see field_create_instance()
|
||||
*/
|
||||
function field_update_instance($instance) {
|
||||
|
@@ -11,8 +11,8 @@ dependencies[] = field_sql_storage
|
||||
required = TRUE
|
||||
stylesheets[all][] = theme/field.css
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -449,6 +449,17 @@ function field_info_bundles($entity_type = NULL) {
|
||||
* - type: The field type.
|
||||
* - bundles: The bundles in which the field appears, as an array with entity
|
||||
* types as keys and the array of bundle names as values.
|
||||
* Example:
|
||||
* @code
|
||||
* array(
|
||||
* 'body' => array(
|
||||
* 'bundles' => array(
|
||||
* 'node' => array('page', 'article'),
|
||||
* ),
|
||||
* 'type' => 'text_with_summary',
|
||||
* ),
|
||||
* );
|
||||
* @endcode
|
||||
*/
|
||||
function field_info_field_map() {
|
||||
$cache = _field_info_field_cache();
|
||||
|
@@ -128,7 +128,7 @@ function field_schema() {
|
||||
'not null' => TRUE,
|
||||
'default' => ''
|
||||
),
|
||||
'entity_type' => array(
|
||||
'entity_type' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 32,
|
||||
'not null' => TRUE,
|
||||
|
@@ -7,8 +7,8 @@ dependencies[] = field
|
||||
files[] = field_sql_storage.test
|
||||
required = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -188,7 +188,7 @@ function _field_sql_storage_schema($field) {
|
||||
foreach ($field['foreign keys'] as $specifier => $specification) {
|
||||
$real_name = _field_sql_storage_indexname($field['field_name'], $specifier);
|
||||
$current['foreign keys'][$real_name]['table'] = $specification['table'];
|
||||
foreach ($specification['columns'] as $column => $referenced) {
|
||||
foreach ($specification['columns'] as $column_name => $referenced) {
|
||||
$sql_storage_column = _field_sql_storage_columnname($field['field_name'], $column_name);
|
||||
$current['foreign keys'][$real_name]['columns'][$sql_storage_column] = $referenced;
|
||||
}
|
||||
|
@@ -126,7 +126,7 @@ class FieldSqlStorageTestCase extends DrupalWebTestCase {
|
||||
$rows = db_select($this->table, 't')->fields('t')->execute()->fetchAllAssoc('delta', PDO::FETCH_ASSOC);
|
||||
foreach ($values as $delta => $value) {
|
||||
if ($delta < $this->field['cardinality']) {
|
||||
$this->assertEqual($rows[$delta][$this->field_name . '_value'], $value['value'], t("Value $delta is inserted correctly"));
|
||||
$this->assertEqual($rows[$delta][$this->field_name . '_value'], $value['value'], format_string("Value %delta is inserted correctly", array('%delta' => $delta)));
|
||||
}
|
||||
else {
|
||||
$this->assertFalse(array_key_exists($delta, $rows), "No extraneous value gets inserted.");
|
||||
@@ -145,7 +145,7 @@ class FieldSqlStorageTestCase extends DrupalWebTestCase {
|
||||
$rows = db_select($this->table, 't')->fields('t')->execute()->fetchAllAssoc('delta', PDO::FETCH_ASSOC);
|
||||
foreach ($values as $delta => $value) {
|
||||
if ($delta < $this->field['cardinality']) {
|
||||
$this->assertEqual($rows[$delta][$this->field_name . '_value'], $value['value'], t("Value $delta is updated correctly"));
|
||||
$this->assertEqual($rows[$delta][$this->field_name . '_value'], $value['value'], format_string("Value %delta is updated correctly", array('%delta' => $delta)));
|
||||
}
|
||||
else {
|
||||
$this->assertFalse(array_key_exists($delta, $rows), "No extraneous value gets updated.");
|
||||
@@ -175,7 +175,7 @@ class FieldSqlStorageTestCase extends DrupalWebTestCase {
|
||||
$rows = db_select($this->table, 't')->fields('t')->execute()->fetchAllAssoc('delta', PDO::FETCH_ASSOC);
|
||||
foreach ($values as $delta => $value) {
|
||||
if ($delta < $this->field['cardinality']) {
|
||||
$this->assertEqual($rows[$delta][$this->field_name . '_value'], $value['value'], t("Update with no field_name entry leaves value $delta untouched"));
|
||||
$this->assertEqual($rows[$delta][$this->field_name . '_value'], $value['value'], format_string("Update with no field_name entry leaves value %delta untouched", array('%delta' => $delta)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ class FieldSqlStorageTestCase extends DrupalWebTestCase {
|
||||
$entity->{$this->field_name} = NULL;
|
||||
field_attach_update($entity_type, $entity);
|
||||
$rows = db_select($this->table, 't')->fields('t')->execute()->fetchAllAssoc('delta', PDO::FETCH_ASSOC);
|
||||
$this->assertEqual(count($rows), 0, t("Update with an empty field_name entry empties the field."));
|
||||
$this->assertEqual(count($rows), 0, "Update with an empty field_name entry empties the field.");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -326,7 +326,7 @@ class FieldSqlStorageTestCase extends DrupalWebTestCase {
|
||||
|
||||
// Ensure that the field tables are still there.
|
||||
foreach (_field_sql_storage_schema($prior_field) as $table_name => $table_info) {
|
||||
$this->assertTrue(db_table_exists($table_name), t('Table %table exists.', array('%table' => $table_name)));
|
||||
$this->assertTrue(db_table_exists($table_name), format_string('Table %table exists.', array('%table' => $table_name)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -345,8 +345,8 @@ class FieldSqlStorageTestCase extends DrupalWebTestCase {
|
||||
|
||||
// Verify the indexes we will create do not exist yet.
|
||||
foreach ($tables as $table) {
|
||||
$this->assertFalse(Database::getConnection()->schema()->indexExists($table, 'value'), t("No index named value exists in $table"));
|
||||
$this->assertFalse(Database::getConnection()->schema()->indexExists($table, 'value_format'), t("No index named value_format exists in $table"));
|
||||
$this->assertFalse(Database::getConnection()->schema()->indexExists($table, 'value'), format_string("No index named value exists in %table", array('%table' => $table)));
|
||||
$this->assertFalse(Database::getConnection()->schema()->indexExists($table, 'value_format'), format_string("No index named value_format exists in %table", array('%table' => $table)));
|
||||
}
|
||||
|
||||
// Add data so the table cannot be dropped.
|
||||
@@ -358,21 +358,21 @@ class FieldSqlStorageTestCase extends DrupalWebTestCase {
|
||||
$field = array('field_name' => $field_name, 'indexes' => array('value' => array('value')));
|
||||
field_update_field($field);
|
||||
foreach ($tables as $table) {
|
||||
$this->assertTrue(Database::getConnection()->schema()->indexExists($table, "{$field_name}_value"), t("Index on value created in $table"));
|
||||
$this->assertTrue(Database::getConnection()->schema()->indexExists($table, "{$field_name}_value"), format_string("Index on value created in %table", array('%table' => $table)));
|
||||
}
|
||||
|
||||
// Add a different index, removing the existing custom one.
|
||||
$field = array('field_name' => $field_name, 'indexes' => array('value_format' => array('value', 'format')));
|
||||
field_update_field($field);
|
||||
foreach ($tables as $table) {
|
||||
$this->assertTrue(Database::getConnection()->schema()->indexExists($table, "{$field_name}_value_format"), t("Index on value_format created in $table"));
|
||||
$this->assertFalse(Database::getConnection()->schema()->indexExists($table, "{$field_name}_value"), t("Index on value removed in $table"));
|
||||
$this->assertTrue(Database::getConnection()->schema()->indexExists($table, "{$field_name}_value_format"), format_string("Index on value_format created in %table", array('%table' => $table)));
|
||||
$this->assertFalse(Database::getConnection()->schema()->indexExists($table, "{$field_name}_value"), format_string("Index on value removed in %table", array('%table' => $table)));
|
||||
}
|
||||
|
||||
// Verify that the tables were not dropped.
|
||||
$entity = field_test_create_stub_entity(0, 0, $instance['bundle']);
|
||||
field_attach_load('test_entity', array(0 => $entity));
|
||||
$this->assertEqual($entity->{$field_name}[LANGUAGE_NONE][0]['value'], 'field data', t("Index changes performed without dropping the tables"));
|
||||
$this->assertEqual($entity->{$field_name}[LANGUAGE_NONE][0]['value'], 'field data', "Index changes performed without dropping the tables");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -387,19 +387,19 @@ class FieldSqlStorageTestCase extends DrupalWebTestCase {
|
||||
$instance = field_info_instance($this->instance['entity_type'], $this->instance['field_name'], $this->instance['bundle']);
|
||||
|
||||
// The storage details are indexed by a storage engine type.
|
||||
$this->assertTrue(array_key_exists('sql', $field['storage']['details']), t('The storage type is SQL.'));
|
||||
$this->assertTrue(array_key_exists('sql', $field['storage']['details']), 'The storage type is SQL.');
|
||||
|
||||
// The SQL details are indexed by table name.
|
||||
$details = $field['storage']['details']['sql'];
|
||||
$this->assertTrue(array_key_exists($current, $details[FIELD_LOAD_CURRENT]), t('Table name is available in the instance array.'));
|
||||
$this->assertTrue(array_key_exists($revision, $details[FIELD_LOAD_REVISION]), t('Revision table name is available in the instance array.'));
|
||||
$this->assertTrue(array_key_exists($current, $details[FIELD_LOAD_CURRENT]), 'Table name is available in the instance array.');
|
||||
$this->assertTrue(array_key_exists($revision, $details[FIELD_LOAD_REVISION]), 'Revision table name is available in the instance array.');
|
||||
|
||||
// Test current and revision storage details together because the columns
|
||||
// are the same.
|
||||
foreach ((array) $this->field['columns'] as $column_name => $attributes) {
|
||||
$storage_column_name = _field_sql_storage_columnname($this->field['field_name'], $column_name);
|
||||
$this->assertEqual($details[FIELD_LOAD_CURRENT][$current][$column_name], $storage_column_name, t('Column name %value matches the definition in %bin.', array('%value' => $column_name, '%bin' => $current)));
|
||||
$this->assertEqual($details[FIELD_LOAD_REVISION][$revision][$column_name], $storage_column_name, t('Column name %value matches the definition in %bin.', array('%value' => $column_name, '%bin' => $revision)));
|
||||
$this->assertEqual($details[FIELD_LOAD_CURRENT][$current][$column_name], $storage_column_name, format_string('Column name %value matches the definition in %bin.', array('%value' => $column_name, '%bin' => $current)));
|
||||
$this->assertEqual($details[FIELD_LOAD_REVISION][$revision][$column_name], $storage_column_name, format_string('Column name %value matches the definition in %bin.', array('%value' => $column_name, '%bin' => $revision)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -407,21 +407,35 @@ class FieldSqlStorageTestCase extends DrupalWebTestCase {
|
||||
* Test foreign key support.
|
||||
*/
|
||||
function testFieldSqlStorageForeignKeys() {
|
||||
// Create a decimal field.
|
||||
// Create a 'shape' field, with a configurable foreign key (see
|
||||
// field_test_field_schema()).
|
||||
$field_name = 'testfield';
|
||||
$field = array('field_name' => $field_name, 'type' => 'text');
|
||||
$field = field_create_field($field);
|
||||
// Retrieve the field and instance with field_info and verify the foreign
|
||||
// keys are in place.
|
||||
$foreign_key_name = 'shape';
|
||||
$field = array('field_name' => $field_name, 'type' => 'shape', 'settings' => array('foreign_key_name' => $foreign_key_name));
|
||||
field_create_field($field);
|
||||
|
||||
// Retrieve the field definition and check that the foreign key is in place.
|
||||
$field = field_info_field($field_name);
|
||||
$this->assertEqual($field['foreign keys']['format']['table'], 'filter_format', t('Foreign key table name preserved through CRUD'));
|
||||
$this->assertEqual($field['foreign keys']['format']['columns']['format'], 'format', t('Foreign key column name preserved through CRUD'));
|
||||
$this->assertEqual($field['foreign keys'][$foreign_key_name]['table'], $foreign_key_name, 'Foreign key table name preserved through CRUD');
|
||||
$this->assertEqual($field['foreign keys'][$foreign_key_name]['columns'][$foreign_key_name], 'id', 'Foreign key column name preserved through CRUD');
|
||||
|
||||
// Update the field settings, it should update the foreign key definition
|
||||
// too.
|
||||
$foreign_key_name = 'color';
|
||||
$field['settings']['foreign_key_name'] = $foreign_key_name;
|
||||
field_update_field($field);
|
||||
|
||||
// Retrieve the field definition and check that the foreign key is in place.
|
||||
$field = field_info_field($field_name);
|
||||
$this->assertEqual($field['foreign keys'][$foreign_key_name]['table'], $foreign_key_name, 'Foreign key table name modified after update');
|
||||
$this->assertEqual($field['foreign keys'][$foreign_key_name]['columns'][$foreign_key_name], 'id', 'Foreign key column name modified after update');
|
||||
|
||||
// Now grab the SQL schema and verify that too.
|
||||
$schema = drupal_get_schema(_field_sql_storage_tablename($field));
|
||||
$this->assertEqual(count($schema['foreign keys']), 1, t("There is 1 foreign key in the schema"));
|
||||
$schema = drupal_get_schema(_field_sql_storage_tablename($field), TRUE);
|
||||
$this->assertEqual(count($schema['foreign keys']), 1, 'There is 1 foreign key in the schema');
|
||||
$foreign_key = reset($schema['foreign keys']);
|
||||
$filter_column = _field_sql_storage_columnname($field['field_name'], 'format');
|
||||
$this->assertEqual($foreign_key['table'], 'filter_format', t('Foreign key table name preserved in the schema'));
|
||||
$this->assertEqual($foreign_key['columns'][$filter_column], 'format', t('Foreign key column name preserved in the schema'));
|
||||
$foreign_key_column = _field_sql_storage_columnname($field['field_name'], $foreign_key_name);
|
||||
$this->assertEqual($foreign_key['table'], $foreign_key_name, 'Foreign key table name preserved in the schema');
|
||||
$this->assertEqual($foreign_key['columns'][$foreign_key_column], 'id', 'Foreign key column name preserved in the schema');
|
||||
}
|
||||
}
|
||||
|
@@ -7,8 +7,8 @@ dependencies[] = field
|
||||
dependencies[] = options
|
||||
files[] = tests/list.test
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -51,9 +51,9 @@ class ListFieldTestCase extends FieldTestCase {
|
||||
// All three options appear.
|
||||
$entity = field_test_create_stub_entity();
|
||||
$form = drupal_get_form('field_test_entity_form', $entity);
|
||||
$this->assertTrue(!empty($form[$this->field_name][$langcode][1]), t('Option 1 exists'));
|
||||
$this->assertTrue(!empty($form[$this->field_name][$langcode][2]), t('Option 2 exists'));
|
||||
$this->assertTrue(!empty($form[$this->field_name][$langcode][3]), t('Option 3 exists'));
|
||||
$this->assertTrue(!empty($form[$this->field_name][$langcode][1]), 'Option 1 exists');
|
||||
$this->assertTrue(!empty($form[$this->field_name][$langcode][2]), 'Option 2 exists');
|
||||
$this->assertTrue(!empty($form[$this->field_name][$langcode][3]), 'Option 3 exists');
|
||||
|
||||
// Use one of the values in an actual entity, and check that this value
|
||||
// cannot be removed from the list.
|
||||
@@ -77,19 +77,19 @@ class ListFieldTestCase extends FieldTestCase {
|
||||
field_update_field($this->field);
|
||||
$entity = field_test_create_stub_entity();
|
||||
$form = drupal_get_form('field_test_entity_form', $entity);
|
||||
$this->assertTrue(empty($form[$this->field_name][$langcode][1]), t('Option 1 does not exist'));
|
||||
$this->assertTrue(!empty($form[$this->field_name][$langcode][2]), t('Option 2 exists'));
|
||||
$this->assertTrue(empty($form[$this->field_name][$langcode][3]), t('Option 3 does not exist'));
|
||||
$this->assertTrue(empty($form[$this->field_name][$langcode][1]), 'Option 1 does not exist');
|
||||
$this->assertTrue(!empty($form[$this->field_name][$langcode][2]), 'Option 2 exists');
|
||||
$this->assertTrue(empty($form[$this->field_name][$langcode][3]), 'Option 3 does not exist');
|
||||
|
||||
// Completely new options appear.
|
||||
$this->field['settings']['allowed_values'] = array(10 => 'Update', 20 => 'Twenty');
|
||||
field_update_field($this->field);
|
||||
$form = drupal_get_form('field_test_entity_form', $entity);
|
||||
$this->assertTrue(empty($form[$this->field_name][$langcode][1]), t('Option 1 does not exist'));
|
||||
$this->assertTrue(empty($form[$this->field_name][$langcode][2]), t('Option 2 does not exist'));
|
||||
$this->assertTrue(empty($form[$this->field_name][$langcode][3]), t('Option 3 does not exist'));
|
||||
$this->assertTrue(!empty($form[$this->field_name][$langcode][10]), t('Option 10 exists'));
|
||||
$this->assertTrue(!empty($form[$this->field_name][$langcode][20]), t('Option 20 exists'));
|
||||
$this->assertTrue(empty($form[$this->field_name][$langcode][1]), 'Option 1 does not exist');
|
||||
$this->assertTrue(empty($form[$this->field_name][$langcode][2]), 'Option 2 does not exist');
|
||||
$this->assertTrue(empty($form[$this->field_name][$langcode][3]), 'Option 3 does not exist');
|
||||
$this->assertTrue(!empty($form[$this->field_name][$langcode][10]), 'Option 10 exists');
|
||||
$this->assertTrue(!empty($form[$this->field_name][$langcode][20]), 'Option 20 exists');
|
||||
|
||||
// Options are reset when a new field with the same name is created.
|
||||
field_delete_field($this->field_name);
|
||||
@@ -107,9 +107,9 @@ class ListFieldTestCase extends FieldTestCase {
|
||||
$this->instance = field_create_instance($this->instance);
|
||||
$entity = field_test_create_stub_entity();
|
||||
$form = drupal_get_form('field_test_entity_form', $entity);
|
||||
$this->assertTrue(!empty($form[$this->field_name][$langcode][1]), t('Option 1 exists'));
|
||||
$this->assertTrue(!empty($form[$this->field_name][$langcode][2]), t('Option 2 exists'));
|
||||
$this->assertTrue(!empty($form[$this->field_name][$langcode][3]), t('Option 3 exists'));
|
||||
$this->assertTrue(!empty($form[$this->field_name][$langcode][1]), 'Option 1 exists');
|
||||
$this->assertTrue(!empty($form[$this->field_name][$langcode][2]), 'Option 2 exists');
|
||||
$this->assertTrue(!empty($form[$this->field_name][$langcode][3]), 'Option 3 exists');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,20 +233,20 @@ class ListFieldUITestCase extends FieldTestCase {
|
||||
// Flat list of textual values.
|
||||
$string = "Zero\nOne";
|
||||
$array = array('0' => 'Zero', '1' => 'One');
|
||||
$this->assertAllowedValuesInput($string, $array, t('Unkeyed lists are accepted.'));
|
||||
$this->assertAllowedValuesInput($string, $array, 'Unkeyed lists are accepted.');
|
||||
// Explicit integer keys.
|
||||
$string = "0|Zero\n2|Two";
|
||||
$array = array('0' => 'Zero', '2' => 'Two');
|
||||
$this->assertAllowedValuesInput($string, $array, t('Integer keys are accepted.'));
|
||||
$this->assertAllowedValuesInput($string, $array, 'Integer keys are accepted.');
|
||||
// Check that values can be added and removed.
|
||||
$string = "0|Zero\n1|One";
|
||||
$array = array('0' => 'Zero', '1' => 'One');
|
||||
$this->assertAllowedValuesInput($string, $array, t('Values can be added and removed.'));
|
||||
$this->assertAllowedValuesInput($string, $array, 'Values can be added and removed.');
|
||||
// Non-integer keys.
|
||||
$this->assertAllowedValuesInput("1.1|One", 'keys must be integers', t('Non integer keys are rejected.'));
|
||||
$this->assertAllowedValuesInput("abc|abc", 'keys must be integers', t('Non integer keys are rejected.'));
|
||||
$this->assertAllowedValuesInput("1.1|One", 'keys must be integers', 'Non integer keys are rejected.');
|
||||
$this->assertAllowedValuesInput("abc|abc", 'keys must be integers', 'Non integer keys are rejected.');
|
||||
// Mixed list of keyed and unkeyed values.
|
||||
$this->assertAllowedValuesInput("Zero\n1|One", 'invalid input', t('Mixed lists are rejected.'));
|
||||
$this->assertAllowedValuesInput("Zero\n1|One", 'invalid input', 'Mixed lists are rejected.');
|
||||
|
||||
// Create a node with actual data for the field.
|
||||
$settings = array(
|
||||
@@ -256,22 +256,22 @@ class ListFieldUITestCase extends FieldTestCase {
|
||||
$node = $this->drupalCreateNode($settings);
|
||||
|
||||
// Check that a flat list of values is rejected once the field has data.
|
||||
$this->assertAllowedValuesInput( "Zero\nOne", 'invalid input', t('Unkeyed lists are rejected once the field has data.'));
|
||||
$this->assertAllowedValuesInput( "Zero\nOne", 'invalid input', 'Unkeyed lists are rejected once the field has data.');
|
||||
|
||||
// Check that values can be added but values in use cannot be removed.
|
||||
$string = "0|Zero\n1|One\n2|Two";
|
||||
$array = array('0' => 'Zero', '1' => 'One', '2' => 'Two');
|
||||
$this->assertAllowedValuesInput($string, $array, t('Values can be added.'));
|
||||
$this->assertAllowedValuesInput($string, $array, 'Values can be added.');
|
||||
$string = "0|Zero\n1|One";
|
||||
$array = array('0' => 'Zero', '1' => 'One');
|
||||
$this->assertAllowedValuesInput($string, $array, t('Values not in use can be removed.'));
|
||||
$this->assertAllowedValuesInput("0|Zero", 'some values are being removed while currently in use', t('Values in use cannot be removed.'));
|
||||
$this->assertAllowedValuesInput($string, $array, 'Values not in use can be removed.');
|
||||
$this->assertAllowedValuesInput("0|Zero", 'some values are being removed while currently in use', 'Values in use cannot be removed.');
|
||||
|
||||
// Delete the node, remove the value.
|
||||
node_delete($node->nid);
|
||||
$string = "0|Zero";
|
||||
$array = array('0' => 'Zero');
|
||||
$this->assertAllowedValuesInput($string, $array, t('Values not in use can be removed.'));
|
||||
$this->assertAllowedValuesInput($string, $array, 'Values not in use can be removed.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -284,19 +284,19 @@ class ListFieldUITestCase extends FieldTestCase {
|
||||
// Flat list of textual values.
|
||||
$string = "Zero\nOne";
|
||||
$array = array('0' => 'Zero', '1' => 'One');
|
||||
$this->assertAllowedValuesInput($string, $array, t('Unkeyed lists are accepted.'));
|
||||
$this->assertAllowedValuesInput($string, $array, 'Unkeyed lists are accepted.');
|
||||
// Explicit numeric keys.
|
||||
$string = "0|Zero\n.5|Point five";
|
||||
$array = array('0' => 'Zero', '0.5' => 'Point five');
|
||||
$this->assertAllowedValuesInput($string, $array, t('Integer keys are accepted.'));
|
||||
$this->assertAllowedValuesInput($string, $array, 'Integer keys are accepted.');
|
||||
// Check that values can be added and removed.
|
||||
$string = "0|Zero\n.5|Point five\n1.0|One";
|
||||
$array = array('0' => 'Zero', '0.5' => 'Point five', '1' => 'One');
|
||||
$this->assertAllowedValuesInput($string, $array, t('Values can be added and removed.'));
|
||||
$this->assertAllowedValuesInput($string, $array, 'Values can be added and removed.');
|
||||
// Non-numeric keys.
|
||||
$this->assertAllowedValuesInput("abc|abc\n", 'each key must be a valid integer or decimal', t('Non numeric keys are rejected.'));
|
||||
$this->assertAllowedValuesInput("abc|abc\n", 'each key must be a valid integer or decimal', 'Non numeric keys are rejected.');
|
||||
// Mixed list of keyed and unkeyed values.
|
||||
$this->assertAllowedValuesInput("Zero\n1|One\n", 'invalid input', t('Mixed lists are rejected.'));
|
||||
$this->assertAllowedValuesInput("Zero\n1|One\n", 'invalid input', 'Mixed lists are rejected.');
|
||||
|
||||
// Create a node with actual data for the field.
|
||||
$settings = array(
|
||||
@@ -306,22 +306,22 @@ class ListFieldUITestCase extends FieldTestCase {
|
||||
$node = $this->drupalCreateNode($settings);
|
||||
|
||||
// Check that a flat list of values is rejected once the field has data.
|
||||
$this->assertAllowedValuesInput("Zero\nOne", 'invalid input', t('Unkeyed lists are rejected once the field has data.'));
|
||||
$this->assertAllowedValuesInput("Zero\nOne", 'invalid input', 'Unkeyed lists are rejected once the field has data.');
|
||||
|
||||
// Check that values can be added but values in use cannot be removed.
|
||||
$string = "0|Zero\n.5|Point five\n2|Two";
|
||||
$array = array('0' => 'Zero', '0.5' => 'Point five', '2' => 'Two');
|
||||
$this->assertAllowedValuesInput($string, $array, t('Values can be added.'));
|
||||
$this->assertAllowedValuesInput($string, $array, 'Values can be added.');
|
||||
$string = "0|Zero\n.5|Point five";
|
||||
$array = array('0' => 'Zero', '0.5' => 'Point five');
|
||||
$this->assertAllowedValuesInput($string, $array, t('Values not in use can be removed.'));
|
||||
$this->assertAllowedValuesInput("0|Zero", 'some values are being removed while currently in use', t('Values in use cannot be removed.'));
|
||||
$this->assertAllowedValuesInput($string, $array, 'Values not in use can be removed.');
|
||||
$this->assertAllowedValuesInput("0|Zero", 'some values are being removed while currently in use', 'Values in use cannot be removed.');
|
||||
|
||||
// Delete the node, remove the value.
|
||||
node_delete($node->nid);
|
||||
$string = "0|Zero";
|
||||
$array = array('0' => 'Zero');
|
||||
$this->assertAllowedValuesInput($string, $array, t('Values not in use can be removed.'));
|
||||
$this->assertAllowedValuesInput($string, $array, 'Values not in use can be removed.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -334,21 +334,21 @@ class ListFieldUITestCase extends FieldTestCase {
|
||||
// Flat list of textual values.
|
||||
$string = "Zero\nOne";
|
||||
$array = array('Zero' => 'Zero', 'One' => 'One');
|
||||
$this->assertAllowedValuesInput($string, $array, t('Unkeyed lists are accepted.'));
|
||||
$this->assertAllowedValuesInput($string, $array, 'Unkeyed lists are accepted.');
|
||||
// Explicit keys.
|
||||
$string = "zero|Zero\none|One";
|
||||
$array = array('zero' => 'Zero', 'one' => 'One');
|
||||
$this->assertAllowedValuesInput($string, $array, t('Explicit keys are accepted.'));
|
||||
$this->assertAllowedValuesInput($string, $array, 'Explicit keys are accepted.');
|
||||
// Check that values can be added and removed.
|
||||
$string = "zero|Zero\ntwo|Two";
|
||||
$array = array('zero' => 'Zero', 'two' => 'Two');
|
||||
$this->assertAllowedValuesInput($string, $array, t('Values can be added and removed.'));
|
||||
$this->assertAllowedValuesInput($string, $array, 'Values can be added and removed.');
|
||||
// Mixed list of keyed and unkeyed values.
|
||||
$string = "zero|Zero\nOne\n";
|
||||
$array = array('zero' => 'Zero', 'One' => 'One');
|
||||
$this->assertAllowedValuesInput($string, $array, t('Mixed lists are accepted.'));
|
||||
$this->assertAllowedValuesInput($string, $array, 'Mixed lists are accepted.');
|
||||
// Overly long keys.
|
||||
$this->assertAllowedValuesInput("zero|Zero\n" . $this->randomName(256) . "|One", 'each key must be a string at most 255 characters long', t('Overly long keys are rejected.'));
|
||||
$this->assertAllowedValuesInput("zero|Zero\n" . $this->randomName(256) . "|One", 'each key must be a string at most 255 characters long', 'Overly long keys are rejected.');
|
||||
|
||||
// Create a node with actual data for the field.
|
||||
$settings = array(
|
||||
@@ -361,22 +361,22 @@ class ListFieldUITestCase extends FieldTestCase {
|
||||
// data.
|
||||
$string = "Zero\nOne";
|
||||
$array = array('Zero' => 'Zero', 'One' => 'One');
|
||||
$this->assertAllowedValuesInput($string, $array, t('Unkeyed lists are still accepted once the field has data.'));
|
||||
$this->assertAllowedValuesInput($string, $array, 'Unkeyed lists are still accepted once the field has data.');
|
||||
|
||||
// Check that values can be added but values in use cannot be removed.
|
||||
$string = "Zero\nOne\nTwo";
|
||||
$array = array('Zero' => 'Zero', 'One' => 'One', 'Two' => 'Two');
|
||||
$this->assertAllowedValuesInput($string, $array, t('Values can be added.'));
|
||||
$this->assertAllowedValuesInput($string, $array, 'Values can be added.');
|
||||
$string = "Zero\nOne";
|
||||
$array = array('Zero' => 'Zero', 'One' => 'One');
|
||||
$this->assertAllowedValuesInput($string, $array, t('Values not in use can be removed.'));
|
||||
$this->assertAllowedValuesInput("Zero", 'some values are being removed while currently in use', t('Values in use cannot be removed.'));
|
||||
$this->assertAllowedValuesInput($string, $array, 'Values not in use can be removed.');
|
||||
$this->assertAllowedValuesInput("Zero", 'some values are being removed while currently in use', 'Values in use cannot be removed.');
|
||||
|
||||
// Delete the node, remove the value.
|
||||
node_delete($node->nid);
|
||||
$string = "Zero";
|
||||
$array = array('Zero' => 'Zero');
|
||||
$this->assertAllowedValuesInput($string, $array, t('Values not in use can be removed.'));
|
||||
$this->assertAllowedValuesInput($string, $array, 'Values not in use can be removed.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -395,15 +395,15 @@ class ListFieldUITestCase extends FieldTestCase {
|
||||
'off' => $off,
|
||||
);
|
||||
$this->drupalPost($this->admin_path, $edit, t('Save settings'));
|
||||
$this->assertText("Saved field_list_boolean configuration.", t("The 'On' and 'Off' form fields work for boolean fields."));
|
||||
$this->assertText("Saved field_list_boolean configuration.", "The 'On' and 'Off' form fields work for boolean fields.");
|
||||
// Test the allowed_values on the field settings form.
|
||||
$this->drupalGet($this->admin_path);
|
||||
$this->assertFieldByName('on', $on, t("The 'On' value is stored correctly."));
|
||||
$this->assertFieldByName('off', $off, t("The 'Off' value is stored correctly."));
|
||||
$this->assertFieldByName('on', $on, "The 'On' value is stored correctly.");
|
||||
$this->assertFieldByName('off', $off, "The 'Off' value is stored correctly.");
|
||||
$field = field_info_field($this->field_name);
|
||||
$this->assertEqual($field['settings']['allowed_values'], $allowed_values, t('The allowed value is correct'));
|
||||
$this->assertFalse(isset($field['settings']['on']), t('The on value is not saved into settings'));
|
||||
$this->assertFalse(isset($field['settings']['off']), t('The off value is not saved into settings'));
|
||||
$this->assertEqual($field['settings']['allowed_values'], $allowed_values, 'The allowed value is correct');
|
||||
$this->assertFalse(isset($field['settings']['on']), 'The on value is not saved into settings');
|
||||
$this->assertFalse(isset($field['settings']['off']), 'The off value is not saved into settings');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -5,8 +5,8 @@ package = Testing
|
||||
version = VERSION
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
dependencies[] = field
|
||||
files[] = number.test
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -58,7 +58,7 @@ class NumberFieldTestCase extends DrupalWebTestCase {
|
||||
// Display creation form.
|
||||
$this->drupalGet('test-entity/add/test-bundle');
|
||||
$langcode = LANGUAGE_NONE;
|
||||
$this->assertFieldByName("{$this->field['field_name']}[$langcode][0][value]", '', t('Widget is displayed'));
|
||||
$this->assertFieldByName("{$this->field['field_name']}[$langcode][0][value]", '', 'Widget is displayed');
|
||||
|
||||
// Submit a signed decimal value within the allowed precision and scale.
|
||||
$value = '-1234.5678';
|
||||
@@ -68,8 +68,8 @@ class NumberFieldTestCase extends DrupalWebTestCase {
|
||||
$this->drupalPost(NULL, $edit, t('Save'));
|
||||
preg_match('|test-entity/manage/(\d+)/edit|', $this->url, $match);
|
||||
$id = $match[1];
|
||||
$this->assertRaw(t('test_entity @id has been created.', array('@id' => $id)), t('Entity was created'));
|
||||
$this->assertRaw(round($value, 2), t('Value is displayed.'));
|
||||
$this->assertRaw(t('test_entity @id has been created.', array('@id' => $id)), 'Entity was created');
|
||||
$this->assertRaw(round($value, 2), 'Value is displayed.');
|
||||
|
||||
// Try to create entries with more than one decimal separator; assert fail.
|
||||
$wrong_entries = array(
|
||||
@@ -89,7 +89,7 @@ class NumberFieldTestCase extends DrupalWebTestCase {
|
||||
$this->assertText(
|
||||
t('There should only be one decimal separator (@separator)',
|
||||
array('@separator' => $this->field['settings']['decimal_separator'])),
|
||||
t('Correctly failed to save decimal value with more than one decimal point.')
|
||||
'Correctly failed to save decimal value with more than one decimal point.'
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
dependencies[] = field
|
||||
files[] = options.test
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @file
|
||||
* Tests for options.module.
|
||||
*/
|
||||
|
||||
@@ -85,7 +85,7 @@ class OptionsWidgetsTestCase extends FieldTestCase {
|
||||
$this->assertNoFieldChecked("edit-card-1-$langcode-0");
|
||||
$this->assertNoFieldChecked("edit-card-1-$langcode-1");
|
||||
$this->assertNoFieldChecked("edit-card-1-$langcode-2");
|
||||
$this->assertRaw('Some dangerous & unescaped <strong>markup</strong>', t('Option text was properly filtered.'));
|
||||
$this->assertRaw('Some dangerous & unescaped <strong>markup</strong>', 'Option text was properly filtered.');
|
||||
|
||||
// Select first option.
|
||||
$edit = array("card_1[$langcode]" => 0);
|
||||
@@ -139,7 +139,7 @@ class OptionsWidgetsTestCase extends FieldTestCase {
|
||||
$this->assertNoFieldChecked("edit-card-2-$langcode-0");
|
||||
$this->assertNoFieldChecked("edit-card-2-$langcode-1");
|
||||
$this->assertNoFieldChecked("edit-card-2-$langcode-2");
|
||||
$this->assertRaw('Some dangerous & unescaped <strong>markup</strong>', t('Option text was properly filtered.'));
|
||||
$this->assertRaw('Some dangerous & unescaped <strong>markup</strong>', 'Option text was properly filtered.');
|
||||
|
||||
// Submit form: select first and third options.
|
||||
$edit = array(
|
||||
@@ -178,7 +178,7 @@ class OptionsWidgetsTestCase extends FieldTestCase {
|
||||
"card_2[$langcode][2]" => TRUE,
|
||||
);
|
||||
$this->drupalPost(NULL, $edit, t('Save'));
|
||||
$this->assertText('this field cannot hold more than 2 values', t('Validation error was displayed.'));
|
||||
$this->assertText('this field cannot hold more than 2 values', 'Validation error was displayed.');
|
||||
|
||||
// Submit form: uncheck all options.
|
||||
$edit = array(
|
||||
@@ -225,19 +225,19 @@ class OptionsWidgetsTestCase extends FieldTestCase {
|
||||
// Display form.
|
||||
$this->drupalGet('test-entity/manage/' . $entity->ftid . '/edit');
|
||||
// A required field without any value has a "none" option.
|
||||
$this->assertTrue($this->xpath('//select[@id=:id]//option[@value="_none" and text()=:label]', array(':id' => 'edit-card-1-' . $langcode, ':label' => t('- Select a value -'))), t('A required select list has a "Select a value" choice.'));
|
||||
$this->assertTrue($this->xpath('//select[@id=:id]//option[@value="_none" and text()=:label]', array(':id' => 'edit-card-1-' . $langcode, ':label' => t('- Select a value -'))), 'A required select list has a "Select a value" choice.');
|
||||
|
||||
// With no field data, nothing is selected.
|
||||
$this->assertNoOptionSelected("edit-card-1-$langcode", '_none');
|
||||
$this->assertNoOptionSelected("edit-card-1-$langcode", 0);
|
||||
$this->assertNoOptionSelected("edit-card-1-$langcode", 1);
|
||||
$this->assertNoOptionSelected("edit-card-1-$langcode", 2);
|
||||
$this->assertRaw('Some dangerous & unescaped markup', t('Option text was properly filtered.'));
|
||||
$this->assertRaw('Some dangerous & unescaped markup', 'Option text was properly filtered.');
|
||||
|
||||
// Submit form: select invalid 'none' option.
|
||||
$edit = array("card_1[$langcode]" => '_none');
|
||||
$this->drupalPost(NULL, $edit, t('Save'));
|
||||
$this->assertRaw(t('!title field is required.', array('!title' => $instance['field_name'])), t('Cannot save a required field when selecting "none" from the select list.'));
|
||||
$this->assertRaw(t('!title field is required.', array('!title' => $instance['field_name'])), 'Cannot save a required field when selecting "none" from the select list.');
|
||||
|
||||
// Submit form: select first option.
|
||||
$edit = array("card_1[$langcode]" => 0);
|
||||
@@ -247,7 +247,7 @@ class OptionsWidgetsTestCase extends FieldTestCase {
|
||||
// Display form: check that the right options are selected.
|
||||
$this->drupalGet('test-entity/manage/' . $entity->ftid . '/edit');
|
||||
// A required field with a value has no 'none' option.
|
||||
$this->assertFalse($this->xpath('//select[@id=:id]//option[@value="_none"]', array(':id' => 'edit-card-1-' . $langcode)), t('A required select list with an actual value has no "none" choice.'));
|
||||
$this->assertFalse($this->xpath('//select[@id=:id]//option[@value="_none"]', array(':id' => 'edit-card-1-' . $langcode)), 'A required select list with an actual value has no "none" choice.');
|
||||
$this->assertOptionSelected("edit-card-1-$langcode", 0);
|
||||
$this->assertNoOptionSelected("edit-card-1-$langcode", 1);
|
||||
$this->assertNoOptionSelected("edit-card-1-$langcode", 2);
|
||||
@@ -259,7 +259,7 @@ class OptionsWidgetsTestCase extends FieldTestCase {
|
||||
// Display form.
|
||||
$this->drupalGet('test-entity/manage/' . $entity->ftid . '/edit');
|
||||
// A non-required field has a 'none' option.
|
||||
$this->assertTrue($this->xpath('//select[@id=:id]//option[@value="_none" and text()=:label]', array(':id' => 'edit-card-1-' . $langcode, ':label' => t('- None -'))), t('A non-required select list has a "None" choice.'));
|
||||
$this->assertTrue($this->xpath('//select[@id=:id]//option[@value="_none" and text()=:label]', array(':id' => 'edit-card-1-' . $langcode, ':label' => t('- None -'))), 'A non-required select list has a "None" choice.');
|
||||
// Submit form: Unselect the option.
|
||||
$edit = array("card_1[$langcode]" => '_none');
|
||||
$this->drupalPost('test-entity/manage/' . $entity->ftid . '/edit', $edit, t('Save'));
|
||||
@@ -276,8 +276,8 @@ class OptionsWidgetsTestCase extends FieldTestCase {
|
||||
$this->assertNoOptionSelected("edit-card-1-$langcode", 0);
|
||||
$this->assertNoOptionSelected("edit-card-1-$langcode", 1);
|
||||
$this->assertNoOptionSelected("edit-card-1-$langcode", 2);
|
||||
$this->assertRaw('Some dangerous & unescaped markup', t('Option text was properly filtered.'));
|
||||
$this->assertRaw('Group 1', t('Option groups are displayed.'));
|
||||
$this->assertRaw('Some dangerous & unescaped markup', 'Option text was properly filtered.');
|
||||
$this->assertRaw('Group 1', 'Option groups are displayed.');
|
||||
|
||||
// Submit form: select first option.
|
||||
$edit = array("card_1[$langcode]" => 0);
|
||||
@@ -323,7 +323,7 @@ class OptionsWidgetsTestCase extends FieldTestCase {
|
||||
$this->assertNoOptionSelected("edit-card-2-$langcode", 0);
|
||||
$this->assertNoOptionSelected("edit-card-2-$langcode", 1);
|
||||
$this->assertNoOptionSelected("edit-card-2-$langcode", 2);
|
||||
$this->assertRaw('Some dangerous & unescaped markup', t('Option text was properly filtered.'));
|
||||
$this->assertRaw('Some dangerous & unescaped markup', 'Option text was properly filtered.');
|
||||
|
||||
// Submit form: select first and third options.
|
||||
$edit = array("card_2[$langcode][]" => array(0 => 0, 2 => 2));
|
||||
@@ -350,7 +350,7 @@ class OptionsWidgetsTestCase extends FieldTestCase {
|
||||
// Submit form: select the three options while the field accepts only 2.
|
||||
$edit = array("card_2[$langcode][]" => array(0 => 0, 1 => 1, 2 => 2));
|
||||
$this->drupalPost(NULL, $edit, t('Save'));
|
||||
$this->assertText('this field cannot hold more than 2 values', t('Validation error was displayed.'));
|
||||
$this->assertText('this field cannot hold more than 2 values', 'Validation error was displayed.');
|
||||
|
||||
// Submit form: uncheck all options.
|
||||
$edit = array("card_2[$langcode][]" => array());
|
||||
@@ -374,7 +374,7 @@ class OptionsWidgetsTestCase extends FieldTestCase {
|
||||
$instance['required'] = TRUE;
|
||||
field_update_instance($instance);
|
||||
$this->drupalGet('test-entity/manage/' . $entity->ftid . '/edit');
|
||||
$this->assertFalse($this->xpath('//select[@id=:id]//option[@value=""]', array(':id' => 'edit-card-2-' . $langcode)), t('A required select list does not have an empty key.'));
|
||||
$this->assertFalse($this->xpath('//select[@id=:id]//option[@value=""]', array(':id' => 'edit-card-2-' . $langcode)), 'A required select list does not have an empty key.');
|
||||
|
||||
// We do not have to test that a required select list with one option is
|
||||
// auto-selected because the browser does it for us.
|
||||
@@ -393,8 +393,8 @@ class OptionsWidgetsTestCase extends FieldTestCase {
|
||||
$this->assertNoOptionSelected("edit-card-2-$langcode", 0);
|
||||
$this->assertNoOptionSelected("edit-card-2-$langcode", 1);
|
||||
$this->assertNoOptionSelected("edit-card-2-$langcode", 2);
|
||||
$this->assertRaw('Some dangerous & unescaped markup', t('Option text was properly filtered.'));
|
||||
$this->assertRaw('Group 1', t('Option groups are displayed.'));
|
||||
$this->assertRaw('Some dangerous & unescaped markup', 'Option text was properly filtered.');
|
||||
$this->assertRaw('Group 1', 'Option groups are displayed.');
|
||||
|
||||
// Submit form: select first option.
|
||||
$edit = array("card_2[$langcode][]" => array(0 => 0));
|
||||
@@ -438,7 +438,7 @@ class OptionsWidgetsTestCase extends FieldTestCase {
|
||||
// Display form: with no field data, option is unchecked.
|
||||
$this->drupalGet('test-entity/manage/' . $entity->ftid . '/edit');
|
||||
$this->assertNoFieldChecked("edit-bool-$langcode");
|
||||
$this->assertRaw('Some dangerous & unescaped <strong>markup</strong>', t('Option text was properly filtered.'));
|
||||
$this->assertRaw('Some dangerous & unescaped <strong>markup</strong>', 'Option text was properly filtered.');
|
||||
|
||||
// Submit form: check the option.
|
||||
$edit = array("bool[$langcode]" => TRUE);
|
||||
@@ -483,13 +483,13 @@ class OptionsWidgetsTestCase extends FieldTestCase {
|
||||
|
||||
$this->assertText(
|
||||
'Use field label instead of the "On value" as label ',
|
||||
t('Display setting checkbox available.')
|
||||
'Display setting checkbox available.'
|
||||
);
|
||||
|
||||
$this->assertFieldByXPath(
|
||||
'*//label[@for="edit-' . $this->bool['field_name'] . '-und" and text()="MyOnValue "]',
|
||||
TRUE,
|
||||
t('Default case shows "On value"')
|
||||
'Default case shows "On value"'
|
||||
);
|
||||
|
||||
// Enable setting
|
||||
@@ -502,16 +502,16 @@ class OptionsWidgetsTestCase extends FieldTestCase {
|
||||
$this->drupalGet($fieldEditUrl);
|
||||
$this->assertText(
|
||||
'Use field label instead of the "On value" as label ',
|
||||
t('Display setting checkbox is available')
|
||||
'Display setting checkbox is available'
|
||||
);
|
||||
$this->assertFieldChecked(
|
||||
'edit-instance-widget-settings-display-label',
|
||||
t('Display settings checkbox checked')
|
||||
'Display settings checkbox checked'
|
||||
);
|
||||
$this->assertFieldByXPath(
|
||||
'*//label[@for="edit-' . $this->bool['field_name'] . '-und" and text()="' . $this->bool['field_name'] . ' "]',
|
||||
TRUE,
|
||||
t('Display label changes label of the checkbox')
|
||||
'Display label changes label of the checkbox'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -7,8 +7,8 @@ dependencies[] = field
|
||||
files[] = text.test
|
||||
required = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -110,8 +110,8 @@ class TextFieldTestCase extends DrupalWebTestCase {
|
||||
|
||||
// Display creation form.
|
||||
$this->drupalGet('test-entity/add/test-bundle');
|
||||
$this->assertFieldByName("{$this->field_name}[$langcode][0][value]", '', t('Widget is displayed'));
|
||||
$this->assertNoFieldByName("{$this->field_name}[$langcode][0][format]", '1', t('Format selector is not displayed'));
|
||||
$this->assertFieldByName("{$this->field_name}[$langcode][0][value]", '', 'Widget is displayed');
|
||||
$this->assertNoFieldByName("{$this->field_name}[$langcode][0][format]", '1', 'Format selector is not displayed');
|
||||
|
||||
// Submit with some value.
|
||||
$value = $this->randomName();
|
||||
@@ -121,7 +121,7 @@ class TextFieldTestCase extends DrupalWebTestCase {
|
||||
$this->drupalPost(NULL, $edit, t('Save'));
|
||||
preg_match('|test-entity/manage/(\d+)/edit|', $this->url, $match);
|
||||
$id = $match[1];
|
||||
$this->assertRaw(t('test_entity @id has been created.', array('@id' => $id)), t('Entity was created'));
|
||||
$this->assertRaw(t('test_entity @id has been created.', array('@id' => $id)), 'Entity was created');
|
||||
|
||||
// Display the entity.
|
||||
$entity = field_test_entity_test_load($id);
|
||||
@@ -179,8 +179,8 @@ class TextFieldTestCase extends DrupalWebTestCase {
|
||||
// Display the creation form. Since the user only has access to one format,
|
||||
// no format selector will be displayed.
|
||||
$this->drupalGet('test-entity/add/test-bundle');
|
||||
$this->assertFieldByName("{$this->field_name}[$langcode][0][value]", '', t('Widget is displayed'));
|
||||
$this->assertNoFieldByName("{$this->field_name}[$langcode][0][format]", '', t('Format selector is not displayed'));
|
||||
$this->assertFieldByName("{$this->field_name}[$langcode][0][value]", '', 'Widget is displayed');
|
||||
$this->assertNoFieldByName("{$this->field_name}[$langcode][0][format]", '', 'Format selector is not displayed');
|
||||
|
||||
// Submit with data that should be filtered.
|
||||
$value = '<em>' . $this->randomName() . '</em>';
|
||||
@@ -190,14 +190,14 @@ class TextFieldTestCase extends DrupalWebTestCase {
|
||||
$this->drupalPost(NULL, $edit, t('Save'));
|
||||
preg_match('|test-entity/manage/(\d+)/edit|', $this->url, $match);
|
||||
$id = $match[1];
|
||||
$this->assertRaw(t('test_entity @id has been created.', array('@id' => $id)), t('Entity was created'));
|
||||
$this->assertRaw(t('test_entity @id has been created.', array('@id' => $id)), 'Entity was created');
|
||||
|
||||
// Display the entity.
|
||||
$entity = field_test_entity_test_load($id);
|
||||
$entity->content = field_attach_view($entity_type, $entity, 'full');
|
||||
$this->content = drupal_render($entity->content);
|
||||
$this->assertNoRaw($value, t('HTML tags are not displayed.'));
|
||||
$this->assertRaw(check_plain($value), t('Escaped HTML is displayed correctly.'));
|
||||
$this->assertNoRaw($value, 'HTML tags are not displayed.');
|
||||
$this->assertRaw(check_plain($value), 'Escaped HTML is displayed correctly.');
|
||||
|
||||
// Create a new text format that does not escape HTML, and grant the user
|
||||
// access to it.
|
||||
@@ -219,21 +219,21 @@ class TextFieldTestCase extends DrupalWebTestCase {
|
||||
// Display edition form.
|
||||
// We should now have a 'text format' selector.
|
||||
$this->drupalGet('test-entity/manage/' . $id . '/edit');
|
||||
$this->assertFieldByName("{$this->field_name}[$langcode][0][value]", NULL, t('Widget is displayed'));
|
||||
$this->assertFieldByName("{$this->field_name}[$langcode][0][format]", NULL, t('Format selector is displayed'));
|
||||
$this->assertFieldByName("{$this->field_name}[$langcode][0][value]", NULL, 'Widget is displayed');
|
||||
$this->assertFieldByName("{$this->field_name}[$langcode][0][format]", NULL, 'Format selector is displayed');
|
||||
|
||||
// Edit and change the text format to the new one that was created.
|
||||
$edit = array(
|
||||
"{$this->field_name}[$langcode][0][format]" => $format_id,
|
||||
);
|
||||
$this->drupalPost(NULL, $edit, t('Save'));
|
||||
$this->assertRaw(t('test_entity @id has been updated.', array('@id' => $id)), t('Entity was updated'));
|
||||
$this->assertRaw(t('test_entity @id has been updated.', array('@id' => $id)), 'Entity was updated');
|
||||
|
||||
// Display the entity.
|
||||
$entity = field_test_entity_test_load($id);
|
||||
$entity->content = field_attach_view($entity_type, $entity, 'full');
|
||||
$this->content = drupal_render($entity->content);
|
||||
$this->assertRaw($value, t('Value is displayed unfiltered'));
|
||||
$this->assertRaw($value, 'Value is displayed unfiltered');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -383,7 +383,7 @@ class TextSummaryTestCase extends DrupalWebTestCase {
|
||||
*/
|
||||
function callTextSummary($text, $expected, $format = NULL, $size = NULL) {
|
||||
$summary = text_summary($text, $format, $size);
|
||||
$this->assertIdentical($summary, $expected, t('Generated summary "@summary" matches expected "@expected".', array('@summary' => $summary, '@expected' => $expected)));
|
||||
$this->assertIdentical($summary, $expected, format_string('Generated summary "@summary" matches expected "@expected".', array('@summary' => $summary, '@expected' => $expected)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -401,7 +401,7 @@ class TextSummaryTestCase extends DrupalWebTestCase {
|
||||
$this->drupalPost('node/add/article', $edit, t('Save'));
|
||||
$node = $this->drupalGetNodeByTitle($edit['title']);
|
||||
|
||||
$this->assertIdentical($node->body['und'][0]['summary'], $summary, t('Article with with summary and no body has been submitted.'));
|
||||
$this->assertIdentical($node->body['und'][0]['summary'], $summary, 'Article with with summary and no body has been submitted.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -436,7 +436,7 @@ class TextTranslationTestCase extends DrupalWebTestCase {
|
||||
// Set "Article" content type to use multilingual support with translation.
|
||||
$edit = array('language_content_type' => 2);
|
||||
$this->drupalPost('admin/structure/types/manage/article', $edit, t('Save content type'));
|
||||
$this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Article')), t('Article content type has been updated.'));
|
||||
$this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Article')), 'Article content type has been updated.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -464,7 +464,7 @@ class TextTranslationTestCase extends DrupalWebTestCase {
|
||||
$node = $this->drupalGetNodeByTitle($edit['title']);
|
||||
$this->drupalGet("node/$node->nid/translate");
|
||||
$this->clickLink(t('add translation'));
|
||||
$this->assertFieldByXPath("//textarea[@name='body[$langcode][0][value]']", $body, t('The textfield widget is populated.'));
|
||||
$this->assertFieldByXPath("//textarea[@name='body[$langcode][0][value]']", $body, 'The textfield widget is populated.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -476,7 +476,7 @@ class TextTranslationTestCase extends DrupalWebTestCase {
|
||||
$edit = array('field[cardinality]' => -1);
|
||||
$this->drupalPost('admin/structure/types/manage/article/fields/body', $edit, t('Save settings'));
|
||||
$this->drupalGet('node/add/article');
|
||||
$this->assertFieldByXPath("//input[@name='body_add_more']", t('Add another item'), t('Body field cardinality set to multiple.'));
|
||||
$this->assertFieldByXPath("//input[@name='body_add_more']", t('Add another item'), 'Body field cardinality set to multiple.');
|
||||
|
||||
$body = array(
|
||||
$this->randomName(),
|
||||
@@ -501,7 +501,7 @@ class TextTranslationTestCase extends DrupalWebTestCase {
|
||||
"body[$langcode][$delta][format]" => array_shift($formats),
|
||||
);
|
||||
$this->drupalPost('node/1/edit', $edit, t('Save'));
|
||||
$this->assertText($body[$delta], t('The body field with delta @delta has been saved.', array('@delta' => $delta)));
|
||||
$this->assertText($body[$delta], format_string('The body field with delta @delta has been saved.', array('@delta' => $delta)));
|
||||
}
|
||||
|
||||
// Login as translator.
|
||||
@@ -511,7 +511,7 @@ class TextTranslationTestCase extends DrupalWebTestCase {
|
||||
$node = $this->drupalGetNodeByTitle($title);
|
||||
$this->drupalGet("node/$node->nid/translate");
|
||||
$this->clickLink(t('add translation'));
|
||||
$this->assertNoText($body[0], t('The body field with delta @delta is hidden.', array('@delta' => 0)));
|
||||
$this->assertText($body[1], t('The body field with delta @delta is shown.', array('@delta' => 1)));
|
||||
$this->assertNoText($body[0], format_string('The body field with delta @delta is hidden.', array('@delta' => 0)));
|
||||
$this->assertText($body[1], format_string('The body field with delta @delta is shown.', array('@delta' => 1)));
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -28,7 +28,9 @@ function field_test_field_info() {
|
||||
'shape' => array(
|
||||
'label' => t('Shape'),
|
||||
'description' => t('Another dummy field type.'),
|
||||
'settings' => array(),
|
||||
'settings' => array(
|
||||
'foreign_key_name' => 'shape',
|
||||
),
|
||||
'instance_settings' => array(),
|
||||
'default_widget' => 'test_field_widget',
|
||||
'default_formatter' => 'field_test_default',
|
||||
|
@@ -6,8 +6,8 @@ files[] = field_test.entity.inc
|
||||
version = VERSION
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -132,6 +132,18 @@ function field_test_field_schema($field) {
|
||||
);
|
||||
}
|
||||
else {
|
||||
$foreign_keys = array();
|
||||
// The 'foreign keys' key is not always used in tests.
|
||||
if (!empty($field['settings']['foreign_key_name'])) {
|
||||
$foreign_keys['foreign keys'] = array(
|
||||
// This is a dummy foreign key definition, references a table that
|
||||
// doesn't exist, but that's not a problem.
|
||||
$field['settings']['foreign_key_name'] => array(
|
||||
'table' => $field['settings']['foreign_key_name'],
|
||||
'columns' => array($field['settings']['foreign_key_name'] => 'id'),
|
||||
),
|
||||
);
|
||||
}
|
||||
return array(
|
||||
'columns' => array(
|
||||
'shape' => array(
|
||||
@@ -145,6 +157,6 @@ function field_test_field_schema($field) {
|
||||
'not null' => FALSE,
|
||||
),
|
||||
),
|
||||
);
|
||||
) + $foreign_keys;
|
||||
}
|
||||
}
|
||||
|
@@ -204,10 +204,7 @@ function field_test_dummy_field_storage_query(EntityFieldQuery $query) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Entity label callback.
|
||||
*
|
||||
* @param $entity
|
||||
* The entity object.
|
||||
* Implements callback_entity_info_label().
|
||||
*
|
||||
* @return
|
||||
* The label of the entity prefixed with "label callback".
|
||||
|
@@ -1558,8 +1558,8 @@ function field_ui_existing_field_options($entity_type, $bundle) {
|
||||
/**
|
||||
* Form constructor for the field settings edit page.
|
||||
*
|
||||
* @see field_ui_settings_form_submit()
|
||||
* @ingroups forms
|
||||
* @see field_ui_field_settings_form_submit()
|
||||
* @ingroup forms
|
||||
*/
|
||||
function field_ui_field_settings_form($form, &$form_state, $instance) {
|
||||
$bundle = $instance['bundle'];
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
dependencies[] = field
|
||||
files[] = field_ui.test
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -59,18 +59,18 @@ class FieldUITestCase extends DrupalWebTestCase {
|
||||
|
||||
// First step : 'Add new field' on the 'Manage fields' page.
|
||||
$this->drupalPost("$bundle_path/fields", $initial_edit, t('Save'));
|
||||
$this->assertRaw(t('These settings apply to the %label field everywhere it is used.', array('%label' => $label)), t('Field settings page was displayed.'));
|
||||
$this->assertRaw(t('These settings apply to the %label field everywhere it is used.', array('%label' => $label)), 'Field settings page was displayed.');
|
||||
|
||||
// Second step : 'Field settings' form.
|
||||
$this->drupalPost(NULL, $field_edit, t('Save field settings'));
|
||||
$this->assertRaw(t('Updated field %label field settings.', array('%label' => $label)), t('Redirected to instance and widget settings page.'));
|
||||
$this->assertRaw(t('Updated field %label field settings.', array('%label' => $label)), 'Redirected to instance and widget settings page.');
|
||||
|
||||
// Third step : 'Instance settings' form.
|
||||
$this->drupalPost(NULL, $instance_edit, t('Save settings'));
|
||||
$this->assertRaw(t('Saved %label configuration.', array('%label' => $label)), t('Redirected to "Manage fields" page.'));
|
||||
$this->assertRaw(t('Saved %label configuration.', array('%label' => $label)), 'Redirected to "Manage fields" page.');
|
||||
|
||||
// Check that the field appears in the overview form.
|
||||
$this->assertFieldByXPath('//table[@id="field-overview"]//td[1]', $label, t('Field was created and appears in the overview page.'));
|
||||
$this->assertFieldByXPath('//table[@id="field-overview"]//td[1]', $label, 'Field was created and appears in the overview page.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,10 +98,10 @@ class FieldUITestCase extends DrupalWebTestCase {
|
||||
|
||||
// Second step : 'Instance settings' form.
|
||||
$this->drupalPost(NULL, $instance_edit, t('Save settings'));
|
||||
$this->assertRaw(t('Saved %label configuration.', array('%label' => $label)), t('Redirected to "Manage fields" page.'));
|
||||
$this->assertRaw(t('Saved %label configuration.', array('%label' => $label)), 'Redirected to "Manage fields" page.');
|
||||
|
||||
// Check that the field appears in the overview form.
|
||||
$this->assertFieldByXPath('//table[@id="field-overview"]//td[1]', $label, t('Field was created and appears in the overview page.'));
|
||||
$this->assertFieldByXPath('//table[@id="field-overview"]//td[1]', $label, 'Field was created and appears in the overview page.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -119,14 +119,14 @@ class FieldUITestCase extends DrupalWebTestCase {
|
||||
function fieldUIDeleteField($bundle_path, $field_name, $label, $bundle_label) {
|
||||
// Display confirmation form.
|
||||
$this->drupalGet("$bundle_path/fields/$field_name/delete");
|
||||
$this->assertRaw(t('Are you sure you want to delete the field %label', array('%label' => $label)), t('Delete confirmation was found.'));
|
||||
$this->assertRaw(t('Are you sure you want to delete the field %label', array('%label' => $label)), 'Delete confirmation was found.');
|
||||
|
||||
// Submit confirmation form.
|
||||
$this->drupalPost(NULL, array(), t('Delete'));
|
||||
$this->assertRaw(t('The field %label has been deleted from the %type content type.', array('%label' => $label, '%type' => $bundle_label)), t('Delete message was found.'));
|
||||
$this->assertRaw(t('The field %label has been deleted from the %type content type.', array('%label' => $label, '%type' => $bundle_label)), 'Delete message was found.');
|
||||
|
||||
// Check that the field does not appear in the overview form.
|
||||
$this->assertNoFieldByXPath('//table[@id="field-overview"]//span[@class="label-field"]', $label, t('Field does not appear in the overview page.'));
|
||||
$this->assertNoFieldByXPath('//table[@id="field-overview"]//span[@class="label-field"]', $label, 'Field does not appear in the overview page.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,13 +179,13 @@ class FieldUIManageFieldsTestCase extends FieldUITestCase {
|
||||
);
|
||||
foreach ($table_headers as $table_header) {
|
||||
// We check that the label appear in the table headings.
|
||||
$this->assertRaw($table_header . '</th>', t('%table_header table header was found.', array('%table_header' => $table_header)));
|
||||
$this->assertRaw($table_header . '</th>', format_string('%table_header table header was found.', array('%table_header' => $table_header)));
|
||||
}
|
||||
|
||||
// "Add new field" and "Add existing field" aren't a table heading so just
|
||||
// test the text.
|
||||
foreach (array('Add new field', 'Add existing field') as $element) {
|
||||
$this->assertText($element, t('"@element" was found.', array('@element' => $element)));
|
||||
$this->assertText($element, format_string('"@element" was found.', array('@element' => $element)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ class FieldUIManageFieldsTestCase extends FieldUITestCase {
|
||||
// should also appear in the 'taxonomy term' entity.
|
||||
$vocabulary = taxonomy_vocabulary_load(1);
|
||||
$this->drupalGet('admin/structure/taxonomy/' . $vocabulary->machine_name . '/fields');
|
||||
$this->assertTrue($this->xpath('//select[@name="fields[_add_existing_field][field_name]"]//option[@value="' . $this->field_name . '"]'), t('Existing field was found in account settings.'));
|
||||
$this->assertTrue($this->xpath('//select[@name="fields[_add_existing_field][field_name]"]//option[@value="' . $this->field_name . '"]'), 'Existing field was found in account settings.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -231,7 +231,7 @@ class FieldUIManageFieldsTestCase extends FieldUITestCase {
|
||||
$this->assertFieldSettings($this->type, $this->field_name, $string);
|
||||
|
||||
// Assert redirection back to the "manage fields" page.
|
||||
$this->assertText(t('Saved @label configuration.', array('@label' => $this->field_label)), t('Redirected to "Manage fields" page.'));
|
||||
$this->assertText(t('Saved @label configuration.', array('@label' => $this->field_label)), 'Redirected to "Manage fields" page.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -240,12 +240,12 @@ class FieldUIManageFieldsTestCase extends FieldUITestCase {
|
||||
function addExistingField() {
|
||||
// Check "Add existing field" appears.
|
||||
$this->drupalGet('admin/structure/types/manage/page/fields');
|
||||
$this->assertRaw(t('Add existing field'), t('"Add existing field" was found.'));
|
||||
$this->assertRaw(t('Add existing field'), '"Add existing field" was found.');
|
||||
|
||||
// Check that the list of options respects entity type restrictions on
|
||||
// fields. The 'comment' field is restricted to the 'comment' entity type
|
||||
// and should not appear in the list.
|
||||
$this->assertFalse($this->xpath('//select[@id="edit-add-existing-field-field-name"]//option[@value="comment"]'), t('The list of options respects entity type restrictions.'));
|
||||
$this->assertFalse($this->xpath('//select[@id="edit-add-existing-field-field-name"]//option[@value="comment"]'), 'The list of options respects entity type restrictions.');
|
||||
|
||||
// Add a new field based on an existing field.
|
||||
$edit = array(
|
||||
@@ -272,12 +272,12 @@ class FieldUIManageFieldsTestCase extends FieldUITestCase {
|
||||
field_info_cache_clear();
|
||||
// Assert field settings.
|
||||
$field = field_info_field($field_name);
|
||||
$this->assertTrue($field['settings']['test_field_setting'] == $string, t('Field settings were found.'));
|
||||
$this->assertTrue($field['settings']['test_field_setting'] == $string, 'Field settings were found.');
|
||||
|
||||
// Assert instance and widget settings.
|
||||
$instance = field_info_instance($entity_type, $field_name, $bundle);
|
||||
$this->assertTrue($instance['settings']['test_instance_setting'] == $string, t('Field instance settings were found.'));
|
||||
$this->assertTrue($instance['widget']['settings']['test_widget_setting'] == $string, t('Field widget settings were found.'));
|
||||
$this->assertTrue($instance['settings']['test_instance_setting'] == $string, 'Field instance settings were found.');
|
||||
$this->assertTrue($instance['widget']['settings']['test_widget_setting'] == $string, 'Field widget settings were found.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -303,31 +303,31 @@ class FieldUIManageFieldsTestCase extends FieldUITestCase {
|
||||
$element_id = "edit-$field_name-$langcode-0-value";
|
||||
$element_name = "{$field_name}[$langcode][0][value]";
|
||||
$this->drupalGet($admin_path);
|
||||
$this->assertFieldById($element_id, '', t('The default value widget was empty.'));
|
||||
$this->assertFieldById($element_id, '', 'The default value widget was empty.');
|
||||
|
||||
// Check that invalid default values are rejected.
|
||||
$edit = array($element_name => '-1');
|
||||
$this->drupalPost($admin_path, $edit, t('Save settings'));
|
||||
$this->assertText("$field_name does not accept the value -1", t('Form vaildation failed.'));
|
||||
$this->assertText("$field_name does not accept the value -1", 'Form vaildation failed.');
|
||||
|
||||
// Check that the default value is saved.
|
||||
$edit = array($element_name => '1');
|
||||
$this->drupalPost($admin_path, $edit, t('Save settings'));
|
||||
$this->assertText("Saved $field_name configuration", t('The form was successfully submitted.'));
|
||||
$this->assertText("Saved $field_name configuration", 'The form was successfully submitted.');
|
||||
$instance = field_info_instance('node', $field_name, $this->type);
|
||||
$this->assertEqual($instance['default_value'], array(array('value' => 1)), t('The default value was correctly saved.'));
|
||||
$this->assertEqual($instance['default_value'], array(array('value' => 1)), 'The default value was correctly saved.');
|
||||
|
||||
// Check that the default value shows up in the form
|
||||
$this->drupalGet($admin_path);
|
||||
$this->assertFieldById($element_id, '1', t('The default value widget was displayed with the correct value.'));
|
||||
$this->assertFieldById($element_id, '1', 'The default value widget was displayed with the correct value.');
|
||||
|
||||
// Check that the default value can be emptied.
|
||||
$edit = array($element_name => '');
|
||||
$this->drupalPost(NULL, $edit, t('Save settings'));
|
||||
$this->assertText("Saved $field_name configuration", t('The form was successfully submitted.'));
|
||||
$this->assertText("Saved $field_name configuration", 'The form was successfully submitted.');
|
||||
field_info_cache_clear();
|
||||
$instance = field_info_instance('node', $field_name, $this->type);
|
||||
$this->assertEqual($instance['default_value'], NULL, t('The default value was correctly saved.'));
|
||||
$this->assertEqual($instance['default_value'], NULL, 'The default value was correctly saved.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -362,9 +362,9 @@ class FieldUIManageFieldsTestCase extends FieldUITestCase {
|
||||
// Reset the fields info.
|
||||
field_info_cache_clear();
|
||||
// Check that the field instance was deleted.
|
||||
$this->assertNull(field_info_instance('node', $this->field_name, $this->type), t('Field instance was deleted.'));
|
||||
$this->assertNull(field_info_instance('node', $this->field_name, $this->type), 'Field instance was deleted.');
|
||||
// Check that the field was not deleted
|
||||
$this->assertNotNull(field_info_field($this->field_name), t('Field was not deleted.'));
|
||||
$this->assertNotNull(field_info_field($this->field_name), 'Field was not deleted.');
|
||||
|
||||
// Delete the second instance.
|
||||
$this->fieldUIDeleteField($bundle_path2, $this->field_name, $this->field_label, $type_name2);
|
||||
@@ -372,9 +372,9 @@ class FieldUIManageFieldsTestCase extends FieldUITestCase {
|
||||
// Reset the fields info.
|
||||
field_info_cache_clear();
|
||||
// Check that the field instance was deleted.
|
||||
$this->assertNull(field_info_instance('node', $this->field_name, $type_name2), t('Field instance was deleted.'));
|
||||
$this->assertNull(field_info_instance('node', $this->field_name, $type_name2), 'Field instance was deleted.');
|
||||
// Check that the field was deleted too.
|
||||
$this->assertNull(field_info_field($this->field_name), t('Field was deleted.'));
|
||||
$this->assertNull(field_info_field($this->field_name), 'Field was deleted.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -385,7 +385,7 @@ class FieldUIManageFieldsTestCase extends FieldUITestCase {
|
||||
|
||||
// Check that the field type is not available in the 'add new field' row.
|
||||
$this->drupalGet($bundle_path);
|
||||
$this->assertFalse($this->xpath('//select[@id="edit-add-new-field-type"]//option[@value="hidden_test_field"]'), t("The 'add new field' select respects field types 'no_ui' property."));
|
||||
$this->assertFalse($this->xpath('//select[@id="edit-add-new-field-type"]//option[@value="hidden_test_field"]'), "The 'add new field' select respects field types 'no_ui' property.");
|
||||
|
||||
// Create a field and an instance programmatically.
|
||||
$field_name = 'hidden_test_field';
|
||||
@@ -398,18 +398,18 @@ class FieldUIManageFieldsTestCase extends FieldUITestCase {
|
||||
'widget' => array('type' => 'test_field_widget'),
|
||||
);
|
||||
field_create_instance($instance);
|
||||
$this->assertTrue(field_read_instance('node', $field_name, $this->type), t('An instance of the field %field was created programmatically.', array('%field' => $field_name)));
|
||||
$this->assertTrue(field_read_instance('node', $field_name, $this->type), format_string('An instance of the field %field was created programmatically.', array('%field' => $field_name)));
|
||||
|
||||
// Check that the newly added instance appears on the 'Manage Fields'
|
||||
// screen.
|
||||
$this->drupalGet($bundle_path);
|
||||
$this->assertFieldByXPath('//table[@id="field-overview"]//td[1]', $instance['label'], t('Field was created and appears in the overview page.'));
|
||||
$this->assertFieldByXPath('//table[@id="field-overview"]//td[1]', $instance['label'], 'Field was created and appears in the overview page.');
|
||||
|
||||
// Check that the instance does not appear in the 'add existing field' row
|
||||
// on other bundles.
|
||||
$bundle_path = 'admin/structure/types/manage/article/fields/';
|
||||
$this->drupalGet($bundle_path);
|
||||
$this->assertFalse($this->xpath('//select[@id="edit-add-existing-field-field-name"]//option[@value=:field_name]', array(':field_name' => $field_name)), t("The 'add existing field' select respects field types 'no_ui' property."));
|
||||
$this->assertFalse($this->xpath('//select[@id="edit-add-existing-field-field-name"]//option[@value=:field_name]', array(':field_name' => $field_name)), "The 'add existing field' select respects field types 'no_ui' property.");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -488,8 +488,8 @@ class FieldUIManageDisplayTestCase extends FieldUITestCase {
|
||||
// Display the "Manage display" screen and check that the expected formatter is
|
||||
// selected.
|
||||
$this->drupalGet($manage_display);
|
||||
$this->assertFieldByName('fields[field_test][type]', $format, t('The expected formatter is selected.'));
|
||||
$this->assertText("$setting_name: $setting_value", t('The expected summary is displayed.'));
|
||||
$this->assertFieldByName('fields[field_test][type]', $format, 'The expected formatter is selected.');
|
||||
$this->assertText("$setting_name: $setting_value", 'The expected summary is displayed.');
|
||||
|
||||
// Change the formatter and check that the summary is updated.
|
||||
$edit = array('fields[field_test][type]' => 'field_test_multiple', 'refresh_rows' => 'field_test');
|
||||
@@ -498,8 +498,8 @@ class FieldUIManageDisplayTestCase extends FieldUITestCase {
|
||||
$default_settings = field_info_formatter_settings($format);
|
||||
$setting_name = key($default_settings);
|
||||
$setting_value = $default_settings[$setting_name];
|
||||
$this->assertFieldByName('fields[field_test][type]', $format, t('The expected formatter is selected.'));
|
||||
$this->assertText("$setting_name: $setting_value", t('The expected summary is displayed.'));
|
||||
$this->assertFieldByName('fields[field_test][type]', $format, 'The expected formatter is selected.');
|
||||
$this->assertText("$setting_name: $setting_value", 'The expected summary is displayed.');
|
||||
|
||||
// Submit the form and check that the instance is updated.
|
||||
$this->drupalPost(NULL, array(), t('Save'));
|
||||
@@ -507,8 +507,8 @@ class FieldUIManageDisplayTestCase extends FieldUITestCase {
|
||||
$instance = field_info_instance('node', 'field_test', $this->type);
|
||||
$current_format = $instance['display']['default']['type'];
|
||||
$current_setting_value = $instance['display']['default']['settings'][$setting_name];
|
||||
$this->assertEqual($current_format, $format, t('The formatter was updated.'));
|
||||
$this->assertEqual($current_setting_value, $setting_value, t('The setting was updated.'));
|
||||
$this->assertEqual($current_format, $format, 'The formatter was updated.');
|
||||
$this->assertEqual($current_setting_value, $setting_value, 'The setting was updated.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -540,8 +540,8 @@ class FieldUIManageDisplayTestCase extends FieldUITestCase {
|
||||
|
||||
// Check that the field is displayed with the default formatter in 'rss'
|
||||
// mode (uses 'default'), and hidden in 'teaser' mode (uses custom settings).
|
||||
$this->assertNodeViewText($node, 'rss', $output['field_test_default'], t("The field is displayed as expected in view modes that use 'default' settings."));
|
||||
$this->assertNodeViewNoText($node, 'teaser', $value, t("The field is hidden in view modes that use custom settings."));
|
||||
$this->assertNodeViewText($node, 'rss', $output['field_test_default'], "The field is displayed as expected in view modes that use 'default' settings.");
|
||||
$this->assertNodeViewNoText($node, 'teaser', $value, "The field is hidden in view modes that use custom settings.");
|
||||
|
||||
// Change fomatter for 'default' mode, check that the field is displayed
|
||||
// accordingly in 'rss' mode.
|
||||
@@ -549,14 +549,14 @@ class FieldUIManageDisplayTestCase extends FieldUITestCase {
|
||||
'fields[field_test][type]' => 'field_test_with_prepare_view',
|
||||
);
|
||||
$this->drupalPost('admin/structure/types/manage/' . $this->hyphen_type . '/display', $edit, t('Save'));
|
||||
$this->assertNodeViewText($node, 'rss', $output['field_test_with_prepare_view'], t("The field is displayed as expected in view modes that use 'default' settings."));
|
||||
$this->assertNodeViewText($node, 'rss', $output['field_test_with_prepare_view'], "The field is displayed as expected in view modes that use 'default' settings.");
|
||||
|
||||
// Specialize the 'rss' mode, check that the field is displayed the same.
|
||||
$edit = array(
|
||||
"view_modes_custom[rss]" => TRUE,
|
||||
);
|
||||
$this->drupalPost('admin/structure/types/manage/' . $this->hyphen_type . '/display', $edit, t('Save'));
|
||||
$this->assertNodeViewText($node, 'rss', $output['field_test_with_prepare_view'], t("The field is displayed as expected in newly specialized 'rss' mode."));
|
||||
$this->assertNodeViewText($node, 'rss', $output['field_test_with_prepare_view'], "The field is displayed as expected in newly specialized 'rss' mode.");
|
||||
|
||||
// Set the field to 'hidden' in the view mode, check that the field is
|
||||
// hidden.
|
||||
@@ -564,7 +564,7 @@ class FieldUIManageDisplayTestCase extends FieldUITestCase {
|
||||
'fields[field_test][type]' => 'hidden',
|
||||
);
|
||||
$this->drupalPost('admin/structure/types/manage/' . $this->hyphen_type . '/display/rss', $edit, t('Save'));
|
||||
$this->assertNodeViewNoText($node, 'rss', $value, t("The field is hidden in 'rss' mode."));
|
||||
$this->assertNodeViewNoText($node, 'rss', $value, "The field is hidden in 'rss' mode.");
|
||||
|
||||
// Set the view mode back to 'default', check that the field is displayed
|
||||
// accordingly.
|
||||
@@ -572,7 +572,7 @@ class FieldUIManageDisplayTestCase extends FieldUITestCase {
|
||||
"view_modes_custom[rss]" => FALSE,
|
||||
);
|
||||
$this->drupalPost('admin/structure/types/manage/' . $this->hyphen_type . '/display', $edit, t('Save'));
|
||||
$this->assertNodeViewText($node, 'rss', $output['field_test_with_prepare_view'], t("The field is displayed as expected when 'rss' mode is set back to 'default' settings."));
|
||||
$this->assertNodeViewText($node, 'rss', $output['field_test_with_prepare_view'], "The field is displayed as expected when 'rss' mode is set back to 'default' settings.");
|
||||
|
||||
// Specialize the view mode again.
|
||||
$edit = array(
|
||||
@@ -580,7 +580,7 @@ class FieldUIManageDisplayTestCase extends FieldUITestCase {
|
||||
);
|
||||
$this->drupalPost('admin/structure/types/manage/' . $this->hyphen_type . '/display', $edit, t('Save'));
|
||||
// Check that the previous settings for the view mode have been kept.
|
||||
$this->assertNodeViewNoText($node, 'rss', $value, t("The previous settings are kept when 'rss' mode is specialized again."));
|
||||
$this->assertNodeViewNoText($node, 'rss', $value, "The previous settings are kept when 'rss' mode is specialized again.");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
dependencies[] = field
|
||||
files[] = tests/file.test
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -139,7 +139,7 @@ class FileFieldTestCase extends DrupalWebTestCase {
|
||||
// Save at least one revision to better simulate a real site.
|
||||
$this->drupalCreateNode(get_object_vars($node));
|
||||
$node = node_load($nid, NULL, TRUE);
|
||||
$this->assertNotEqual($nid, $node->vid, t('Node revision exists.'));
|
||||
$this->assertNotEqual($nid, $node->vid, 'Node revision exists.');
|
||||
}
|
||||
|
||||
// Attach a file to the node.
|
||||
@@ -180,7 +180,7 @@ class FileFieldTestCase extends DrupalWebTestCase {
|
||||
* Asserts that a file exists physically on disk.
|
||||
*/
|
||||
function assertFileExists($file, $message = NULL) {
|
||||
$message = isset($message) ? $message : t('File %file exists on the disk.', array('%file' => $file->uri));
|
||||
$message = isset($message) ? $message : format_string('File %file exists on the disk.', array('%file' => $file->uri));
|
||||
$this->assertTrue(is_file($file->uri), $message);
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ class FileFieldTestCase extends DrupalWebTestCase {
|
||||
function assertFileEntryExists($file, $message = NULL) {
|
||||
entity_get_controller('file')->resetCache();
|
||||
$db_file = file_load($file->fid);
|
||||
$message = isset($message) ? $message : t('File %file exists in database at the correct path.', array('%file' => $file->uri));
|
||||
$message = isset($message) ? $message : format_string('File %file exists in database at the correct path.', array('%file' => $file->uri));
|
||||
$this->assertEqual($db_file->uri, $file->uri, $message);
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ class FileFieldTestCase extends DrupalWebTestCase {
|
||||
* Asserts that a file does not exist on disk.
|
||||
*/
|
||||
function assertFileNotExists($file, $message = NULL) {
|
||||
$message = isset($message) ? $message : t('File %file exists on the disk.', array('%file' => $file->uri));
|
||||
$message = isset($message) ? $message : format_string('File %file exists on the disk.', array('%file' => $file->uri));
|
||||
$this->assertFalse(is_file($file->uri), $message);
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ class FileFieldTestCase extends DrupalWebTestCase {
|
||||
*/
|
||||
function assertFileEntryNotExists($file, $message) {
|
||||
entity_get_controller('file')->resetCache();
|
||||
$message = isset($message) ? $message : t('File %file exists in database at the correct path.', array('%file' => $file->uri));
|
||||
$message = isset($message) ? $message : format_string('File %file exists in database at the correct path.', array('%file' => $file->uri));
|
||||
$this->assertFalse(file_load($file->fid), $message);
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ class FileFieldTestCase extends DrupalWebTestCase {
|
||||
* Asserts that a file's status is set to permanent in the database.
|
||||
*/
|
||||
function assertFileIsPermanent($file, $message = NULL) {
|
||||
$message = isset($message) ? $message : t('File %file is permanent.', array('%file' => $file->uri));
|
||||
$message = isset($message) ? $message : format_string('File %file is permanent.', array('%file' => $file->uri));
|
||||
$this->assertTrue($file->status == FILE_STATUS_PERMANENT, $message);
|
||||
}
|
||||
}
|
||||
@@ -253,19 +253,19 @@ class FileManagedFileElementTestCase extends FileFieldTestCase {
|
||||
|
||||
// Submit without a file.
|
||||
$this->drupalPost($path, array(), t('Save'));
|
||||
$this->assertRaw(t('The file id is %fid.', array('%fid' => 0)), t('Submitted without a file.'));
|
||||
$this->assertRaw(t('The file id is %fid.', array('%fid' => 0)), 'Submitted without a file.');
|
||||
|
||||
// Submit a new file, without using the Upload button.
|
||||
$last_fid_prior = $this->getLastFileId();
|
||||
$edit = array('files[' . $input_base_name . ']' => drupal_realpath($test_file->uri));
|
||||
$this->drupalPost($path, $edit, t('Save'));
|
||||
$last_fid = $this->getLastFileId();
|
||||
$this->assertTrue($last_fid > $last_fid_prior, t('New file got saved.'));
|
||||
$this->assertRaw(t('The file id is %fid.', array('%fid' => $last_fid)), t('Submit handler has correct file info.'));
|
||||
$this->assertTrue($last_fid > $last_fid_prior, 'New file got saved.');
|
||||
$this->assertRaw(t('The file id is %fid.', array('%fid' => $last_fid)), 'Submit handler has correct file info.');
|
||||
|
||||
// Submit no new input, but with a default file.
|
||||
$this->drupalPost($path . '/' . $last_fid, array(), t('Save'));
|
||||
$this->assertRaw(t('The file id is %fid.', array('%fid' => $last_fid)), t('Empty submission did not change an existing file.'));
|
||||
$this->assertRaw(t('The file id is %fid.', array('%fid' => $last_fid)), 'Empty submission did not change an existing file.');
|
||||
|
||||
// Now, test the Upload and Remove buttons, with and without Ajax.
|
||||
foreach (array(FALSE, TRUE) as $ajax) {
|
||||
@@ -280,9 +280,9 @@ class FileManagedFileElementTestCase extends FileFieldTestCase {
|
||||
$this->drupalPost(NULL, $edit, t('Upload'));
|
||||
}
|
||||
$last_fid = $this->getLastFileId();
|
||||
$this->assertTrue($last_fid > $last_fid_prior, t('New file got uploaded.'));
|
||||
$this->assertTrue($last_fid > $last_fid_prior, 'New file got uploaded.');
|
||||
$this->drupalPost(NULL, array(), t('Save'));
|
||||
$this->assertRaw(t('The file id is %fid.', array('%fid' => $last_fid)), t('Submit handler has correct file info.'));
|
||||
$this->assertRaw(t('The file id is %fid.', array('%fid' => $last_fid)), 'Submit handler has correct file info.');
|
||||
|
||||
// Remove, then Submit.
|
||||
$this->drupalGet($path . '/' . $last_fid);
|
||||
@@ -293,7 +293,7 @@ class FileManagedFileElementTestCase extends FileFieldTestCase {
|
||||
$this->drupalPost(NULL, array(), t('Remove'));
|
||||
}
|
||||
$this->drupalPost(NULL, array(), t('Save'));
|
||||
$this->assertRaw(t('The file id is %fid.', array('%fid' => 0)), t('Submission after file removal was successful.'));
|
||||
$this->assertRaw(t('The file id is %fid.', array('%fid' => 0)), 'Submission after file removal was successful.');
|
||||
|
||||
// Upload, then Remove, then Submit.
|
||||
$this->drupalGet($path);
|
||||
@@ -307,7 +307,7 @@ class FileManagedFileElementTestCase extends FileFieldTestCase {
|
||||
$this->drupalPost(NULL, array(), t('Remove'));
|
||||
}
|
||||
$this->drupalPost(NULL, array(), t('Save'));
|
||||
$this->assertRaw(t('The file id is %fid.', array('%fid' => 0)), t('Submission after file upload and removal was successful.'));
|
||||
$this->assertRaw(t('The file id is %fid.', array('%fid' => 0)), 'Submission after file upload and removal was successful.');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -350,16 +350,16 @@ class FileFieldWidgetTestCase extends FileFieldTestCase {
|
||||
$nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
|
||||
$node = node_load($nid, NULL, TRUE);
|
||||
$node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0];
|
||||
$this->assertFileExists($node_file, t('New file saved to disk on node creation.'));
|
||||
$this->assertFileExists($node_file, 'New file saved to disk on node creation.');
|
||||
|
||||
// Ensure the file can be downloaded.
|
||||
$this->drupalGet(file_create_url($node_file->uri));
|
||||
$this->assertResponse(200, t('Confirmed that the generated URL is correct by downloading the shipped file.'));
|
||||
$this->assertResponse(200, 'Confirmed that the generated URL is correct by downloading the shipped file.');
|
||||
|
||||
// Ensure the edit page has a remove button instead of an upload button.
|
||||
$this->drupalGet("node/$nid/edit");
|
||||
$this->assertNoFieldByXPath('//input[@type="submit"]', t('Upload'), t('Node with file does not display the "Upload" button.'));
|
||||
$this->assertFieldByXpath('//input[@type="submit"]', t('Remove'), t('Node with file displays the "Remove" button.'));
|
||||
$this->assertNoFieldByXPath('//input[@type="submit"]', t('Upload'), 'Node with file does not display the "Upload" button.');
|
||||
$this->assertFieldByXpath('//input[@type="submit"]', t('Remove'), 'Node with file displays the "Remove" button.');
|
||||
|
||||
// "Click" the remove button (emulating either a nojs or js submission).
|
||||
switch ($type) {
|
||||
@@ -373,13 +373,13 @@ class FileFieldWidgetTestCase extends FileFieldTestCase {
|
||||
}
|
||||
|
||||
// Ensure the page now has an upload button instead of a remove button.
|
||||
$this->assertNoFieldByXPath('//input[@type="submit"]', t('Remove'), t('After clicking the "Remove" button, it is no longer displayed.'));
|
||||
$this->assertFieldByXpath('//input[@type="submit"]', t('Upload'), t('After clicking the "Remove" button, the "Upload" button is displayed.'));
|
||||
$this->assertNoFieldByXPath('//input[@type="submit"]', t('Remove'), 'After clicking the "Remove" button, it is no longer displayed.');
|
||||
$this->assertFieldByXpath('//input[@type="submit"]', t('Upload'), 'After clicking the "Remove" button, the "Upload" button is displayed.');
|
||||
|
||||
// Save the node and ensure it does not have the file.
|
||||
$this->drupalPost(NULL, array(), t('Save'));
|
||||
$node = node_load($nid, NULL, TRUE);
|
||||
$this->assertTrue(empty($node->{$field_name}[LANGUAGE_NONE][0]['fid']), t('File was successfully removed from the node.'));
|
||||
$this->assertTrue(empty($node->{$field_name}[LANGUAGE_NONE][0]['fid']), 'File was successfully removed from the node.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -423,7 +423,7 @@ class FileFieldWidgetTestCase extends FileFieldTestCase {
|
||||
$this->drupalPost(NULL, $edit, t('Upload'));
|
||||
}
|
||||
}
|
||||
$this->assertNoFieldByXpath('//input[@type="submit"]', t('Upload'), t('After uploading 3 files for each field, the "Upload" button is no longer displayed.'));
|
||||
$this->assertNoFieldByXpath('//input[@type="submit"]', t('Upload'), 'After uploading 3 files for each field, the "Upload" button is no longer displayed.');
|
||||
|
||||
$num_expected_remove_buttons = 6;
|
||||
|
||||
@@ -440,7 +440,7 @@ class FileFieldWidgetTestCase extends FileFieldTestCase {
|
||||
// Ensure we have the expected number of Remove buttons, and that they
|
||||
// are numbered sequentially.
|
||||
$buttons = $this->xpath('//input[@type="submit" and @value="Remove"]');
|
||||
$this->assertTrue(is_array($buttons) && count($buttons) === $num_expected_remove_buttons, t('There are %n "Remove" buttons displayed (JSMode=%type).', array('%n' => $num_expected_remove_buttons, '%type' => $type)));
|
||||
$this->assertTrue(is_array($buttons) && count($buttons) === $num_expected_remove_buttons, format_string('There are %n "Remove" buttons displayed (JSMode=%type).', array('%n' => $num_expected_remove_buttons, '%type' => $type)));
|
||||
foreach ($buttons as $i => $button) {
|
||||
$key = $i >= $remaining ? $i - $remaining : $i;
|
||||
$check_field_name = $field_name2;
|
||||
@@ -482,17 +482,17 @@ class FileFieldWidgetTestCase extends FileFieldTestCase {
|
||||
// correct name.
|
||||
$upload_button_name = $current_field_name . '_' . LANGUAGE_NONE . '_' . $remaining . '_upload_button';
|
||||
$buttons = $this->xpath('//input[@type="submit" and @value="Upload" and @name=:name]', array(':name' => $upload_button_name));
|
||||
$this->assertTrue(is_array($buttons) && count($buttons) == 1, t('The upload button is displayed with the correct name (JSMode=%type).', array('%type' => $type)));
|
||||
$this->assertTrue(is_array($buttons) && count($buttons) == 1, format_string('The upload button is displayed with the correct name (JSMode=%type).', array('%type' => $type)));
|
||||
|
||||
// Ensure only at most one button per field is displayed.
|
||||
$buttons = $this->xpath('//input[@type="submit" and @value="Upload"]');
|
||||
$expected = $current_field_name == $field_name ? 1 : 2;
|
||||
$this->assertTrue(is_array($buttons) && count($buttons) == $expected, t('After removing a file, only one "Upload" button for each possible field is displayed (JSMode=%type).', array('%type' => $type)));
|
||||
$this->assertTrue(is_array($buttons) && count($buttons) == $expected, format_string('After removing a file, only one "Upload" button for each possible field is displayed (JSMode=%type).', array('%type' => $type)));
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure the page now has no Remove buttons.
|
||||
$this->assertNoFieldByXPath('//input[@type="submit"]', t('Remove'), t('After removing all files, there is no "Remove" button displayed (JSMode=%type).', array('%type' => $type)));
|
||||
$this->assertNoFieldByXPath('//input[@type="submit"]', t('Remove'), format_string('After removing all files, there is no "Remove" button displayed (JSMode=%type).', array('%type' => $type)));
|
||||
|
||||
// Save the node and ensure it does not have any files.
|
||||
$this->drupalPost(NULL, array('title' => $this->randomName()), t('Save'));
|
||||
@@ -500,7 +500,7 @@ class FileFieldWidgetTestCase extends FileFieldTestCase {
|
||||
preg_match('/node\/([0-9]+)/', $this->getUrl(), $matches);
|
||||
$nid = $matches[1];
|
||||
$node = node_load($nid, NULL, TRUE);
|
||||
$this->assertTrue(empty($node->{$field_name}[LANGUAGE_NONE][0]['fid']), t('Node was successfully saved without any files.'));
|
||||
$this->assertTrue(empty($node->{$field_name}[LANGUAGE_NONE][0]['fid']), 'Node was successfully saved without any files.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -526,21 +526,21 @@ class FileFieldWidgetTestCase extends FileFieldTestCase {
|
||||
$nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
|
||||
$node = node_load($nid, NULL, TRUE);
|
||||
$node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0];
|
||||
$this->assertFileExists($node_file, t('New file saved to disk on node creation.'));
|
||||
$this->assertFileExists($node_file, 'New file saved to disk on node creation.');
|
||||
|
||||
// Ensure the private file is available to the user who uploaded it.
|
||||
$this->drupalGet(file_create_url($node_file->uri));
|
||||
$this->assertResponse(200, t('Confirmed that the generated URL is correct by downloading the shipped file.'));
|
||||
$this->assertResponse(200, 'Confirmed that the generated URL is correct by downloading the shipped file.');
|
||||
|
||||
// Ensure we can't change 'uri_scheme' field settings while there are some
|
||||
// entities with uploaded files.
|
||||
$this->drupalGet("admin/structure/types/manage/$type_name/fields/$field_name");
|
||||
$this->assertFieldByXpath('//input[@id="edit-field-settings-uri-scheme-public" and @disabled="disabled"]', 'public', t('Upload destination setting disabled.'));
|
||||
$this->assertFieldByXpath('//input[@id="edit-field-settings-uri-scheme-public" and @disabled="disabled"]', 'public', 'Upload destination setting disabled.');
|
||||
|
||||
// Delete node and confirm that setting could be changed.
|
||||
node_delete($nid);
|
||||
$this->drupalGet("admin/structure/types/manage/$type_name/fields/$field_name");
|
||||
$this->assertFieldByXpath('//input[@id="edit-field-settings-uri-scheme-public" and not(@disabled)]', 'public', t('Upload destination setting enabled.'));
|
||||
$this->assertFieldByXpath('//input[@id="edit-field-settings-uri-scheme-public" and not(@disabled)]', 'public', 'Upload destination setting enabled.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -592,17 +592,17 @@ class FileFieldWidgetTestCase extends FileFieldTestCase {
|
||||
|
||||
$comment = comment_load($cid);
|
||||
$comment_file = (object) $comment->{'field_' . $name}[LANGUAGE_NONE][0];
|
||||
$this->assertFileExists($comment_file, t('New file saved to disk on node creation.'));
|
||||
$this->assertFileExists($comment_file, 'New file saved to disk on node creation.');
|
||||
// Test authenticated file download.
|
||||
$url = file_create_url($comment_file->uri);
|
||||
$this->assertNotEqual($url, NULL, t('Confirmed that the URL is valid'));
|
||||
$this->assertNotEqual($url, NULL, 'Confirmed that the URL is valid');
|
||||
$this->drupalGet(file_create_url($comment_file->uri));
|
||||
$this->assertResponse(200, t('Confirmed that the generated URL is correct by downloading the shipped file.'));
|
||||
$this->assertResponse(200, 'Confirmed that the generated URL is correct by downloading the shipped file.');
|
||||
|
||||
// Test anonymous file download.
|
||||
$this->drupalLogout();
|
||||
$this->drupalGet(file_create_url($comment_file->uri));
|
||||
$this->assertResponse(403, t('Confirmed that access is denied for the file without the needed permission.'));
|
||||
$this->assertResponse(403, 'Confirmed that access is denied for the file without the needed permission.');
|
||||
|
||||
// Unpublishes node.
|
||||
$this->drupalLogin($this->admin_user);
|
||||
@@ -614,7 +614,7 @@ class FileFieldWidgetTestCase extends FileFieldTestCase {
|
||||
// Ensures normal user can no longer download the file.
|
||||
$this->drupalLogin($user);
|
||||
$this->drupalGet(file_create_url($comment_file->uri));
|
||||
$this->assertResponse(403, t('Confirmed that access is denied for the file without the needed permission.'));
|
||||
$this->assertResponse(403, 'Confirmed that access is denied for the file without the needed permission.');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -661,25 +661,25 @@ class FileFieldRevisionTestCase extends FileFieldTestCase {
|
||||
$node = node_load($nid, NULL, TRUE);
|
||||
$node_file_r1 = (object) $node->{$field_name}[LANGUAGE_NONE][0];
|
||||
$node_vid_r1 = $node->vid;
|
||||
$this->assertFileExists($node_file_r1, t('New file saved to disk on node creation.'));
|
||||
$this->assertFileEntryExists($node_file_r1, t('File entry exists in database on node creation.'));
|
||||
$this->assertFileIsPermanent($node_file_r1, t('File is permanent.'));
|
||||
$this->assertFileExists($node_file_r1, 'New file saved to disk on node creation.');
|
||||
$this->assertFileEntryExists($node_file_r1, 'File entry exists in database on node creation.');
|
||||
$this->assertFileIsPermanent($node_file_r1, 'File is permanent.');
|
||||
|
||||
// Upload another file to the same node in a new revision.
|
||||
$this->replaceNodeFile($test_file, $field_name, $nid);
|
||||
$node = node_load($nid, NULL, TRUE);
|
||||
$node_file_r2 = (object) $node->{$field_name}[LANGUAGE_NONE][0];
|
||||
$node_vid_r2 = $node->vid;
|
||||
$this->assertFileExists($node_file_r2, t('Replacement file exists on disk after creating new revision.'));
|
||||
$this->assertFileEntryExists($node_file_r2, t('Replacement file entry exists in database after creating new revision.'));
|
||||
$this->assertFileIsPermanent($node_file_r2, t('Replacement file is permanent.'));
|
||||
$this->assertFileExists($node_file_r2, 'Replacement file exists on disk after creating new revision.');
|
||||
$this->assertFileEntryExists($node_file_r2, 'Replacement file entry exists in database after creating new revision.');
|
||||
$this->assertFileIsPermanent($node_file_r2, 'Replacement file is permanent.');
|
||||
|
||||
// Check that the original file is still in place on the first revision.
|
||||
$node = node_load($nid, $node_vid_r1, TRUE);
|
||||
$this->assertEqual($node_file_r1, (object) $node->{$field_name}[LANGUAGE_NONE][0], t('Original file still in place after replacing file in new revision.'));
|
||||
$this->assertFileExists($node_file_r1, t('Original file still in place after replacing file in new revision.'));
|
||||
$this->assertFileEntryExists($node_file_r1, t('Original file entry still in place after replacing file in new revision'));
|
||||
$this->assertFileIsPermanent($node_file_r1, t('Original file is still permanent.'));
|
||||
$this->assertEqual($node_file_r1, (object) $node->{$field_name}[LANGUAGE_NONE][0], 'Original file still in place after replacing file in new revision.');
|
||||
$this->assertFileExists($node_file_r1, 'Original file still in place after replacing file in new revision.');
|
||||
$this->assertFileEntryExists($node_file_r1, 'Original file entry still in place after replacing file in new revision');
|
||||
$this->assertFileIsPermanent($node_file_r1, 'Original file is still permanent.');
|
||||
|
||||
// Save a new version of the node without any changes.
|
||||
// Check that the file is still the same as the previous revision.
|
||||
@@ -687,23 +687,23 @@ class FileFieldRevisionTestCase extends FileFieldTestCase {
|
||||
$node = node_load($nid, NULL, TRUE);
|
||||
$node_file_r3 = (object) $node->{$field_name}[LANGUAGE_NONE][0];
|
||||
$node_vid_r3 = $node->vid;
|
||||
$this->assertEqual($node_file_r2, $node_file_r3, t('Previous revision file still in place after creating a new revision without a new file.'));
|
||||
$this->assertFileIsPermanent($node_file_r3, t('New revision file is permanent.'));
|
||||
$this->assertEqual($node_file_r2, $node_file_r3, 'Previous revision file still in place after creating a new revision without a new file.');
|
||||
$this->assertFileIsPermanent($node_file_r3, 'New revision file is permanent.');
|
||||
|
||||
// Revert to the first revision and check that the original file is active.
|
||||
$this->drupalPost('node/' . $nid . '/revisions/' . $node_vid_r1 . '/revert', array(), t('Revert'));
|
||||
$node = node_load($nid, NULL, TRUE);
|
||||
$node_file_r4 = (object) $node->{$field_name}[LANGUAGE_NONE][0];
|
||||
$node_vid_r4 = $node->vid;
|
||||
$this->assertEqual($node_file_r1, $node_file_r4, t('Original revision file still in place after reverting to the original revision.'));
|
||||
$this->assertFileIsPermanent($node_file_r4, t('Original revision file still permanent after reverting to the original revision.'));
|
||||
$this->assertEqual($node_file_r1, $node_file_r4, 'Original revision file still in place after reverting to the original revision.');
|
||||
$this->assertFileIsPermanent($node_file_r4, 'Original revision file still permanent after reverting to the original revision.');
|
||||
|
||||
// Delete the second revision and check that the file is kept (since it is
|
||||
// still being used by the third revision).
|
||||
$this->drupalPost('node/' . $nid . '/revisions/' . $node_vid_r2 . '/delete', array(), t('Delete'));
|
||||
$this->assertFileExists($node_file_r3, t('Second file is still available after deleting second revision, since it is being used by the third revision.'));
|
||||
$this->assertFileEntryExists($node_file_r3, t('Second file entry is still available after deleting second revision, since it is being used by the third revision.'));
|
||||
$this->assertFileIsPermanent($node_file_r3, t('Second file entry is still permanent after deleting second revision, since it is being used by the third revision.'));
|
||||
$this->assertFileExists($node_file_r3, 'Second file is still available after deleting second revision, since it is being used by the third revision.');
|
||||
$this->assertFileEntryExists($node_file_r3, 'Second file entry is still available after deleting second revision, since it is being used by the third revision.');
|
||||
$this->assertFileIsPermanent($node_file_r3, 'Second file entry is still permanent after deleting second revision, since it is being used by the third revision.');
|
||||
|
||||
// Attach the second file to a user.
|
||||
$user = $this->drupalCreateUser();
|
||||
@@ -714,9 +714,9 @@ class FileFieldRevisionTestCase extends FileFieldTestCase {
|
||||
|
||||
// Delete the third revision and check that the file is not deleted yet.
|
||||
$this->drupalPost('node/' . $nid . '/revisions/' . $node_vid_r3 . '/delete', array(), t('Delete'));
|
||||
$this->assertFileExists($node_file_r3, t('Second file is still available after deleting third revision, since it is being used by the user.'));
|
||||
$this->assertFileEntryExists($node_file_r3, t('Second file entry is still available after deleting third revision, since it is being used by the user.'));
|
||||
$this->assertFileIsPermanent($node_file_r3, t('Second file entry is still permanent after deleting third revision, since it is being used by the user.'));
|
||||
$this->assertFileExists($node_file_r3, 'Second file is still available after deleting third revision, since it is being used by the user.');
|
||||
$this->assertFileEntryExists($node_file_r3, 'Second file entry is still available after deleting third revision, since it is being used by the user.');
|
||||
$this->assertFileIsPermanent($node_file_r3, 'Second file entry is still permanent after deleting third revision, since it is being used by the user.');
|
||||
|
||||
// Delete the user and check that the file is also deleted.
|
||||
user_delete($user->uid);
|
||||
@@ -724,13 +724,13 @@ class FileFieldRevisionTestCase extends FileFieldTestCase {
|
||||
// not be necessary here. The file really is deleted, but stream wrappers
|
||||
// doesn't seem to think so unless we clear the PHP file stat() cache.
|
||||
clearstatcache();
|
||||
$this->assertFileNotExists($node_file_r3, t('Second file is now deleted after deleting third revision, since it is no longer being used by any other nodes.'));
|
||||
$this->assertFileEntryNotExists($node_file_r3, t('Second file entry is now deleted after deleting third revision, since it is no longer being used by any other nodes.'));
|
||||
$this->assertFileNotExists($node_file_r3, 'Second file is now deleted after deleting third revision, since it is no longer being used by any other nodes.');
|
||||
$this->assertFileEntryNotExists($node_file_r3, 'Second file entry is now deleted after deleting third revision, since it is no longer being used by any other nodes.');
|
||||
|
||||
// Delete the entire node and check that the original file is deleted.
|
||||
$this->drupalPost('node/' . $nid . '/delete', array(), t('Delete'));
|
||||
$this->assertFileNotExists($node_file_r1, t('Original file is deleted after deleting the entire node with two revisions remaining.'));
|
||||
$this->assertFileEntryNotExists($node_file_r1, t('Original file entry is deleted after deleting the entire node with two revisions remaining.'));
|
||||
$this->assertFileNotExists($node_file_r1, 'Original file is deleted after deleting the entire node with two revisions remaining.');
|
||||
$this->assertFileEntryNotExists($node_file_r1, 'Original file entry is deleted after deleting the entire node with two revisions remaining.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -774,7 +774,7 @@ class FileFieldDisplayTestCase extends FileFieldTestCase {
|
||||
);
|
||||
$this->drupalPost("admin/structure/types/manage/$type_name/display", $edit, t('Save'));
|
||||
$this->drupalGet('node/' . $node->nid);
|
||||
$this->assertNoText($field_name, t('Field label is hidden when no file attached for formatter %formatter', array('%formatter' => $formatter)));
|
||||
$this->assertNoText($field_name, format_string('Field label is hidden when no file attached for formatter %formatter', array('%formatter' => $formatter)));
|
||||
}
|
||||
|
||||
$test_file = $this->getTestFile('text');
|
||||
@@ -787,13 +787,13 @@ class FileFieldDisplayTestCase extends FileFieldTestCase {
|
||||
$node = node_load($nid, NULL, TRUE);
|
||||
$node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0];
|
||||
$default_output = theme('file_link', array('file' => $node_file));
|
||||
$this->assertRaw($default_output, t('Default formatter displaying correctly on full node view.'));
|
||||
$this->assertRaw($default_output, 'Default formatter displaying correctly on full node view.');
|
||||
|
||||
// Turn the "display" option off and check that the file is no longer displayed.
|
||||
$edit = array($field_name . '[' . LANGUAGE_NONE . '][0][display]' => FALSE);
|
||||
$this->drupalPost('node/' . $nid . '/edit', $edit, t('Save'));
|
||||
|
||||
$this->assertNoRaw($default_output, t('Field is hidden when "display" option is unchecked.'));
|
||||
$this->assertNoRaw($default_output, 'Field is hidden when "display" option is unchecked.');
|
||||
|
||||
}
|
||||
}
|
||||
@@ -829,17 +829,17 @@ class FileFieldValidateTestCase extends FileFieldTestCase {
|
||||
$langcode = LANGUAGE_NONE;
|
||||
$edit = array("title" => $this->randomName());
|
||||
$this->drupalPost('node/add/' . $type_name, $edit, t('Save'));
|
||||
$this->assertRaw(t('!title field is required.', array('!title' => $instance['label'])), t('Node save failed when required file field was empty.'));
|
||||
$this->assertRaw(t('!title field is required.', array('!title' => $instance['label'])), 'Node save failed when required file field was empty.');
|
||||
|
||||
// Create a new node with the uploaded file.
|
||||
$nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
|
||||
$this->assertTrue($nid !== FALSE, t('uploadNodeFile(@test_file, @field_name, @type_name) succeeded', array('@test_file' => $test_file->uri, '@field_name' => $field_name, '@type_name' => $type_name)));
|
||||
$this->assertTrue($nid !== FALSE, format_string('uploadNodeFile(@test_file, @field_name, @type_name) succeeded', array('@test_file' => $test_file->uri, '@field_name' => $field_name, '@type_name' => $type_name)));
|
||||
|
||||
$node = node_load($nid, NULL, TRUE);
|
||||
|
||||
$node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0];
|
||||
$this->assertFileExists($node_file, t('File exists after uploading to the required field.'));
|
||||
$this->assertFileEntryExists($node_file, t('File entry exists after uploading to the required field.'));
|
||||
$this->assertFileExists($node_file, 'File exists after uploading to the required field.');
|
||||
$this->assertFileEntryExists($node_file, 'File entry exists after uploading to the required field.');
|
||||
|
||||
// Try again with a multiple value field.
|
||||
field_delete_field($field_name);
|
||||
@@ -848,14 +848,14 @@ class FileFieldValidateTestCase extends FileFieldTestCase {
|
||||
// Try to post a new node without uploading a file in the multivalue field.
|
||||
$edit = array('title' => $this->randomName());
|
||||
$this->drupalPost('node/add/' . $type_name, $edit, t('Save'));
|
||||
$this->assertRaw(t('!title field is required.', array('!title' => $instance['label'])), t('Node save failed when required multiple value file field was empty.'));
|
||||
$this->assertRaw(t('!title field is required.', array('!title' => $instance['label'])), 'Node save failed when required multiple value file field was empty.');
|
||||
|
||||
// Create a new node with the uploaded file into the multivalue field.
|
||||
$nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
|
||||
$node = node_load($nid, NULL, TRUE);
|
||||
$node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0];
|
||||
$this->assertFileExists($node_file, t('File exists after uploading to the required multiple value field.'));
|
||||
$this->assertFileEntryExists($node_file, t('File entry exists after uploading to the required multipel value field.'));
|
||||
$this->assertFileExists($node_file, 'File exists after uploading to the required multiple value field.');
|
||||
$this->assertFileEntryExists($node_file, 'File entry exists after uploading to the required multipel value field.');
|
||||
|
||||
// Remove our file field.
|
||||
field_delete_field($field_name);
|
||||
@@ -890,13 +890,13 @@ class FileFieldValidateTestCase extends FileFieldTestCase {
|
||||
$nid = $this->uploadNodeFile($small_file, $field_name, $type_name);
|
||||
$node = node_load($nid, NULL, TRUE);
|
||||
$node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0];
|
||||
$this->assertFileExists($node_file, t('File exists after uploading a file (%filesize) under the max limit (%maxsize).', array('%filesize' => format_size($small_file->filesize), '%maxsize' => $max_filesize)));
|
||||
$this->assertFileEntryExists($node_file, t('File entry exists after uploading a file (%filesize) under the max limit (%maxsize).', array('%filesize' => format_size($small_file->filesize), '%maxsize' => $max_filesize)));
|
||||
$this->assertFileExists($node_file, format_string('File exists after uploading a file (%filesize) under the max limit (%maxsize).', array('%filesize' => format_size($small_file->filesize), '%maxsize' => $max_filesize)));
|
||||
$this->assertFileEntryExists($node_file, format_string('File entry exists after uploading a file (%filesize) under the max limit (%maxsize).', array('%filesize' => format_size($small_file->filesize), '%maxsize' => $max_filesize)));
|
||||
|
||||
// Check that uploading the large file fails (1M limit).
|
||||
$nid = $this->uploadNodeFile($large_file, $field_name, $type_name);
|
||||
$error_message = t('The file is %filesize exceeding the maximum file size of %maxsize.', array('%filesize' => format_size($large_file->filesize), '%maxsize' => format_size($file_limit)));
|
||||
$this->assertRaw($error_message, t('Node save failed when file (%filesize) exceeded the max upload size (%maxsize).', array('%filesize' => format_size($large_file->filesize), '%maxsize' => $max_filesize)));
|
||||
$this->assertRaw($error_message, format_string('Node save failed when file (%filesize) exceeded the max upload size (%maxsize).', array('%filesize' => format_size($large_file->filesize), '%maxsize' => $max_filesize)));
|
||||
}
|
||||
|
||||
// Turn off the max filesize.
|
||||
@@ -906,8 +906,8 @@ class FileFieldValidateTestCase extends FileFieldTestCase {
|
||||
$nid = $this->uploadNodeFile($large_file, $field_name, $type_name);
|
||||
$node = node_load($nid, NULL, TRUE);
|
||||
$node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0];
|
||||
$this->assertFileExists($node_file, t('File exists after uploading a file (%filesize) with no max limit.', array('%filesize' => format_size($large_file->filesize))));
|
||||
$this->assertFileEntryExists($node_file, t('File entry exists after uploading a file (%filesize) with no max limit.', array('%filesize' => format_size($large_file->filesize))));
|
||||
$this->assertFileExists($node_file, format_string('File exists after uploading a file (%filesize) with no max limit.', array('%filesize' => format_size($large_file->filesize))));
|
||||
$this->assertFileEntryExists($node_file, format_string('File entry exists after uploading a file (%filesize) with no max limit.', array('%filesize' => format_size($large_file->filesize))));
|
||||
|
||||
// Remove our file field.
|
||||
field_delete_field($field_name);
|
||||
@@ -933,8 +933,8 @@ class FileFieldValidateTestCase extends FileFieldTestCase {
|
||||
$nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
|
||||
$node = node_load($nid, NULL, TRUE);
|
||||
$node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0];
|
||||
$this->assertFileExists($node_file, t('File exists after uploading a file with no extension checking.'));
|
||||
$this->assertFileEntryExists($node_file, t('File entry exists after uploading a file with no extension checking.'));
|
||||
$this->assertFileExists($node_file, 'File exists after uploading a file with no extension checking.');
|
||||
$this->assertFileEntryExists($node_file, 'File entry exists after uploading a file with no extension checking.');
|
||||
|
||||
// Enable extension checking for text files.
|
||||
$this->updateFileField($field_name, $type_name, array('file_extensions' => 'txt'));
|
||||
@@ -942,7 +942,7 @@ class FileFieldValidateTestCase extends FileFieldTestCase {
|
||||
// Check that the file with the wrong extension cannot be uploaded.
|
||||
$nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
|
||||
$error_message = t('Only files with the following extensions are allowed: %files-allowed.', array('%files-allowed' => 'txt'));
|
||||
$this->assertRaw($error_message, t('Node save failed when file uploaded with the wrong extension.'));
|
||||
$this->assertRaw($error_message, 'Node save failed when file uploaded with the wrong extension.');
|
||||
|
||||
// Enable extension checking for text and image files.
|
||||
$this->updateFileField($field_name, $type_name, array('file_extensions' => "txt $test_file_extension"));
|
||||
@@ -951,8 +951,8 @@ class FileFieldValidateTestCase extends FileFieldTestCase {
|
||||
$nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
|
||||
$node = node_load($nid, NULL, TRUE);
|
||||
$node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0];
|
||||
$this->assertFileExists($node_file, t('File exists after uploading a file with extension checking.'));
|
||||
$this->assertFileEntryExists($node_file, t('File entry exists after uploading a file with extension checking.'));
|
||||
$this->assertFileExists($node_file, 'File exists after uploading a file with extension checking.');
|
||||
$this->assertFileEntryExists($node_file, 'File entry exists after uploading a file with extension checking.');
|
||||
|
||||
// Remove our file field.
|
||||
field_delete_field($field_name);
|
||||
@@ -986,7 +986,7 @@ class FileFieldPathTestCase extends FileFieldTestCase {
|
||||
// Check that the file was uploaded to the file root.
|
||||
$node = node_load($nid, NULL, TRUE);
|
||||
$node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0];
|
||||
$this->assertPathMatch('public://' . $test_file->filename, $node_file->uri, t('The file %file was uploaded to the correct path.', array('%file' => $node_file->uri)));
|
||||
$this->assertPathMatch('public://' . $test_file->filename, $node_file->uri, format_string('The file %file was uploaded to the correct path.', array('%file' => $node_file->uri)));
|
||||
|
||||
// Change the path to contain multiple subdirectories.
|
||||
$field = $this->updateFileField($field_name, $type_name, array('file_directory' => 'foo/bar/baz'));
|
||||
@@ -997,7 +997,7 @@ class FileFieldPathTestCase extends FileFieldTestCase {
|
||||
// Check that the file was uploaded into the subdirectory.
|
||||
$node = node_load($nid, NULL, TRUE);
|
||||
$node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0];
|
||||
$this->assertPathMatch('public://foo/bar/baz/' . $test_file->filename, $node_file->uri, t('The file %file was uploaded to the correct path.', array('%file' => $node_file->uri)));
|
||||
$this->assertPathMatch('public://foo/bar/baz/' . $test_file->filename, $node_file->uri, format_string('The file %file was uploaded to the correct path.', array('%file' => $node_file->uri)));
|
||||
|
||||
// Check the path when used with tokens.
|
||||
// Change the path to contain multiple token directories.
|
||||
@@ -1013,7 +1013,7 @@ class FileFieldPathTestCase extends FileFieldTestCase {
|
||||
// the user running the test case.
|
||||
$data = array('user' => $this->admin_user);
|
||||
$subdirectory = token_replace('[user:uid]/[user:name]', $data);
|
||||
$this->assertPathMatch('public://' . $subdirectory . '/' . $test_file->filename, $node_file->uri, t('The file %file was uploaded to the correct path with token replacements.', array('%file' => $node_file->uri)));
|
||||
$this->assertPathMatch('public://' . $subdirectory . '/' . $test_file->filename, $node_file->uri, format_string('The file %file was uploaded to the correct path with token replacements.', array('%file' => $node_file->uri)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1094,11 +1094,11 @@ class FileTokenReplaceTestCase extends FileFieldTestCase {
|
||||
$tests['[file:owner:uid]'] = $file->uid;
|
||||
|
||||
// Test to make sure that we generated something for each token.
|
||||
$this->assertFalse(in_array(0, array_map('strlen', $tests)), t('No empty tokens generated.'));
|
||||
$this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.');
|
||||
|
||||
foreach ($tests as $input => $expected) {
|
||||
$output = token_replace($input, array('file' => $file), array('language' => $language));
|
||||
$this->assertEqual($output, $expected, t('Sanitized file token %token replaced.', array('%token' => $input)));
|
||||
$this->assertEqual($output, $expected, format_string('Sanitized file token %token replaced.', array('%token' => $input)));
|
||||
}
|
||||
|
||||
// Generate and test unsanitized tokens.
|
||||
@@ -1109,7 +1109,7 @@ class FileTokenReplaceTestCase extends FileFieldTestCase {
|
||||
|
||||
foreach ($tests as $input => $expected) {
|
||||
$output = token_replace($input, array('file' => $file), array('language' => $language, 'sanitize' => FALSE));
|
||||
$this->assertEqual($output, $expected, t('Unsanitized file token %token replaced.', array('%token' => $input)));
|
||||
$this->assertEqual($output, $expected, format_string('Unsanitized file token %token replaced.', array('%token' => $input)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1154,10 +1154,10 @@ class FilePrivateTestCase extends FileFieldTestCase {
|
||||
$node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0];
|
||||
// Ensure the file can be downloaded.
|
||||
$this->drupalGet(file_create_url($node_file->uri));
|
||||
$this->assertResponse(200, t('Confirmed that the generated URL is correct by downloading the shipped file.'));
|
||||
$this->assertResponse(200, 'Confirmed that the generated URL is correct by downloading the shipped file.');
|
||||
$this->drupalLogOut();
|
||||
$this->drupalGet(file_create_url($node_file->uri));
|
||||
$this->assertResponse(403, t('Confirmed that access is denied for the file without the needed permission.'));
|
||||
$this->assertResponse(403, 'Confirmed that access is denied for the file without the needed permission.');
|
||||
|
||||
// Test with the field that should deny access through field access.
|
||||
$this->drupalLogin($this->admin_user);
|
||||
@@ -1166,6 +1166,6 @@ class FilePrivateTestCase extends FileFieldTestCase {
|
||||
$node_file = (object) $node->{$no_access_field_name}[LANGUAGE_NONE][0];
|
||||
// Ensure the file cannot be downloaded.
|
||||
$this->drupalGet(file_create_url($node_file->uri));
|
||||
$this->assertResponse(403, t('Confirmed that access is denied for the file without view field access permission.'));
|
||||
$this->assertResponse(403, 'Confirmed that access is denied for the file without view field access permission.');
|
||||
}
|
||||
}
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -57,20 +57,20 @@
|
||||
* - description: Additional administrative information about the filter's
|
||||
* behavior, if needed for clarification.
|
||||
* - settings callback: The name of a function that returns configuration form
|
||||
* elements for the filter. See hook_filter_FILTER_settings() for details.
|
||||
* elements for the filter. See callback_filter_settings() for details.
|
||||
* - default settings: An associative array containing default settings for
|
||||
* the filter, to be applied when the filter has not been configured yet.
|
||||
* - prepare callback: The name of a function that escapes the content before
|
||||
* the actual filtering happens. See hook_filter_FILTER_prepare() for
|
||||
* the actual filtering happens. See callback_filter_prepare() for
|
||||
* details.
|
||||
* - process callback: (required) The name the function that performs the
|
||||
* actual filtering. See hook_filter_FILTER_process() for details.
|
||||
* actual filtering. See callback_filter_process() for details.
|
||||
* - cache (default TRUE): Specifies whether the filtered text can be cached.
|
||||
* Note that setting this to FALSE makes the entire text format not
|
||||
* cacheable, which may have an impact on the site's overall performance.
|
||||
* See filter_format_allowcache() for details.
|
||||
* - tips callback: The name of a function that returns end-user-facing filter
|
||||
* usage guidelines for the filter. See hook_filter_FILTER_tips() for
|
||||
* usage guidelines for the filter. See callback_filter_tips() for
|
||||
* details.
|
||||
* - weight: A default weight for the filter in new text formats.
|
||||
*
|
||||
@@ -122,11 +122,9 @@ function hook_filter_info_alter(&$info) {
|
||||
*/
|
||||
|
||||
/**
|
||||
* Settings callback for hook_filter_info().
|
||||
* Provide a settings form for filter settings.
|
||||
*
|
||||
* Note: This is not really a hook. The function name is manually specified via
|
||||
* 'settings callback' in hook_filter_info(), with this recommended callback
|
||||
* name pattern. It is called from filter_admin_format_form().
|
||||
* Callback for hook_filter_info().
|
||||
*
|
||||
* This callback function is used to provide a settings form for filter
|
||||
* settings, for filters that need settings on a per-text-format basis. This
|
||||
@@ -158,8 +156,10 @@ function hook_filter_info_alter(&$info) {
|
||||
* @return
|
||||
* An array of form elements defining settings for the filter. Array keys
|
||||
* should match the array keys in $filter->settings and $defaults.
|
||||
*
|
||||
* @ingroup callbacks
|
||||
*/
|
||||
function hook_filter_FILTER_settings($form, &$form_state, $filter, $format, $defaults, $filters) {
|
||||
function callback_filter_settings($form, &$form_state, $filter, $format, $defaults, $filters) {
|
||||
$filter->settings += $defaults;
|
||||
|
||||
$elements = array();
|
||||
@@ -172,11 +172,9 @@ function hook_filter_FILTER_settings($form, &$form_state, $filter, $format, $def
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare callback for hook_filter_info().
|
||||
* Provide prepared text with special characters escaped.
|
||||
*
|
||||
* Note: This is not really a hook. The function name is manually specified via
|
||||
* 'prepare callback' in hook_filter_info(), with this recommended callback
|
||||
* name pattern. It is called from check_markup().
|
||||
* Callback for hook_filter_info().
|
||||
*
|
||||
* See hook_filter_info() for a description of the filtering process. Filters
|
||||
* should not use the 'prepare callback' step for anything other than escaping,
|
||||
@@ -199,19 +197,19 @@ function hook_filter_FILTER_settings($form, &$form_state, $filter, $format, $def
|
||||
*
|
||||
* @return
|
||||
* The prepared, escaped text.
|
||||
*
|
||||
* @ingroup callbacks
|
||||
*/
|
||||
function hook_filter_FILTER_prepare($text, $filter, $format, $langcode, $cache, $cache_id) {
|
||||
function callback_filter_prepare($text, $filter, $format, $langcode, $cache, $cache_id) {
|
||||
// Escape <code> and </code> tags.
|
||||
$text = preg_replace('|<code>(.+?)</code>|se', "[codefilter_code]$1[/codefilter_code]", $text);
|
||||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process callback for hook_filter_info().
|
||||
* Provide text filtered to conform to the supplied format.
|
||||
*
|
||||
* Note: This is not really a hook. The function name is manually specified via
|
||||
* 'process callback' in hook_filter_info(), with this recommended callback
|
||||
* name pattern. It is called from check_markup().
|
||||
* Callback for hook_filter_info().
|
||||
*
|
||||
* See hook_filter_info() for a description of the filtering process. This step
|
||||
* is where the filter actually transforms the text.
|
||||
@@ -232,19 +230,19 @@ function hook_filter_FILTER_prepare($text, $filter, $format, $langcode, $cache,
|
||||
*
|
||||
* @return
|
||||
* The filtered text.
|
||||
*
|
||||
* @ingroup callbacks
|
||||
*/
|
||||
function hook_filter_FILTER_process($text, $filter, $format, $langcode, $cache, $cache_id) {
|
||||
function callback_filter_process($text, $filter, $format, $langcode, $cache, $cache_id) {
|
||||
$text = preg_replace('|\[codefilter_code\](.+?)\[/codefilter_code\]|se', "<pre>$1</pre>", $text);
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tips callback for hook_filter_info().
|
||||
* Return help text for a filter.
|
||||
*
|
||||
* Note: This is not really a hook. The function name is manually specified via
|
||||
* 'tips callback' in hook_filter_info(), with this recommended callback
|
||||
* name pattern. It is called from _filter_tips().
|
||||
* Callback for hook_filter_info().
|
||||
*
|
||||
* A filter's tips should be informative and to the point. Short tips are
|
||||
* preferably one-liners.
|
||||
@@ -260,8 +258,10 @@ function hook_filter_FILTER_process($text, $filter, $format, $langcode, $cache,
|
||||
*
|
||||
* @return
|
||||
* Translated text to display as a tip.
|
||||
*
|
||||
* @ingroup callbacks
|
||||
*/
|
||||
function hook_filter_FILTER_tips($filter, $format, $long) {
|
||||
function callback_filter_tips($filter, $format, $long) {
|
||||
if ($long) {
|
||||
return t('Lines and paragraphs are automatically recognized. The <br /> line break, <p> paragraph and </p> close paragraph tags are inserted automatically. If paragraphs are not recognized simply add a couple blank lines.');
|
||||
}
|
||||
|
@@ -7,8 +7,8 @@ files[] = filter.test
|
||||
required = TRUE
|
||||
configure = admin/config/content/formats
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -1256,10 +1256,9 @@ function filter_filter_info() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter settings callback for the HTML content filter.
|
||||
* Implements callback_filter_settings().
|
||||
*
|
||||
* See hook_filter_FILTER_settings() for documentation of parameters and return
|
||||
* value.
|
||||
* Filter settings callback for the HTML content filter.
|
||||
*/
|
||||
function _filter_html_settings($form, &$form_state, $filter, $format, $defaults) {
|
||||
$filter->settings += $defaults;
|
||||
@@ -1285,6 +1284,8 @@ function _filter_html_settings($form, &$form_state, $filter, $format, $defaults)
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements callback_filter_process().
|
||||
*
|
||||
* Provides filtering of input into accepted HTML.
|
||||
*/
|
||||
function _filter_html($text, $filter) {
|
||||
@@ -1304,7 +1305,9 @@ function _filter_html($text, $filter) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter tips callback: Provides help for the HTML filter.
|
||||
* Implements callback_filter_tips().
|
||||
*
|
||||
* Provides help for the HTML filter.
|
||||
*
|
||||
* @see filter_filter_info()
|
||||
*/
|
||||
@@ -1404,7 +1407,9 @@ function _filter_html_tips($filter, $format, $long = FALSE) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter URL settings callback: Provides settings for the URL filter.
|
||||
* Implements callback_filter_settings().
|
||||
*
|
||||
* Provides settings for the URL filter.
|
||||
*
|
||||
* @see filter_filter_info()
|
||||
*/
|
||||
@@ -1425,6 +1430,8 @@ function _filter_url_settings($form, &$form_state, $filter, $format, $defaults)
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements callback_filter_process().
|
||||
*
|
||||
* Converts text into hyperlinks automatically.
|
||||
*
|
||||
* This filter identifies and makes clickable three types of "links".
|
||||
@@ -1454,7 +1461,7 @@ function _filter_url($text, $filter) {
|
||||
// we cannot cleanly differ between protocols here without hard-coding MAILTO,
|
||||
// so '//' is optional for all protocols.
|
||||
// @see filter_xss_bad_protocol()
|
||||
$protocols = variable_get('filter_allowed_protocols', array('http', 'https', 'ftp', 'news', 'nntp', 'telnet', 'mailto', 'irc', 'ssh', 'sftp', 'webcal', 'rtsp'));
|
||||
$protocols = variable_get('filter_allowed_protocols', array('ftp', 'http', 'https', 'irc', 'mailto', 'news', 'nntp', 'rtsp', 'sftp', 'ssh', 'tel', 'telnet', 'webcal'));
|
||||
$protocols = implode(':(?://)?|', $protocols) . ':(?://)?';
|
||||
|
||||
// Prepare domain name pattern.
|
||||
@@ -1650,7 +1657,9 @@ function _filter_url_trim($text, $length = NULL) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter tips callback: Provides help for the URL filter.
|
||||
* Implements callback_filter_tips().
|
||||
*
|
||||
* Provides help for the URL filter.
|
||||
*
|
||||
* @see filter_filter_info()
|
||||
*/
|
||||
@@ -1659,6 +1668,8 @@ function _filter_url_tips($filter, $format, $long = FALSE) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements callback_filter_process().
|
||||
*
|
||||
* Scans the input and makes sure that HTML tags are properly closed.
|
||||
*/
|
||||
function _filter_htmlcorrector($text) {
|
||||
@@ -1666,6 +1677,8 @@ function _filter_htmlcorrector($text) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements callback_filter_process().
|
||||
*
|
||||
* Converts line breaks into <p> and <br> in an intelligent fashion.
|
||||
*
|
||||
* Based on: http://photomatt.net/scripts/autop
|
||||
@@ -1733,7 +1746,9 @@ function _filter_autop($text) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter tips callback: Provides help for the auto-paragraph filter.
|
||||
* Implements callback_filter_tips().
|
||||
*
|
||||
* Provides help for the auto-paragraph filter.
|
||||
*
|
||||
* @see filter_filter_info()
|
||||
*/
|
||||
@@ -1747,6 +1762,8 @@ function _filter_autop_tips($filter, $format, $long = FALSE) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements callback_filter_process().
|
||||
*
|
||||
* Escapes all HTML tags, so they will be visible instead of being effective.
|
||||
*/
|
||||
function _filter_html_escape($text) {
|
||||
@@ -1754,7 +1771,9 @@ function _filter_html_escape($text) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter tips callback: Provides help for the HTML escaping filter.
|
||||
* Implements callback_filter_tips().
|
||||
*
|
||||
* Provides help for the HTML escaping filter.
|
||||
*
|
||||
* @see filter_filter_info()
|
||||
*/
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -9,8 +9,8 @@ files[] = forum.test
|
||||
configure = admin/structure/forum
|
||||
stylesheets[all][] = forum.css
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -233,6 +233,8 @@ function forum_entity_info_alter(&$info) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements callback_entity_info_uri().
|
||||
*
|
||||
* Entity URI callback used in forum_entity_info_alter().
|
||||
*/
|
||||
function forum_uri($forum) {
|
||||
|
@@ -94,18 +94,18 @@ class ForumTestCase extends DrupalWebTestCase {
|
||||
$edit = array();
|
||||
$edit['modules[Core][forum][enable]'] = FALSE;
|
||||
$this->drupalPost('admin/modules', $edit, t('Save configuration'));
|
||||
$this->assertText(t('The configuration options have been saved.'), t('Modules status has been updated.'));
|
||||
$this->assertText(t('The configuration options have been saved.'), 'Modules status has been updated.');
|
||||
module_list(TRUE);
|
||||
$this->assertFalse(module_exists('forum'), t('Forum module is not enabled.'));
|
||||
$this->assertFalse(module_exists('forum'), 'Forum module is not enabled.');
|
||||
|
||||
// Attempt to re-enable the Forum module and ensure it does not try to
|
||||
// recreate the taxonomy_forums field.
|
||||
$edit = array();
|
||||
$edit['modules[Core][forum][enable]'] = 'forum';
|
||||
$this->drupalPost('admin/modules', $edit, t('Save configuration'));
|
||||
$this->assertText(t('The configuration options have been saved.'), t('Modules status has been updated.'));
|
||||
$this->assertText(t('The configuration options have been saved.'), 'Modules status has been updated.');
|
||||
module_list(TRUE);
|
||||
$this->assertTrue(module_exists('forum'), t('Forum module is enabled.'));
|
||||
$this->assertTrue(module_exists('forum'), 'Forum module is enabled.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -166,17 +166,17 @@ class ForumTestCase extends DrupalWebTestCase {
|
||||
$xpath = $this->buildXPathQuery('//tr[@id=:forum]//td[@class="topics"]', $forum_arg);
|
||||
$topics = $this->xpath($xpath);
|
||||
$topics = trim($topics[0]);
|
||||
$this->assertEqual($topics, '6', t('Number of topics found.'));
|
||||
$this->assertEqual($topics, '6', 'Number of topics found.');
|
||||
|
||||
// Verify the number of unread topics.
|
||||
$unread_topics = _forum_topics_unread($this->forum['tid'], $this->edit_any_topics_user->uid);
|
||||
$unread_topics = format_plural($unread_topics, '1 new', '@count new');
|
||||
$xpath = $this->buildXPathQuery('//tr[@id=:forum]//td[@class="topics"]//a', $forum_arg);
|
||||
$this->assertFieldByXPath($xpath, $unread_topics, t('Number of unread topics found.'));
|
||||
$this->assertFieldByXPath($xpath, $unread_topics, 'Number of unread topics found.');
|
||||
|
||||
// Verify total number of posts in forum.
|
||||
$xpath = $this->buildXPathQuery('//tr[@id=:forum]//td[@class="posts"]', $forum_arg);
|
||||
$this->assertFieldByXPath($xpath, '6', t('Number of posts found.'));
|
||||
$this->assertFieldByXPath($xpath, '6', 'Number of posts found.');
|
||||
|
||||
// Test loading multiple forum nodes on the front page.
|
||||
$this->drupalLogin($this->drupalCreateUser(array('administer content types', 'create forum content')));
|
||||
@@ -226,7 +226,7 @@ class ForumTestCase extends DrupalWebTestCase {
|
||||
$this->drupalPost('node/add/forum', array('title' => $this->randomName(10), 'body[' . LANGUAGE_NONE .'][0][value]' => $this->randomName(120)), t('Save'));
|
||||
|
||||
$nid_count = db_query('SELECT COUNT(nid) FROM {node}')->fetchField();
|
||||
$this->assertEqual(0, $nid_count, t('A forum node was not created when missing a forum vocabulary.'));
|
||||
$this->assertEqual(0, $nid_count, 'A forum node was not created when missing a forum vocabulary.');
|
||||
|
||||
// Reset the defaults for future tests.
|
||||
module_enable(array('forum'));
|
||||
@@ -247,14 +247,14 @@ class ForumTestCase extends DrupalWebTestCase {
|
||||
$edit['blocks[forum_active][region]'] = 'sidebar_second';
|
||||
$this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
|
||||
$this->assertResponse(200);
|
||||
$this->assertText(t('The block settings have been updated.'), t('Active forum topics forum block was enabled'));
|
||||
$this->assertText(t('The block settings have been updated.'), 'Active forum topics forum block was enabled');
|
||||
|
||||
// Enable the new forum block.
|
||||
$edit = array();
|
||||
$edit['blocks[forum_new][region]'] = 'sidebar_second';
|
||||
$this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
|
||||
$this->assertResponse(200);
|
||||
$this->assertText(t('The block settings have been updated.'), t('[New forum topics] Forum block was enabled'));
|
||||
$this->assertText(t('The block settings have been updated.'), '[New forum topics] Forum block was enabled');
|
||||
|
||||
// Retrieve forum menu id.
|
||||
$mlid = db_query_range("SELECT mlid FROM {menu_links} WHERE link_path = 'forum' AND menu_name = 'navigation' AND module = 'system' ORDER BY mlid ASC", 0, 1)->fetchField();
|
||||
@@ -272,13 +272,13 @@ class ForumTestCase extends DrupalWebTestCase {
|
||||
// Verify "edit container" link exists and functions correctly.
|
||||
$this->drupalGet('admin/structure/forum');
|
||||
$this->clickLink('edit container');
|
||||
$this->assertRaw('Edit container', t('Followed the link to edit the container'));
|
||||
$this->assertRaw('Edit container', 'Followed the link to edit the container');
|
||||
// Create forum inside the forum container.
|
||||
$this->forum = $this->createForum('forum', $this->container['tid']);
|
||||
// Verify the "edit forum" link exists and functions correctly.
|
||||
$this->drupalGet('admin/structure/forum');
|
||||
$this->clickLink('edit forum');
|
||||
$this->assertRaw('Edit forum', t('Followed the link to edit the forum'));
|
||||
$this->assertRaw('Edit forum', 'Followed the link to edit the forum');
|
||||
// Navigate back to forum structure page.
|
||||
$this->drupalGet('admin/structure/forum');
|
||||
// Create second forum in container.
|
||||
@@ -334,15 +334,15 @@ class ForumTestCase extends DrupalWebTestCase {
|
||||
// Edit the vocabulary.
|
||||
$this->drupalPost('admin/structure/taxonomy/' . $original_settings->machine_name . '/edit', $edit, t('Save'));
|
||||
$this->assertResponse(200);
|
||||
$this->assertRaw(t('Updated vocabulary %name.', array('%name' => $title)), t('Vocabulary was edited'));
|
||||
$this->assertRaw(t('Updated vocabulary %name.', array('%name' => $title)), 'Vocabulary was edited');
|
||||
|
||||
// Grab the newly edited vocabulary.
|
||||
entity_get_controller('taxonomy_vocabulary')->resetCache();
|
||||
$current_settings = taxonomy_vocabulary_load($vid);
|
||||
|
||||
// Make sure we actually edited the vocabulary properly.
|
||||
$this->assertEqual($current_settings->name, $title, t('The name was updated'));
|
||||
$this->assertEqual($current_settings->description, $description, t('The description was updated'));
|
||||
$this->assertEqual($current_settings->name, $title, 'The name was updated');
|
||||
$this->assertEqual($current_settings->description, $description, 'The description was updated');
|
||||
|
||||
// Restore the original vocabulary.
|
||||
taxonomy_vocabulary_save($original_settings);
|
||||
@@ -379,7 +379,7 @@ class ForumTestCase extends DrupalWebTestCase {
|
||||
$this->drupalPost('admin/structure/forum/add/' . $type, $edit, t('Save'));
|
||||
$this->assertResponse(200);
|
||||
$type = ($type == 'container') ? 'forum container' : 'forum';
|
||||
$this->assertRaw(t('Created new @type %term.', array('%term' => $name, '@type' => t($type))), t(ucfirst($type) . ' was created'));
|
||||
$this->assertRaw(t('Created new @type %term.', array('%term' => $name, '@type' => t($type))), format_string('@type was created', array('@type' => ucfirst($type))));
|
||||
|
||||
// Verify forum.
|
||||
$term = db_query("SELECT * FROM {taxonomy_term_data} t WHERE t.vid = :vid AND t.name = :name AND t.description = :desc", array(':vid' => variable_get('forum_nav_vocabulary', ''), ':name' => $name, ':desc' => $description))->fetchAssoc();
|
||||
@@ -461,24 +461,24 @@ class ForumTestCase extends DrupalWebTestCase {
|
||||
|
||||
$type = t('Forum topic');
|
||||
if ($container) {
|
||||
$this->assertNoRaw(t('@type %title has been created.', array('@type' => $type, '%title' => $title)), t('Forum topic was not created'));
|
||||
$this->assertRaw(t('The item %title is a forum container, not a forum.', array('%title' => $forum['name'])), t('Error message was shown'));
|
||||
$this->assertNoRaw(t('@type %title has been created.', array('@type' => $type, '%title' => $title)), 'Forum topic was not created');
|
||||
$this->assertRaw(t('The item %title is a forum container, not a forum.', array('%title' => $forum['name'])), 'Error message was shown');
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$this->assertRaw(t('@type %title has been created.', array('@type' => $type, '%title' => $title)), t('Forum topic was created'));
|
||||
$this->assertNoRaw(t('The item %title is a forum container, not a forum.', array('%title' => $forum['name'])), t('No error message was shown'));
|
||||
$this->assertRaw(t('@type %title has been created.', array('@type' => $type, '%title' => $title)), 'Forum topic was created');
|
||||
$this->assertNoRaw(t('The item %title is a forum container, not a forum.', array('%title' => $forum['name'])), 'No error message was shown');
|
||||
}
|
||||
|
||||
// Retrieve node object, ensure that the topic was created and in the proper forum.
|
||||
$node = $this->drupalGetNodeByTitle($title);
|
||||
$this->assertTrue($node != NULL, t('Node @title was loaded', array('@title' => $title)));
|
||||
$this->assertTrue($node != NULL, format_string('Node @title was loaded', array('@title' => $title)));
|
||||
$this->assertEqual($node->taxonomy_forums[LANGUAGE_NONE][0]['tid'], $tid, 'Saved forum topic was in the expected forum');
|
||||
|
||||
// View forum topic.
|
||||
$this->drupalGet('node/' . $node->nid);
|
||||
$this->assertRaw($title, t('Subject was found'));
|
||||
$this->assertRaw($body, t('Body was found'));
|
||||
$this->assertRaw($title, 'Subject was found');
|
||||
$this->assertRaw($body, 'Body was found');
|
||||
|
||||
return $node;
|
||||
}
|
||||
@@ -502,14 +502,14 @@ class ForumTestCase extends DrupalWebTestCase {
|
||||
$this->drupalGet('admin/help/forum');
|
||||
$this->assertResponse($response2);
|
||||
if ($response2 == 200) {
|
||||
$this->assertTitle(t('Forum | Drupal'), t('Forum help title was displayed'));
|
||||
$this->assertText(t('Forum'), t('Forum help node was displayed'));
|
||||
$this->assertTitle(t('Forum | Drupal'), 'Forum help title was displayed');
|
||||
$this->assertText(t('Forum'), 'Forum help node was displayed');
|
||||
}
|
||||
|
||||
// Verify the forum blocks were displayed.
|
||||
$this->drupalGet('');
|
||||
$this->assertResponse(200);
|
||||
$this->assertText(t('New forum topics'), t('[New forum topics] Forum block was displayed'));
|
||||
$this->assertText(t('New forum topics'), '[New forum topics] Forum block was displayed');
|
||||
|
||||
// View forum container page.
|
||||
$this->verifyForumView($this->container);
|
||||
@@ -521,20 +521,20 @@ class ForumTestCase extends DrupalWebTestCase {
|
||||
// View forum node.
|
||||
$this->drupalGet('node/' . $node->nid);
|
||||
$this->assertResponse(200);
|
||||
$this->assertTitle($node->title . ' | Drupal', t('Forum node was displayed'));
|
||||
$this->assertTitle($node->title . ' | Drupal', 'Forum node was displayed');
|
||||
$breadcrumb = array(
|
||||
l(t('Home'), NULL),
|
||||
l(t('Forums'), 'forum'),
|
||||
l($this->container['name'], 'forum/' . $this->container['tid']),
|
||||
l($this->forum['name'], 'forum/' . $this->forum['tid']),
|
||||
);
|
||||
$this->assertRaw(theme('breadcrumb', array('breadcrumb' => $breadcrumb)), t('Breadcrumbs were displayed'));
|
||||
$this->assertRaw(theme('breadcrumb', array('breadcrumb' => $breadcrumb)), 'Breadcrumbs were displayed');
|
||||
|
||||
// View forum edit node.
|
||||
$this->drupalGet('node/' . $node->nid . '/edit');
|
||||
$this->assertResponse($response);
|
||||
if ($response == 200) {
|
||||
$this->assertTitle('Edit Forum topic ' . $node->title . ' | Drupal', t('Forum edit node was displayed'));
|
||||
$this->assertTitle('Edit Forum topic ' . $node->title . ' | Drupal', 'Forum edit node was displayed');
|
||||
}
|
||||
|
||||
if ($response == 200) {
|
||||
@@ -547,7 +547,7 @@ class ForumTestCase extends DrupalWebTestCase {
|
||||
$edit["taxonomy_forums[$langcode]"] = $this->root_forum['tid'];
|
||||
$edit['shadow'] = TRUE;
|
||||
$this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
|
||||
$this->assertRaw(t('Forum topic %title has been updated.', array('%title' => $edit["title"])), t('Forum node was edited'));
|
||||
$this->assertRaw(t('Forum topic %title has been updated.', array('%title' => $edit["title"])), 'Forum node was edited');
|
||||
|
||||
// Verify topic was moved to a different forum.
|
||||
$forum_tid = db_query("SELECT tid FROM {forum} WHERE nid = :nid AND vid = :vid", array(
|
||||
@@ -559,7 +559,7 @@ class ForumTestCase extends DrupalWebTestCase {
|
||||
// Delete forum node.
|
||||
$this->drupalPost('node/' . $node->nid . '/delete', array(), t('Delete'));
|
||||
$this->assertResponse($response);
|
||||
$this->assertRaw(t('Forum topic %title has been deleted.', array('%title' => $edit['title'])), t('Forum node was deleted'));
|
||||
$this->assertRaw(t('Forum topic %title has been deleted.', array('%title' => $edit['title'])), 'Forum node was deleted');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -575,7 +575,7 @@ class ForumTestCase extends DrupalWebTestCase {
|
||||
// View forum page.
|
||||
$this->drupalGet('forum/' . $forum['tid']);
|
||||
$this->assertResponse(200);
|
||||
$this->assertTitle($forum['name'] . ' | Drupal', t('Forum name was displayed'));
|
||||
$this->assertTitle($forum['name'] . ' | Drupal', 'Forum name was displayed');
|
||||
|
||||
$breadcrumb = array(
|
||||
l(t('Home'), NULL),
|
||||
@@ -585,7 +585,7 @@ class ForumTestCase extends DrupalWebTestCase {
|
||||
$breadcrumb[] = l($parent['name'], 'forum/' . $parent['tid']);
|
||||
}
|
||||
|
||||
$this->assertRaw(theme('breadcrumb', array('breadcrumb' => $breadcrumb)), t('Breadcrumbs were displayed'));
|
||||
$this->assertRaw(theme('breadcrumb', array('breadcrumb' => $breadcrumb)), 'Breadcrumbs were displayed');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
files[] = help.test
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -52,17 +52,17 @@ class HelpTestCase extends DrupalWebTestCase {
|
||||
// Check for css on admin/help.
|
||||
$this->drupalLogin($this->big_user);
|
||||
$this->drupalGet('admin/help');
|
||||
$this->assertRaw(drupal_get_path('module', 'help') . '/help.css', t('The help.css file is present in the HTML.'));
|
||||
$this->assertRaw(drupal_get_path('module', 'help') . '/help.css', 'The help.css file is present in the HTML.');
|
||||
|
||||
// Verify that introductory help text exists, goes for 100% module coverage.
|
||||
$this->assertRaw(t('For more information, refer to the specific topics listed in the next section or to the <a href="@drupal">online Drupal handbooks</a>.', array('@drupal' => 'http://drupal.org/documentation')), 'Help intro text correctly appears.');
|
||||
|
||||
// Verify that help topics text appears.
|
||||
$this->assertRaw('<h2>' . t('Help topics') . '</h2><p>' . t('Help is available on the following items:') . '</p>', t('Help topics text correctly appears.'));
|
||||
$this->assertRaw('<h2>' . t('Help topics') . '</h2><p>' . t('Help is available on the following items:') . '</p>', 'Help topics text correctly appears.');
|
||||
|
||||
// Make sure links are properly added for modules implementing hook_help().
|
||||
foreach ($this->modules as $module => $name) {
|
||||
$this->assertLink($name, 0, t('Link properly added to @name (admin/help/@module)', array('@module' => $module, '@name' => $name)));
|
||||
$this->assertLink($name, 0, format_string('Link properly added to @name (admin/help/@module)', array('@module' => $module, '@name' => $name)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,8 +78,8 @@ class HelpTestCase extends DrupalWebTestCase {
|
||||
$this->drupalGet('admin/help/' . $module);
|
||||
$this->assertResponse($response);
|
||||
if ($response == 200) {
|
||||
$this->assertTitle($name . ' | Drupal', t('[' . $module . '] Title was displayed'));
|
||||
$this->assertRaw('<h1 class="page-title">' . t($name) . '</h1>', t('[' . $module . '] Heading was displayed'));
|
||||
$this->assertTitle($name . ' | Drupal', format_string('%module title was displayed', array('%module' => $module)));
|
||||
$this->assertRaw('<h1 class="page-title">' . t($name) . '</h1>', format_string('%module heading was displayed', array('%module' => $module)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -132,6 +132,6 @@ class NoHelpTestCase extends DrupalWebTestCase {
|
||||
$this->drupalLogin($this->big_user);
|
||||
|
||||
$this->drupalGet('admin/help');
|
||||
$this->assertNoText('Hook menu tests', t('Making sure the test module menu_test does not display a help link in admin/help'));
|
||||
$this->assertNoText('Hook menu tests', 'Making sure the test module menu_test does not display a help link in admin/help');
|
||||
}
|
||||
}
|
||||
|
@@ -32,10 +32,9 @@ function image_style_list() {
|
||||
* An image style array.
|
||||
* @ingroup forms
|
||||
* @see image_style_form_submit()
|
||||
* @see image_style_name_validate()
|
||||
*/
|
||||
function image_style_form($form, &$form_state, $style) {
|
||||
$title = t('Edit %name style', array('%name' => $style['name']));
|
||||
$title = t('Edit %name style', array('%name' => $style['label']));
|
||||
drupal_set_title($title, PASS_THROUGH);
|
||||
|
||||
// Adjust this form for styles that must be overridden to edit.
|
||||
@@ -56,27 +55,31 @@ function image_style_form($form, &$form_state, $style) {
|
||||
'#markup' => theme('image_style_preview', array('style' => $style)),
|
||||
);
|
||||
|
||||
// Show the Image Style label.
|
||||
$form['label'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Image style name'),
|
||||
'#default_value' => $style['label'],
|
||||
'#disabled' => !$editable,
|
||||
'#required' => TRUE,
|
||||
);
|
||||
|
||||
// Allow the name of the style to be changed, unless this style is
|
||||
// provided by a module's hook_default_image_styles().
|
||||
if ($style['storage'] & IMAGE_STORAGE_MODULE) {
|
||||
$form['name'] = array(
|
||||
'#type' => 'item',
|
||||
'#title' => t('Image style name'),
|
||||
'#markup' => $style['name'],
|
||||
'#description' => t('This image style is being provided by %module module and may not be renamed.', array('%module' => $style['module'])),
|
||||
);
|
||||
}
|
||||
else {
|
||||
$form['name'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#size' => '64',
|
||||
'#title' => t('Image style name'),
|
||||
'#default_value' => $style['name'],
|
||||
'#description' => t('The name is used in URLs for generated images. Use only lowercase alphanumeric characters, underscores (_), and hyphens (-).'),
|
||||
'#element_validate' => array('image_style_name_validate'),
|
||||
'#required' => TRUE,
|
||||
);
|
||||
}
|
||||
$form['name'] = array(
|
||||
'#type' => 'machine_name',
|
||||
'#size' => '64',
|
||||
'#default_value' => $style['name'],
|
||||
'#disabled' => !$editable,
|
||||
'#description' => t('The name is used in URLs for generated images. Use only lowercase alphanumeric characters, underscores (_), and hyphens (-).'),
|
||||
'#required' => TRUE,
|
||||
'#machine_name' => array(
|
||||
'exists' => 'image_style_load',
|
||||
'source' => array('label'),
|
||||
'replace_pattern' => '[^0-9a-z_\-]',
|
||||
'error' => t('Please only use lowercase alphanumeric characters, underscores (_), and hyphens (-) for style names.'),
|
||||
),
|
||||
);
|
||||
|
||||
// Build the list of existing image effects for this image style.
|
||||
$form['effects'] = array(
|
||||
@@ -199,7 +202,7 @@ function image_style_form_add_submit($form, &$form_state) {
|
||||
* Submit handler for overriding a module-defined style.
|
||||
*/
|
||||
function image_style_form_override_submit($form, &$form_state) {
|
||||
drupal_set_message(t('The %style style has been overridden, allowing you to change its settings.', array('%style' => $form_state['image_style']['name'])));
|
||||
drupal_set_message(t('The %style style has been overridden, allowing you to change its settings.', array('%style' => $form_state['image_style']['label'])));
|
||||
image_default_style_save($form_state['image_style']);
|
||||
}
|
||||
|
||||
@@ -207,11 +210,10 @@ function image_style_form_override_submit($form, &$form_state) {
|
||||
* Submit handler for saving an image style.
|
||||
*/
|
||||
function image_style_form_submit($form, &$form_state) {
|
||||
// Update the image style name if it has changed.
|
||||
// Update the image style.
|
||||
$style = $form_state['image_style'];
|
||||
if (isset($form_state['values']['name']) && $style['name'] != $form_state['values']['name']) {
|
||||
$style['name'] = $form_state['values']['name'];
|
||||
}
|
||||
$style['name'] = $form_state['values']['name'];
|
||||
$style['label'] = $form_state['values']['label'];
|
||||
|
||||
// Update image effect weights.
|
||||
if (!empty($form_state['values']['effects'])) {
|
||||
@@ -236,18 +238,26 @@ function image_style_form_submit($form, &$form_state) {
|
||||
*
|
||||
* @ingroup forms
|
||||
* @see image_style_add_form_submit()
|
||||
* @see image_style_name_validate()
|
||||
*/
|
||||
function image_style_add_form($form, &$form_state) {
|
||||
$form['name'] = array(
|
||||
$form['label'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#size' => '64',
|
||||
'#title' => t('Style name'),
|
||||
'#default_value' => '',
|
||||
'#description' => t('The name is used in URLs for generated images. Use only lowercase alphanumeric characters, underscores (_), and hyphens (-).'),
|
||||
'#element_validate' => array('image_style_name_validate'),
|
||||
'#required' => TRUE,
|
||||
);
|
||||
$form['name'] = array(
|
||||
'#type' => 'machine_name',
|
||||
'#description' => t('The name is used in URLs for generated images. Use only lowercase alphanumeric characters, underscores (_), and hyphens (-).'),
|
||||
'#size' => '64',
|
||||
'#required' => TRUE,
|
||||
'#machine_name' => array(
|
||||
'exists' => 'image_style_load',
|
||||
'source' => array('label'),
|
||||
'replace_pattern' => '[^0-9a-z_\-]',
|
||||
'error' => t('Please only use lowercase alphanumeric characters, underscores (_), and hyphens (-) for style names.'),
|
||||
),
|
||||
);
|
||||
|
||||
$form['submit'] = array(
|
||||
'#type' => 'submit',
|
||||
@@ -261,14 +271,22 @@ function image_style_add_form($form, &$form_state) {
|
||||
* Submit handler for adding a new image style.
|
||||
*/
|
||||
function image_style_add_form_submit($form, &$form_state) {
|
||||
$style = array('name' => $form_state['values']['name']);
|
||||
$style = array(
|
||||
'name' => $form_state['values']['name'],
|
||||
'label' => $form_state['values']['label'],
|
||||
);
|
||||
$style = image_style_save($style);
|
||||
drupal_set_message(t('Style %name was created.', array('%name' => $style['name'])));
|
||||
drupal_set_message(t('Style %name was created.', array('%name' => $style['label'])));
|
||||
$form_state['redirect'] = 'admin/config/media/image-styles/edit/' . $style['name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Element validate function to ensure unique, URL safe style names.
|
||||
*
|
||||
* This function is no longer used in Drupal core since image style names are
|
||||
* now validated using #machine_name functionality. It is kept for backwards
|
||||
* compatibility (since non-core modules may be using it) and will be removed
|
||||
* in Drupal 8.
|
||||
*/
|
||||
function image_style_name_validate($element, $form_state) {
|
||||
// Check for duplicates.
|
||||
@@ -295,7 +313,7 @@ function image_style_name_validate($element, $form_state) {
|
||||
function image_style_delete_form($form, &$form_state, $style) {
|
||||
$form_state['image_style'] = $style;
|
||||
|
||||
$replacement_styles = array_diff_key(image_style_options(), array($style['name'] => ''));
|
||||
$replacement_styles = array_diff_key(image_style_options(TRUE, PASS_THROUGH), array($style['name'] => ''));
|
||||
$form['replacement'] = array(
|
||||
'#title' => t('Replacement style'),
|
||||
'#type' => 'select',
|
||||
@@ -305,7 +323,7 @@ function image_style_delete_form($form, &$form_state, $style) {
|
||||
|
||||
return confirm_form(
|
||||
$form,
|
||||
t('Optionally select a style before deleting %style', array('%style' => $style['name'])),
|
||||
t('Optionally select a style before deleting %style', array('%style' => $style['label'])),
|
||||
'admin/config/media/image-styles',
|
||||
t('If this style is in use on the site, you may select another style to replace it. All images that have been generated for this style will be permanently deleted.'),
|
||||
t('Delete'), t('Cancel')
|
||||
@@ -319,7 +337,7 @@ function image_style_delete_form_submit($form, &$form_state) {
|
||||
$style = $form_state['image_style'];
|
||||
|
||||
image_style_delete($style, $form_state['values']['replacement']);
|
||||
drupal_set_message(t('Style %name was deleted.', array('%name' => $style['name'])));
|
||||
drupal_set_message(t('Style %name was deleted.', array('%name' => $style['label'])));
|
||||
$form_state['redirect'] = 'admin/config/media/image-styles';
|
||||
}
|
||||
|
||||
@@ -331,7 +349,7 @@ function image_style_revert_form($form, &$form_state, $style) {
|
||||
|
||||
return confirm_form(
|
||||
$form,
|
||||
t('Revert the %style style?', array('%style' => $style['name'])),
|
||||
t('Revert the %style style?', array('%style' => $style['label'])),
|
||||
'admin/config/media/image-styles',
|
||||
t('Reverting this style will delete the customized settings and restore the defaults provided by the @module module.', array('@module' => $style['module'])),
|
||||
t('Revert'), t('Cancel')
|
||||
@@ -342,7 +360,7 @@ function image_style_revert_form($form, &$form_state, $style) {
|
||||
* Submit handler to convert an overridden style to its default.
|
||||
*/
|
||||
function image_style_revert_form_submit($form, &$form_state) {
|
||||
drupal_set_message(t('The %style style has been reverted to its defaults.', array('%style' => $form_state['image_style']['name'])));
|
||||
drupal_set_message(t('The %style style has been reverted to its defaults.', array('%style' => $form_state['image_style']['label'])));
|
||||
image_default_style_revert($form_state['image_style']);
|
||||
$form_state['redirect'] = 'admin/config/media/image-styles';
|
||||
}
|
||||
@@ -439,7 +457,7 @@ function image_effect_delete_form($form, &$form_state, $style, $effect) {
|
||||
$form_state['image_style'] = $style;
|
||||
$form_state['image_effect'] = $effect;
|
||||
|
||||
$question = t('Are you sure you want to delete the @effect effect from the %style style?', array('%style' => $style['name'], '@effect' => $effect['label']));
|
||||
$question = t('Are you sure you want to delete the @effect effect from the %style style?', array('%style' => $style['label'], '@effect' => $effect['label']));
|
||||
return confirm_form($form, $question, 'admin/config/media/image-styles/edit/' . $style['name'], '', t('Delete'));
|
||||
}
|
||||
|
||||
@@ -650,7 +668,7 @@ function theme_image_style_list($variables) {
|
||||
$rows = array();
|
||||
foreach ($styles as $style) {
|
||||
$row = array();
|
||||
$row[] = l($style['name'], 'admin/config/media/image-styles/edit/' . $style['name']);
|
||||
$row[] = l($style['label'], 'admin/config/media/image-styles/edit/' . $style['name']);
|
||||
$link_attributes = array(
|
||||
'attributes' => array(
|
||||
'class' => array('image-style-link'),
|
||||
@@ -805,7 +823,7 @@ function theme_image_style_preview($variables) {
|
||||
// Build the preview of the image style.
|
||||
$preview_url = file_create_url($preview_file) . '?cache_bypass=' . REQUEST_TIME;
|
||||
$output .= '<div class="preview-image-wrapper">';
|
||||
$output .= check_plain($style['name']) . ' (' . l(t('view actual size'), file_create_url($preview_file) . '?' . time()) . ')';
|
||||
$output .= check_plain($style['label']) . ' (' . l(t('view actual size'), file_create_url($preview_file) . '?' . time()) . ')';
|
||||
$output .= '<div class="preview-image modified-image" style="' . $preview_attributes['style'] . '">';
|
||||
$output .= '<a href="' . file_create_url($preview_file) . '?' . time() . '">' . theme('image', array('path' => $preview_url, 'alt' => t('Sample modified image'), 'title' => '', 'attributes' => $preview_attributes)) . '</a>';
|
||||
$output .= '<div class="height" style="height: ' . $preview_height . 'px"><span>' . $preview_image['height'] . 'px</span></div>';
|
||||
|
@@ -177,6 +177,7 @@ function hook_image_default_styles() {
|
||||
$styles = array();
|
||||
|
||||
$styles['mymodule_preview'] = array(
|
||||
'label' => 'My module preview',
|
||||
'effects' => array(
|
||||
array(
|
||||
'name' => 'image_scale',
|
||||
|
@@ -311,7 +311,7 @@ function image_field_widget_settings_form($field, $instance) {
|
||||
$form['preview_image_style'] = array(
|
||||
'#title' => t('Preview image style'),
|
||||
'#type' => 'select',
|
||||
'#options' => image_style_options(FALSE),
|
||||
'#options' => image_style_options(FALSE, PASS_THROUGH),
|
||||
'#empty_option' => '<' . t('no preview') . '>',
|
||||
'#default_value' => $settings['preview_image_style'],
|
||||
'#description' => t('The preview image will be shown while editing the content.'),
|
||||
@@ -495,7 +495,7 @@ function image_field_formatter_settings_form($field, $instance, $view_mode, $for
|
||||
$display = $instance['display'][$view_mode];
|
||||
$settings = $display['settings'];
|
||||
|
||||
$image_styles = image_style_options(FALSE);
|
||||
$image_styles = image_style_options(FALSE, PASS_THROUGH);
|
||||
$element['image_style'] = array(
|
||||
'#title' => t('Image style'),
|
||||
'#type' => 'select',
|
||||
@@ -528,7 +528,7 @@ function image_field_formatter_settings_summary($field, $instance, $view_mode) {
|
||||
|
||||
$summary = array();
|
||||
|
||||
$image_styles = image_style_options(FALSE);
|
||||
$image_styles = image_style_options(FALSE, PASS_THROUGH);
|
||||
// Unset possible 'No defined styles' option.
|
||||
unset($image_styles['']);
|
||||
// Styles could be lost because of enabled/disabled modules that defines
|
||||
|
@@ -7,8 +7,8 @@ dependencies[] = file
|
||||
files[] = image.test
|
||||
configure = admin/config/media/image-styles
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -41,11 +41,18 @@ function image_schema() {
|
||||
'not null' => TRUE,
|
||||
),
|
||||
'name' => array(
|
||||
'description' => 'The style name.',
|
||||
'description' => 'The style machine name.',
|
||||
'type' => 'varchar',
|
||||
'length' => 255,
|
||||
'not null' => TRUE,
|
||||
),
|
||||
'label' => array(
|
||||
'description' => 'The style administrative name.',
|
||||
'type' => 'varchar',
|
||||
'length' => 255,
|
||||
'not null' => TRUE,
|
||||
'default' => '',
|
||||
),
|
||||
),
|
||||
'primary key' => array('isid'),
|
||||
'unique keys' => array(
|
||||
@@ -448,6 +455,30 @@ function image_update_7004() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a column to the 'image_style' table to store administrative labels.
|
||||
*/
|
||||
function image_update_7005() {
|
||||
$field = array(
|
||||
'type' => 'varchar',
|
||||
'length' => 255,
|
||||
'not null' => TRUE,
|
||||
'default' => '',
|
||||
'description' => 'The style administrative name.',
|
||||
);
|
||||
db_add_field('image_styles', 'label', $field);
|
||||
|
||||
// Do a direct query here, rather than calling image_styles(),
|
||||
// in case Image module is disabled.
|
||||
$styles = db_query('SELECT name FROM {image_styles}')->fetchCol();
|
||||
foreach ($styles as $style) {
|
||||
db_update('image_styles')
|
||||
->fields(array('label' => $style))
|
||||
->condition('name', $style)
|
||||
->execute();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @} End of "addtogroup updates-7.x-extra".
|
||||
*/
|
||||
|
@@ -347,6 +347,7 @@ function image_image_default_styles() {
|
||||
$styles = array();
|
||||
|
||||
$styles['thumbnail'] = array(
|
||||
'label' => 'Thumbnail (100x100)',
|
||||
'effects' => array(
|
||||
array(
|
||||
'name' => 'image_scale',
|
||||
@@ -357,6 +358,7 @@ function image_image_default_styles() {
|
||||
);
|
||||
|
||||
$styles['medium'] = array(
|
||||
'label' => 'Medium (220x220)',
|
||||
'effects' => array(
|
||||
array(
|
||||
'name' => 'image_scale',
|
||||
@@ -367,6 +369,7 @@ function image_image_default_styles() {
|
||||
);
|
||||
|
||||
$styles['large'] = array(
|
||||
'label' => 'Large (480x480)',
|
||||
'effects' => array(
|
||||
array(
|
||||
'name' => 'image_scale',
|
||||
@@ -575,6 +578,7 @@ function image_styles() {
|
||||
$module_styles = module_invoke($module, 'image_default_styles');
|
||||
foreach ($module_styles as $style_name => $style) {
|
||||
$style['name'] = $style_name;
|
||||
$style['label'] = empty($style['label']) ? $style_name : $style['label'];
|
||||
$style['module'] = $module;
|
||||
$style['storage'] = IMAGE_STORAGE_DEFAULT;
|
||||
foreach ($style['effects'] as $key => $effect) {
|
||||
@@ -689,6 +693,10 @@ function image_style_save($style) {
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Add a default label when not given.
|
||||
if (empty($style['label'])) {
|
||||
$style['label'] = $style['name'];
|
||||
}
|
||||
drupal_write_record('image_styles', $style);
|
||||
$style['is_new'] = TRUE;
|
||||
}
|
||||
@@ -758,20 +766,28 @@ function image_style_effects($style) {
|
||||
*
|
||||
* @param $include_empty
|
||||
* If TRUE a <none> option will be inserted in the options array.
|
||||
* @param $output
|
||||
* Optional flag determining how the options will be sanitized on output.
|
||||
* Leave this at the default (CHECK_PLAIN) if you are using the output of
|
||||
* this function directly in an HTML context, such as for checkbox or radio
|
||||
* button labels, and do not plan to sanitize it on your own. If using the
|
||||
* output of this function as select list options (its primary use case), you
|
||||
* should instead set this flag to PASS_THROUGH to avoid double-escaping of
|
||||
* the output (the form API sanitizes select list options by default).
|
||||
*
|
||||
* @return
|
||||
* Array of image styles both key and value are set to style name.
|
||||
* Array of image styles with the machine name as key and the label as value.
|
||||
*/
|
||||
function image_style_options($include_empty = TRUE) {
|
||||
function image_style_options($include_empty = TRUE, $output = CHECK_PLAIN) {
|
||||
$styles = image_styles();
|
||||
$options = array();
|
||||
if ($include_empty && !empty($styles)) {
|
||||
$options[''] = t('<none>');
|
||||
}
|
||||
// Use the array concatenation operator '+' here instead of array_merge(),
|
||||
// because the latter loses the datatype of the array keys, turning
|
||||
// associative string keys into numeric ones without warning.
|
||||
$options = $options + drupal_map_assoc(array_keys($styles));
|
||||
foreach ($styles as $name => $style) {
|
||||
$options[$name] = ($output == PASS_THROUGH) ? $style['label'] : check_plain($style['label']);
|
||||
}
|
||||
|
||||
if (empty($options)) {
|
||||
$options[''] = t('No defined styles');
|
||||
}
|
||||
@@ -953,9 +969,10 @@ function image_style_transform_dimensions($style_name, array &$dimensions) {
|
||||
* An image style array.
|
||||
*/
|
||||
function image_style_flush($style) {
|
||||
$style_directory = drupal_realpath(file_default_scheme() . '://styles/' . $style['name']);
|
||||
if (is_dir($style_directory)) {
|
||||
file_unmanaged_delete_recursive($style_directory);
|
||||
// Delete the style directory in each registered wrapper.
|
||||
$wrappers = file_get_stream_wrappers(STREAM_WRAPPERS_WRITE_VISIBLE);
|
||||
foreach ($wrappers as $wrapper => $wrapper_data) {
|
||||
file_unmanaged_delete_recursive($wrapper . '://styles/' . $style['name']);
|
||||
}
|
||||
|
||||
// Let other modules update as necessary on flush.
|
||||
|
@@ -17,7 +17,6 @@
|
||||
* image_style_save()
|
||||
* image_style_delete()
|
||||
* image_style_options()
|
||||
* image_style_flush()
|
||||
* image_effect_definition_load()
|
||||
* image_effect_load()
|
||||
* image_effect_save()
|
||||
@@ -122,7 +121,7 @@ class ImageStylesPathAndUrlTestCase extends DrupalWebTestCase {
|
||||
parent::setUp('image_module_test');
|
||||
|
||||
$this->style_name = 'style_foo';
|
||||
image_style_save(array('name' => $this->style_name));
|
||||
image_style_save(array('name' => $this->style_name, 'label' => $this->randomString()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -132,11 +131,11 @@ class ImageStylesPathAndUrlTestCase extends DrupalWebTestCase {
|
||||
$scheme = 'public';
|
||||
$actual = image_style_path($this->style_name, "$scheme://foo/bar.gif");
|
||||
$expected = "$scheme://styles/" . $this->style_name . "/$scheme/foo/bar.gif";
|
||||
$this->assertEqual($actual, $expected, t('Got the path for a file URI.'));
|
||||
$this->assertEqual($actual, $expected, 'Got the path for a file URI.');
|
||||
|
||||
$actual = image_style_path($this->style_name, 'foo/bar.gif');
|
||||
$expected = "$scheme://styles/" . $this->style_name . "/$scheme/foo/bar.gif";
|
||||
$this->assertEqual($actual, $expected, t('Got the path for a relative file path.'));
|
||||
$this->assertEqual($actual, $expected, 'Got the path for a relative file path.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -186,7 +185,7 @@ class ImageStylesPathAndUrlTestCase extends DrupalWebTestCase {
|
||||
// Create the directories for the styles.
|
||||
$directory = $scheme . '://styles/' . $this->style_name;
|
||||
$status = file_prepare_directory($directory, FILE_CREATE_DIRECTORY);
|
||||
$this->assertNotIdentical(FALSE, $status, t('Created the directory for the generated images for the test style.'));
|
||||
$this->assertNotIdentical(FALSE, $status, 'Created the directory for the generated images for the test style.');
|
||||
|
||||
// Create a working copy of the file.
|
||||
$files = $this->drupalGetTestFiles('image');
|
||||
@@ -196,11 +195,11 @@ class ImageStylesPathAndUrlTestCase extends DrupalWebTestCase {
|
||||
// Let the image_module_test module know about this file, so it can claim
|
||||
// ownership in hook_file_download().
|
||||
variable_set('image_module_test_file_download', $original_uri);
|
||||
$this->assertNotIdentical(FALSE, $original_uri, t('Created the generated image file.'));
|
||||
$this->assertNotIdentical(FALSE, $original_uri, 'Created the generated image file.');
|
||||
|
||||
// Get the URL of a file that has not been generated and try to create it.
|
||||
$generated_uri = image_style_path($this->style_name, $original_uri);
|
||||
$this->assertFalse(file_exists($generated_uri), t('Generated file does not exist.'));
|
||||
$this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.');
|
||||
$generate_url = image_style_url($this->style_name, $original_uri);
|
||||
|
||||
// Ensure that the tests still pass when the file is generated by accessing
|
||||
@@ -224,21 +223,21 @@ class ImageStylesPathAndUrlTestCase extends DrupalWebTestCase {
|
||||
|
||||
// Fetch the URL that generates the file.
|
||||
$this->drupalGet($generate_url);
|
||||
$this->assertResponse(200, t('Image was generated at the URL.'));
|
||||
$this->assertTrue(file_exists($generated_uri), t('Generated file does exist after we accessed it.'));
|
||||
$this->assertRaw(file_get_contents($generated_uri), t('URL returns expected file.'));
|
||||
$this->assertResponse(200, 'Image was generated at the URL.');
|
||||
$this->assertTrue(file_exists($generated_uri), 'Generated file does exist after we accessed it.');
|
||||
$this->assertRaw(file_get_contents($generated_uri), 'URL returns expected file.');
|
||||
$generated_image_info = image_get_info($generated_uri);
|
||||
$this->assertEqual($this->drupalGetHeader('Content-Type'), $generated_image_info['mime_type'], t('Expected Content-Type was reported.'));
|
||||
$this->assertEqual($this->drupalGetHeader('Content-Length'), $generated_image_info['file_size'], t('Expected Content-Length was reported.'));
|
||||
$this->assertEqual($this->drupalGetHeader('Content-Type'), $generated_image_info['mime_type'], 'Expected Content-Type was reported.');
|
||||
$this->assertEqual($this->drupalGetHeader('Content-Length'), $generated_image_info['file_size'], 'Expected Content-Length was reported.');
|
||||
if ($scheme == 'private') {
|
||||
$this->assertEqual($this->drupalGetHeader('Expires'), 'Sun, 19 Nov 1978 05:00:00 GMT', t('Expires header was sent.'));
|
||||
$this->assertEqual($this->drupalGetHeader('Cache-Control'), 'no-cache, must-revalidate, post-check=0, pre-check=0', t('Cache-Control header was set to prevent caching.'));
|
||||
$this->assertEqual($this->drupalGetHeader('X-Image-Owned-By'), 'image_module_test', t('Expected custom header has been added.'));
|
||||
$this->assertEqual($this->drupalGetHeader('Expires'), 'Sun, 19 Nov 1978 05:00:00 GMT', 'Expires header was sent.');
|
||||
$this->assertEqual($this->drupalGetHeader('Cache-Control'), 'no-cache, must-revalidate, post-check=0, pre-check=0', 'Cache-Control header was set to prevent caching.');
|
||||
$this->assertEqual($this->drupalGetHeader('X-Image-Owned-By'), 'image_module_test', 'Expected custom header has been added.');
|
||||
|
||||
// Make sure that a second request to the already existing derivate works
|
||||
// too.
|
||||
$this->drupalGet($generate_url);
|
||||
$this->assertResponse(200, t('Image was generated at the URL.'));
|
||||
$this->assertResponse(200, 'Image was generated at the URL.');
|
||||
|
||||
// Make sure that access is denied for existing style files if we do not
|
||||
// have access.
|
||||
@@ -251,11 +250,11 @@ class ImageStylesPathAndUrlTestCase extends DrupalWebTestCase {
|
||||
$file_noaccess = array_shift($files);
|
||||
$original_uri_noaccess = file_unmanaged_copy($file_noaccess->uri, $scheme . '://', FILE_EXISTS_RENAME);
|
||||
$generated_uri_noaccess = $scheme . '://styles/' . $this->style_name . '/' . $scheme . '/'. drupal_basename($original_uri_noaccess);
|
||||
$this->assertFalse(file_exists($generated_uri_noaccess), t('Generated file does not exist.'));
|
||||
$this->assertFalse(file_exists($generated_uri_noaccess), 'Generated file does not exist.');
|
||||
$generate_url_noaccess = image_style_url($this->style_name, $original_uri_noaccess);
|
||||
|
||||
$this->drupalGet($generate_url_noaccess);
|
||||
$this->assertResponse(403, t('Confirmed that access is denied for the private image style.') );
|
||||
$this->assertResponse(403, 'Confirmed that access is denied for the private image style.');
|
||||
// Verify that images are not appended to the response. Currently this test only uses PNG images.
|
||||
if (strpos($generate_url, '.png') === FALSE ) {
|
||||
$this->fail('Confirming that private image styles are not appended require PNG file.');
|
||||
@@ -341,13 +340,13 @@ class ImageEffectsUnitTest extends ImageToolkitTestCase {
|
||||
* Test the image_resize_effect() function.
|
||||
*/
|
||||
function testResizeEffect() {
|
||||
$this->assertTrue(image_resize_effect($this->image, array('width' => 1, 'height' => 2)), t('Function returned the expected value.'));
|
||||
$this->assertTrue(image_resize_effect($this->image, array('width' => 1, 'height' => 2)), 'Function returned the expected value.');
|
||||
$this->assertToolkitOperationsCalled(array('resize'));
|
||||
|
||||
// Check the parameters.
|
||||
$calls = image_test_get_all_calls();
|
||||
$this->assertEqual($calls['resize'][0][1], 1, t('Width was passed correctly'));
|
||||
$this->assertEqual($calls['resize'][0][2], 2, t('Height was passed correctly'));
|
||||
$this->assertEqual($calls['resize'][0][1], 1, 'Width was passed correctly');
|
||||
$this->assertEqual($calls['resize'][0][2], 2, 'Height was passed correctly');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -355,13 +354,13 @@ class ImageEffectsUnitTest extends ImageToolkitTestCase {
|
||||
*/
|
||||
function testScaleEffect() {
|
||||
// @todo: need to test upscaling.
|
||||
$this->assertTrue(image_scale_effect($this->image, array('width' => 10, 'height' => 10)), t('Function returned the expected value.'));
|
||||
$this->assertTrue(image_scale_effect($this->image, array('width' => 10, 'height' => 10)), 'Function returned the expected value.');
|
||||
$this->assertToolkitOperationsCalled(array('resize'));
|
||||
|
||||
// Check the parameters.
|
||||
$calls = image_test_get_all_calls();
|
||||
$this->assertEqual($calls['resize'][0][1], 10, t('Width was passed correctly'));
|
||||
$this->assertEqual($calls['resize'][0][2], 5, t('Height was based off aspect ratio and passed correctly'));
|
||||
$this->assertEqual($calls['resize'][0][1], 10, 'Width was passed correctly');
|
||||
$this->assertEqual($calls['resize'][0][2], 5, 'Height was based off aspect ratio and passed correctly');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -369,42 +368,42 @@ class ImageEffectsUnitTest extends ImageToolkitTestCase {
|
||||
*/
|
||||
function testCropEffect() {
|
||||
// @todo should test the keyword offsets.
|
||||
$this->assertTrue(image_crop_effect($this->image, array('anchor' => 'top-1', 'width' => 3, 'height' => 4)), t('Function returned the expected value.'));
|
||||
$this->assertTrue(image_crop_effect($this->image, array('anchor' => 'top-1', 'width' => 3, 'height' => 4)), 'Function returned the expected value.');
|
||||
$this->assertToolkitOperationsCalled(array('crop'));
|
||||
|
||||
// Check the parameters.
|
||||
$calls = image_test_get_all_calls();
|
||||
$this->assertEqual($calls['crop'][0][1], 0, t('X was passed correctly'));
|
||||
$this->assertEqual($calls['crop'][0][2], 1, t('Y was passed correctly'));
|
||||
$this->assertEqual($calls['crop'][0][3], 3, t('Width was passed correctly'));
|
||||
$this->assertEqual($calls['crop'][0][4], 4, t('Height was passed correctly'));
|
||||
$this->assertEqual($calls['crop'][0][1], 0, 'X was passed correctly');
|
||||
$this->assertEqual($calls['crop'][0][2], 1, 'Y was passed correctly');
|
||||
$this->assertEqual($calls['crop'][0][3], 3, 'Width was passed correctly');
|
||||
$this->assertEqual($calls['crop'][0][4], 4, 'Height was passed correctly');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the image_scale_and_crop_effect() function.
|
||||
*/
|
||||
function testScaleAndCropEffect() {
|
||||
$this->assertTrue(image_scale_and_crop_effect($this->image, array('width' => 5, 'height' => 10)), t('Function returned the expected value.'));
|
||||
$this->assertTrue(image_scale_and_crop_effect($this->image, array('width' => 5, 'height' => 10)), 'Function returned the expected value.');
|
||||
$this->assertToolkitOperationsCalled(array('resize', 'crop'));
|
||||
|
||||
// Check the parameters.
|
||||
$calls = image_test_get_all_calls();
|
||||
$this->assertEqual($calls['crop'][0][1], 7.5, t('X was computed and passed correctly'));
|
||||
$this->assertEqual($calls['crop'][0][2], 0, t('Y was computed and passed correctly'));
|
||||
$this->assertEqual($calls['crop'][0][3], 5, t('Width was computed and passed correctly'));
|
||||
$this->assertEqual($calls['crop'][0][4], 10, t('Height was computed and passed correctly'));
|
||||
$this->assertEqual($calls['crop'][0][1], 7.5, 'X was computed and passed correctly');
|
||||
$this->assertEqual($calls['crop'][0][2], 0, 'Y was computed and passed correctly');
|
||||
$this->assertEqual($calls['crop'][0][3], 5, 'Width was computed and passed correctly');
|
||||
$this->assertEqual($calls['crop'][0][4], 10, 'Height was computed and passed correctly');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the image_desaturate_effect() function.
|
||||
*/
|
||||
function testDesaturateEffect() {
|
||||
$this->assertTrue(image_desaturate_effect($this->image, array()), t('Function returned the expected value.'));
|
||||
$this->assertTrue(image_desaturate_effect($this->image, array()), 'Function returned the expected value.');
|
||||
$this->assertToolkitOperationsCalled(array('desaturate'));
|
||||
|
||||
// Check the parameters.
|
||||
$calls = image_test_get_all_calls();
|
||||
$this->assertEqual(count($calls['desaturate'][0]), 1, t('Only the image was passed.'));
|
||||
$this->assertEqual(count($calls['desaturate'][0]), 1, 'Only the image was passed.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -412,13 +411,13 @@ class ImageEffectsUnitTest extends ImageToolkitTestCase {
|
||||
*/
|
||||
function testRotateEffect() {
|
||||
// @todo: need to test with 'random' => TRUE
|
||||
$this->assertTrue(image_rotate_effect($this->image, array('degrees' => 90, 'bgcolor' => '#fff')), t('Function returned the expected value.'));
|
||||
$this->assertTrue(image_rotate_effect($this->image, array('degrees' => 90, 'bgcolor' => '#fff')), 'Function returned the expected value.');
|
||||
$this->assertToolkitOperationsCalled(array('rotate'));
|
||||
|
||||
// Check the parameters.
|
||||
$calls = image_test_get_all_calls();
|
||||
$this->assertEqual($calls['rotate'][0][1], 90, t('Degrees were passed correctly'));
|
||||
$this->assertEqual($calls['rotate'][0][2], 0xffffff, t('Background color was passed correctly'));
|
||||
$this->assertEqual($calls['rotate'][0][1], 90, 'Degrees were passed correctly');
|
||||
$this->assertEqual($calls['rotate'][0][2], 0xffffff, 'Background color was passed correctly');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -484,13 +483,15 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase {
|
||||
*/
|
||||
function testNumericStyleName() {
|
||||
$style_name = rand();
|
||||
$style_label = $this->randomString();
|
||||
$edit = array(
|
||||
'name' => $style_name,
|
||||
'label' => $style_label,
|
||||
);
|
||||
$this->drupalPost('admin/config/media/image-styles/add', $edit, t('Create new style'));
|
||||
$this->assertRaw(t('Style %name was created.', array('%name' => $style_name)), t('Image style successfully created.'));
|
||||
$this->assertRaw(t('Style %name was created.', array('%name' => $style_label)), 'Image style successfully created.');
|
||||
$options = image_style_options();
|
||||
$this->assertTrue(array_key_exists($style_name, $options), t('Array key %key exists.', array('%key' => $style_name)));
|
||||
$this->assertTrue(array_key_exists($style_name, $options), format_string('Array key %key exists.', array('%key' => $style_name)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -499,6 +500,7 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase {
|
||||
function testStyle() {
|
||||
// Setup a style to be created and effects to add to it.
|
||||
$style_name = strtolower($this->randomName(10));
|
||||
$style_label = $this->randomString();
|
||||
$style_path = 'admin/config/media/image-styles/edit/' . $style_name;
|
||||
$effect_edits = array(
|
||||
'image_resize' => array(
|
||||
@@ -533,9 +535,10 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase {
|
||||
|
||||
$edit = array(
|
||||
'name' => $style_name,
|
||||
'label' => $style_label,
|
||||
);
|
||||
$this->drupalPost('admin/config/media/image-styles/add', $edit, t('Create new style'));
|
||||
$this->assertRaw(t('Style %name was created.', array('%name' => $style_name)), t('Image style successfully created.'));
|
||||
$this->assertRaw(t('Style %name was created.', array('%name' => $style_label)), 'Image style successfully created.');
|
||||
|
||||
// Add effect form.
|
||||
|
||||
@@ -557,7 +560,7 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase {
|
||||
foreach ($style['effects'] as $ieid => $effect) {
|
||||
$this->drupalGet($style_path . '/effects/' . $ieid);
|
||||
foreach ($effect_edits[$effect['name']] as $field => $value) {
|
||||
$this->assertFieldByName($field, $value, t('The %field field in the %effect effect has the correct value of %value.', array('%field' => $field, '%effect' => $effect['name'], '%value' => $value)));
|
||||
$this->assertFieldByName($field, $value, format_string('The %field field in the %effect effect has the correct value of %value.', array('%field' => $field, '%effect' => $effect['name'], '%value' => $value)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -573,14 +576,16 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase {
|
||||
$order_correct = FALSE;
|
||||
}
|
||||
}
|
||||
$this->assertTrue($order_correct, t('The order of the effects is correctly set by default.'));
|
||||
$this->assertTrue($order_correct, 'The order of the effects is correctly set by default.');
|
||||
|
||||
// Test the style overview form.
|
||||
// Change the name of the style and adjust the weights of effects.
|
||||
$style_name = strtolower($this->randomName(10));
|
||||
$style_label = $this->randomString();
|
||||
$weight = count($effect_edits);
|
||||
$edit = array(
|
||||
'name' => $style_name,
|
||||
'label' => $style_label,
|
||||
);
|
||||
foreach ($style['effects'] as $ieid => $effect) {
|
||||
$edit['effects[' . $ieid . '][weight]'] = $weight;
|
||||
@@ -589,7 +594,7 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase {
|
||||
|
||||
// Create an image to make sure it gets flushed after saving.
|
||||
$image_path = $this->createSampleImage($style);
|
||||
$this->assertEqual($this->getImageCount($style), 1, t('Image style %style image %file successfully generated.', array('%style' => $style['name'], '%file' => $image_path)));
|
||||
$this->assertEqual($this->getImageCount($style), 1, format_string('Image style %style image %file successfully generated.', array('%style' => $style['label'], '%file' => $image_path)));
|
||||
|
||||
$this->drupalPost($style_path, $edit, t('Update style'));
|
||||
|
||||
@@ -598,12 +603,12 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase {
|
||||
|
||||
// Check that the URL was updated.
|
||||
$this->drupalGet($style_path);
|
||||
$this->assertResponse(200, t('Image style %original renamed to %new', array('%original' => $style['name'], '%new' => $style_name)));
|
||||
$this->assertResponse(200, format_string('Image style %original renamed to %new', array('%original' => $style['label'], '%new' => $style_label)));
|
||||
|
||||
// Check that the image was flushed after updating the style.
|
||||
// This is especially important when renaming the style. Make sure that
|
||||
// the old image directory has been deleted.
|
||||
$this->assertEqual($this->getImageCount($style), 0, t('Image style %style was flushed after renaming the style and updating the order of effects.', array('%style' => $style['name'])));
|
||||
$this->assertEqual($this->getImageCount($style), 0, format_string('Image style %style was flushed after renaming the style and updating the order of effects.', array('%style' => $style['label'])));
|
||||
|
||||
// Load the style by the new name with the new weights.
|
||||
drupal_static_reset('image_styles');
|
||||
@@ -618,18 +623,18 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase {
|
||||
$order_correct = FALSE;
|
||||
}
|
||||
}
|
||||
$this->assertTrue($order_correct, t('The order of the effects is correctly set by default.'));
|
||||
$this->assertTrue($order_correct, 'The order of the effects is correctly set by default.');
|
||||
|
||||
// Image effect deletion form.
|
||||
|
||||
// Create an image to make sure it gets flushed after deleting an effect.
|
||||
$image_path = $this->createSampleImage($style);
|
||||
$this->assertEqual($this->getImageCount($style), 1, t('Image style %style image %file successfully generated.', array('%style' => $style['name'], '%file' => $image_path)));
|
||||
$this->assertEqual($this->getImageCount($style), 1, format_string('Image style %style image %file successfully generated.', array('%style' => $style['label'], '%file' => $image_path)));
|
||||
|
||||
// Test effect deletion form.
|
||||
$effect = array_pop($style['effects']);
|
||||
$this->drupalPost($style_path . '/effects/' . $effect['ieid'] . '/delete', array(), t('Delete'));
|
||||
$this->assertRaw(t('The image effect %name has been deleted.', array('%name' => $effect['label'])), t('Image effect deleted.'));
|
||||
$this->assertRaw(t('The image effect %name has been deleted.', array('%name' => $effect['label'])), 'Image effect deleted.');
|
||||
|
||||
// Style deletion form.
|
||||
|
||||
@@ -638,10 +643,10 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase {
|
||||
|
||||
// Confirm the style directory has been removed.
|
||||
$directory = file_default_scheme() . '://styles/' . $style_name;
|
||||
$this->assertFalse(is_dir($directory), t('Image style %style directory removed on style deletion.', array('%style' => $style['name'])));
|
||||
$this->assertFalse(is_dir($directory), format_string('Image style %style directory removed on style deletion.', array('%style' => $style['label'])));
|
||||
|
||||
drupal_static_reset('image_styles');
|
||||
$this->assertFalse(image_style_load($style_name), t('Image style %style successfully deleted.', array('%style' => $style['name'])));
|
||||
$this->assertFalse(image_style_load($style_name), format_string('Image style %style successfully deleted.', array('%style' => $style['label'])));
|
||||
|
||||
}
|
||||
|
||||
@@ -651,34 +656,36 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase {
|
||||
function testDefaultStyle() {
|
||||
// Setup a style to be created and effects to add to it.
|
||||
$style_name = 'thumbnail';
|
||||
$style_label = 'Thumbnail (100x100)';
|
||||
$edit_path = 'admin/config/media/image-styles/edit/' . $style_name;
|
||||
$delete_path = 'admin/config/media/image-styles/delete/' . $style_name;
|
||||
$revert_path = 'admin/config/media/image-styles/revert/' . $style_name;
|
||||
|
||||
// Ensure deleting a default is not possible.
|
||||
$this->drupalGet($delete_path);
|
||||
$this->assertText(t('Page not found'), t('Default styles may not be deleted.'));
|
||||
$this->assertText(t('Page not found'), 'Default styles may not be deleted.');
|
||||
|
||||
// Ensure that editing a default is not possible (without overriding).
|
||||
$this->drupalGet($edit_path);
|
||||
$this->assertNoField('edit-name', t('Default styles may not be renamed.'));
|
||||
$this->assertNoField('edit-submit', t('Default styles may not be edited.'));
|
||||
$this->assertNoField('edit-add', t('Default styles may not have new effects added.'));
|
||||
$disabled_field = $this->xpath('//input[@id=:id and @disabled="disabled"]', array(':id' => 'edit-name'));
|
||||
$this->assertTrue($disabled_field, 'Default styles may not be renamed.');
|
||||
$this->assertNoField('edit-submit', 'Default styles may not be edited.');
|
||||
$this->assertNoField('edit-add', 'Default styles may not have new effects added.');
|
||||
|
||||
// Create an image to make sure the default works before overriding.
|
||||
drupal_static_reset('image_styles');
|
||||
$style = image_style_load($style_name);
|
||||
$image_path = $this->createSampleImage($style);
|
||||
$this->assertEqual($this->getImageCount($style), 1, t('Image style %style image %file successfully generated.', array('%style' => $style['name'], '%file' => $image_path)));
|
||||
$this->assertEqual($this->getImageCount($style), 1, format_string('Image style %style image %file successfully generated.', array('%style' => $style['name'], '%file' => $image_path)));
|
||||
|
||||
// Verify that effects attached to a default style do not have an ieid key.
|
||||
foreach ($style['effects'] as $effect) {
|
||||
$this->assertFalse(isset($effect['ieid']), t('The %effect effect does not have an ieid.', array('%effect' => $effect['name'])));
|
||||
$this->assertFalse(isset($effect['ieid']), format_string('The %effect effect does not have an ieid.', array('%effect' => $effect['name'])));
|
||||
}
|
||||
|
||||
// Override the default.
|
||||
$this->drupalPost($edit_path, array(), t('Override defaults'));
|
||||
$this->assertRaw(t('The %style style has been overridden, allowing you to change its settings.', array('%style' => $style_name)), t('Default image style may be overridden.'));
|
||||
$this->assertRaw(t('The %style style has been overridden, allowing you to change its settings.', array('%style' => $style_label)), 'Default image style may be overridden.');
|
||||
|
||||
// Add sample effect to the overridden style.
|
||||
$this->drupalPost($edit_path, array('new' => 'image_desaturate'), t('Add'));
|
||||
@@ -687,22 +694,23 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase {
|
||||
|
||||
// Verify that effects attached to the style have an ieid now.
|
||||
foreach ($style['effects'] as $effect) {
|
||||
$this->assertTrue(isset($effect['ieid']), t('The %effect effect has an ieid.', array('%effect' => $effect['name'])));
|
||||
$this->assertTrue(isset($effect['ieid']), format_string('The %effect effect has an ieid.', array('%effect' => $effect['name'])));
|
||||
}
|
||||
|
||||
// The style should now have 2 effect, the original scale provided by core
|
||||
// and the desaturate effect we added in the override.
|
||||
$effects = array_values($style['effects']);
|
||||
$this->assertEqual($effects[0]['name'], 'image_scale', t('The default effect still exists in the overridden style.'));
|
||||
$this->assertEqual($effects[1]['name'], 'image_desaturate', t('The added effect exists in the overridden style.'));
|
||||
$this->assertEqual($effects[0]['name'], 'image_scale', 'The default effect still exists in the overridden style.');
|
||||
$this->assertEqual($effects[1]['name'], 'image_desaturate', 'The added effect exists in the overridden style.');
|
||||
|
||||
// Check that we are unable to rename an overridden style.
|
||||
// Check that we are able to rename an overridden style.
|
||||
$this->drupalGet($edit_path);
|
||||
$this->assertNoField('edit-name', t('Overridden styles may not be renamed.'));
|
||||
$disabled_field = $this->xpath('//input[@id=:id and @disabled="disabled"]', array(':id' => 'edit-name'));
|
||||
$this->assertFalse($disabled_field, 'Overridden styles may be renamed.');
|
||||
|
||||
// Create an image to ensure the override works properly.
|
||||
$image_path = $this->createSampleImage($style);
|
||||
$this->assertEqual($this->getImageCount($style), 1, t('Image style %style image %file successfully generated.', array('%style' => $style['name'], '%file' => $image_path)));
|
||||
$this->assertEqual($this->getImageCount($style), 1, format_string('Image style %style image %file successfully generated.', array('%style' => $style['label'], '%file' => $image_path)));
|
||||
|
||||
// Revert the image style.
|
||||
$this->drupalPost($revert_path, array(), t('Revert'));
|
||||
@@ -711,8 +719,8 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase {
|
||||
|
||||
// The style should now have the single effect for scale.
|
||||
$effects = array_values($style['effects']);
|
||||
$this->assertEqual($effects[0]['name'], 'image_scale', t('The default effect still exists in the reverted style.'));
|
||||
$this->assertFalse(array_key_exists(1, $effects), t('The added effect has been removed in the reverted style.'));
|
||||
$this->assertEqual($effects[0]['name'], 'image_scale', 'The default effect still exists in the reverted style.');
|
||||
$this->assertFalse(array_key_exists(1, $effects), 'The added effect has been removed in the reverted style.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -721,7 +729,8 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase {
|
||||
function testStyleReplacement() {
|
||||
// Create a new style.
|
||||
$style_name = strtolower($this->randomName(10));
|
||||
image_style_save(array('name' => $style_name));
|
||||
$style_label = $this->randomString();
|
||||
image_style_save(array('name' => $style_name, 'label' => $style_label));
|
||||
$style_path = 'admin/config/media/image-styles/edit/' . $style_name;
|
||||
|
||||
// Create an image field that uses the new style.
|
||||
@@ -739,28 +748,30 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase {
|
||||
|
||||
// Test that image is displayed using newly created style.
|
||||
$this->drupalGet('node/' . $nid);
|
||||
$this->assertRaw(check_plain(image_style_url($style_name, $node->{$field_name}[LANGUAGE_NONE][0]['uri'])), t('Image displayed using style @style.', array('@style' => $style_name)));
|
||||
$this->assertRaw(check_plain(image_style_url($style_name, $node->{$field_name}[LANGUAGE_NONE][0]['uri'])), format_string('Image displayed using style @style.', array('@style' => $style_name)));
|
||||
|
||||
// Rename the style and make sure the image field is updated.
|
||||
$new_style_name = strtolower($this->randomName(10));
|
||||
$new_style_label = $this->randomString();
|
||||
$edit = array(
|
||||
'name' => $new_style_name,
|
||||
'label' => $new_style_label,
|
||||
);
|
||||
$this->drupalPost('admin/config/media/image-styles/edit/' . $style_name, $edit, t('Update style'));
|
||||
$this->assertText(t('Changes to the style have been saved.'), t('Style %name was renamed to %new_name.', array('%name' => $style_name, '%new_name' => $new_style_name)));
|
||||
$this->assertText(t('Changes to the style have been saved.'), format_string('Style %name was renamed to %new_name.', array('%name' => $style_name, '%new_name' => $new_style_name)));
|
||||
$this->drupalGet('node/' . $nid);
|
||||
$this->assertRaw(check_plain(image_style_url($new_style_name, $node->{$field_name}[LANGUAGE_NONE][0]['uri'])), t('Image displayed using style replacement style.'));
|
||||
$this->assertRaw(check_plain(image_style_url($new_style_name, $node->{$field_name}[LANGUAGE_NONE][0]['uri'])), format_string('Image displayed using style replacement style.'));
|
||||
|
||||
// Delete the style and choose a replacement style.
|
||||
$edit = array(
|
||||
'replacement' => 'thumbnail',
|
||||
);
|
||||
$this->drupalPost('admin/config/media/image-styles/delete/' . $new_style_name, $edit, t('Delete'));
|
||||
$message = t('Style %name was deleted.', array('%name' => $new_style_name));
|
||||
$message = t('Style %name was deleted.', array('%name' => $new_style_label));
|
||||
$this->assertRaw($message, $message);
|
||||
|
||||
$this->drupalGet('node/' . $nid);
|
||||
$this->assertRaw(check_plain(image_style_url('thumbnail', $node->{$field_name}[LANGUAGE_NONE][0]['uri'])), t('Image displayed using style replacement style.'));
|
||||
$this->assertRaw(check_plain(image_style_url('thumbnail', $node->{$field_name}[LANGUAGE_NONE][0]['uri'])), format_string('Image displayed using style replacement style.'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -811,7 +822,7 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase {
|
||||
'height' => 20,
|
||||
);
|
||||
$default_output = theme('image', $image_info);
|
||||
$this->assertRaw($default_output, t('Default formatter displaying correctly on full node view.'));
|
||||
$this->assertRaw($default_output, 'Default formatter displaying correctly on full node view.');
|
||||
|
||||
// Test the image linked to file formatter.
|
||||
$instance = field_info_instance('node', $field_name, 'article');
|
||||
@@ -820,19 +831,19 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase {
|
||||
field_update_instance($instance);
|
||||
$default_output = l(theme('image', $image_info), file_create_url($image_uri), array('html' => TRUE));
|
||||
$this->drupalGet('node/' . $nid);
|
||||
$this->assertRaw($default_output, t('Image linked to file formatter displaying correctly on full node view.'));
|
||||
$this->assertRaw($default_output, 'Image linked to file formatter displaying correctly on full node view.');
|
||||
// Verify that the image can be downloaded.
|
||||
$this->assertEqual(file_get_contents($test_image->uri), $this->drupalGet(file_create_url($image_uri)), t('File was downloaded successfully.'));
|
||||
$this->assertEqual(file_get_contents($test_image->uri), $this->drupalGet(file_create_url($image_uri)), 'File was downloaded successfully.');
|
||||
if ($scheme == 'private') {
|
||||
// Only verify HTTP headers when using private scheme and the headers are
|
||||
// sent by Drupal.
|
||||
$this->assertEqual($this->drupalGetHeader('Content-Type'), 'image/png', t('Content-Type header was sent.'));
|
||||
$this->assertEqual($this->drupalGetHeader('Cache-Control'), 'private', t('Cache-Control header was sent.'));
|
||||
$this->assertEqual($this->drupalGetHeader('Content-Type'), 'image/png', 'Content-Type header was sent.');
|
||||
$this->assertEqual($this->drupalGetHeader('Cache-Control'), 'private', 'Cache-Control header was sent.');
|
||||
|
||||
// Log out and try to access the file.
|
||||
$this->drupalLogout();
|
||||
$this->drupalGet(file_create_url($image_uri));
|
||||
$this->assertResponse('403', t('Access denied to original image as anonymous user.'));
|
||||
$this->assertResponse('403', 'Access denied to original image as anonymous user.');
|
||||
|
||||
// Log in again.
|
||||
$this->drupalLogin($this->admin_user);
|
||||
@@ -843,7 +854,7 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase {
|
||||
field_update_instance($instance);
|
||||
$default_output = l(theme('image', $image_info), 'node/' . $nid, array('html' => TRUE, 'attributes' => array('class' => 'active')));
|
||||
$this->drupalGet('node/' . $nid);
|
||||
$this->assertRaw($default_output, t('Image linked to content formatter displaying correctly on full node view.'));
|
||||
$this->assertRaw($default_output, 'Image linked to content formatter displaying correctly on full node view.');
|
||||
|
||||
// Test the image style 'thumbnail' formatter.
|
||||
$instance['display']['default']['settings']['image_link'] = '';
|
||||
@@ -859,13 +870,13 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase {
|
||||
$image_info['height'] = 50;
|
||||
$default_output = theme('image', $image_info);
|
||||
$this->drupalGet('node/' . $nid);
|
||||
$this->assertRaw($default_output, t('Image style thumbnail formatter displaying correctly on full node view.'));
|
||||
$this->assertRaw($default_output, 'Image style thumbnail formatter displaying correctly on full node view.');
|
||||
|
||||
if ($scheme == 'private') {
|
||||
// Log out and try to access the file.
|
||||
$this->drupalLogout();
|
||||
$this->drupalGet(image_style_url('thumbnail', $image_uri));
|
||||
$this->assertResponse('403', t('Access denied to image style thumbnail as anonymous user.'));
|
||||
$this->assertResponse('403', 'Access denied to image style thumbnail as anonymous user.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -894,16 +905,16 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase {
|
||||
$instance = field_info_instance('node', $field_name, 'article');
|
||||
|
||||
$this->drupalGet('node/add/article');
|
||||
$this->assertText(t('Files must be less than 50 KB.'), t('Image widget max file size is displayed on article form.'));
|
||||
$this->assertText(t('Allowed file types: ' . $test_image_extension . '.'), t('Image widget allowed file types displayed on article form.'));
|
||||
$this->assertText(t('Images must be between 10x10 and 100x100 pixels.'), t('Image widget allowed resolution displayed on article form.'));
|
||||
$this->assertText(t('Files must be less than 50 KB.'), 'Image widget max file size is displayed on article form.');
|
||||
$this->assertText(t('Allowed file types: ' . $test_image_extension . '.'), 'Image widget allowed file types displayed on article form.');
|
||||
$this->assertText(t('Images must be between 10x10 and 100x100 pixels.'), 'Image widget allowed resolution displayed on article form.');
|
||||
|
||||
// We have to create the article first and then edit it because the alt
|
||||
// and title fields do not display until the image has been attached.
|
||||
$nid = $this->uploadNodeImage($test_image, $field_name, 'article');
|
||||
$this->drupalGet('node/' . $nid . '/edit');
|
||||
$this->assertFieldByName($field_name . '[' . LANGUAGE_NONE . '][0][alt]', '', t('Alt field displayed on article form.'));
|
||||
$this->assertFieldByName($field_name . '[' . LANGUAGE_NONE . '][0][title]', '', t('Title field displayed on article form.'));
|
||||
$this->assertFieldByName($field_name . '[' . LANGUAGE_NONE . '][0][alt]', '', 'Alt field displayed on article form.');
|
||||
$this->assertFieldByName($field_name . '[' . LANGUAGE_NONE . '][0][title]', '', 'Title field displayed on article form.');
|
||||
// Verify that the attached image is being previewed using the 'medium'
|
||||
// style.
|
||||
$node = node_load($nid, NULL, TRUE);
|
||||
@@ -913,7 +924,7 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase {
|
||||
'height' => 110,
|
||||
);
|
||||
$default_output = theme('image', $image_info);
|
||||
$this->assertRaw($default_output, t("Preview image is displayed using 'medium' style."));
|
||||
$this->assertRaw($default_output, "Preview image is displayed using 'medium' style.");
|
||||
|
||||
// Add alt/title fields to the image and verify that they are displayed.
|
||||
$image_info = array(
|
||||
@@ -929,7 +940,7 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase {
|
||||
);
|
||||
$this->drupalPost('node/' . $nid . '/edit', $edit, t('Save'));
|
||||
$default_output = theme('image', $image_info);
|
||||
$this->assertRaw($default_output, t('Image displayed using user supplied alt and title attributes.'));
|
||||
$this->assertRaw($default_output, 'Image displayed using user supplied alt and title attributes.');
|
||||
|
||||
// Verify that alt/title longer than allowed results in a validation error.
|
||||
$test_size = 2000;
|
||||
@@ -962,7 +973,7 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase {
|
||||
'title' => t('Image field formatter'),
|
||||
),
|
||||
));
|
||||
$this->assertTrue(stripos($image, 'testFound') > 0, t('Image field formatters can have attributes.'));
|
||||
$this->assertTrue(stripos($image, 'testFound') > 0, 'Image field formatters can have attributes.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -979,7 +990,7 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase {
|
||||
$this->drupalGet('node/' . $node->nid);
|
||||
// Verify that no image is displayed on the page by checking for the class
|
||||
// that would be used on the image field.
|
||||
$this->assertNoPattern('<div class="(.*?)field-name-' . strtr($field_name, '_', '-') . '(.*?)">', t('No image displayed when no image is attached and no default image specified.'));
|
||||
$this->assertNoPattern('<div class="(.*?)field-name-' . strtr($field_name, '_', '-') . '(.*?)">', 'No image displayed when no image is attached and no default image specified.');
|
||||
|
||||
// Add a default image to the public imagefield instance.
|
||||
$images = $this->drupalGetTestFiles('image');
|
||||
@@ -991,10 +1002,10 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase {
|
||||
field_info_cache_clear();
|
||||
$field = field_info_field($field_name);
|
||||
$image = file_load($field['settings']['default_image']);
|
||||
$this->assertTrue($image->status == FILE_STATUS_PERMANENT, t('The default image status is permanent.'));
|
||||
$this->assertTrue($image->status == FILE_STATUS_PERMANENT, 'The default image status is permanent.');
|
||||
$default_output = theme('image', array('path' => $image->uri));
|
||||
$this->drupalGet('node/' . $node->nid);
|
||||
$this->assertRaw($default_output, t('Default image displayed when no user supplied image is present.'));
|
||||
$this->assertRaw($default_output, 'Default image displayed when no user supplied image is present.');
|
||||
|
||||
// Create a node with an image attached and ensure that the default image
|
||||
// is not displayed.
|
||||
@@ -1007,8 +1018,8 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase {
|
||||
);
|
||||
$image_output = theme('image', $image_info);
|
||||
$this->drupalGet('node/' . $nid);
|
||||
$this->assertNoRaw($default_output, t('Default image is not displayed when user supplied image is present.'));
|
||||
$this->assertRaw($image_output, t('User supplied image is displayed.'));
|
||||
$this->assertNoRaw($default_output, 'Default image is not displayed when user supplied image is present.');
|
||||
$this->assertRaw($image_output, 'User supplied image is displayed.');
|
||||
|
||||
// Remove default image from the field and make sure it is no longer used.
|
||||
$edit = array(
|
||||
@@ -1018,7 +1029,7 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase {
|
||||
// Clear field info cache so the new default image is detected.
|
||||
field_info_cache_clear();
|
||||
$field = field_info_field($field_name);
|
||||
$this->assertFalse($field['settings']['default_image'], t('Default image removed from field.'));
|
||||
$this->assertFalse($field['settings']['default_image'], 'Default image removed from field.');
|
||||
// Create an image field that uses the private:// scheme and test that the
|
||||
// default image works as expected.
|
||||
$private_field_name = strtolower($this->randomName());
|
||||
@@ -1030,14 +1041,14 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase {
|
||||
$this->drupalPost('admin/structure/types/manage/article/fields/' . $private_field_name, $edit, t('Save settings'));
|
||||
$private_field = field_info_field($private_field_name);
|
||||
$image = file_load($private_field['settings']['default_image']);
|
||||
$this->assertEqual('private', file_uri_scheme($image->uri), t('Default image uses private:// scheme.'));
|
||||
$this->assertTrue($image->status == FILE_STATUS_PERMANENT, t('The default image status is permanent.'));
|
||||
$this->assertEqual('private', file_uri_scheme($image->uri), 'Default image uses private:// scheme.');
|
||||
$this->assertTrue($image->status == FILE_STATUS_PERMANENT, 'The default image status is permanent.');
|
||||
// Create a new node with no image attached and ensure that default private
|
||||
// image is displayed.
|
||||
$node = $this->drupalCreateNode(array('type' => 'article'));
|
||||
$default_output = theme('image', array('path' => $image->uri));
|
||||
$this->drupalGet('node/' . $node->nid);
|
||||
$this->assertRaw($default_output, t('Default private image displayed when no user supplied image is present.'));
|
||||
$this->assertRaw($default_output, 'Default private image displayed when no user supplied image is present.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1083,9 +1094,9 @@ class ImageFieldValidateTestCase extends ImageFieldTestCase {
|
||||
}
|
||||
}
|
||||
$nid = $this->uploadNodeImage($image_that_is_too_small, $field_name, 'article');
|
||||
$this->assertText(t('The specified file ' . $image_that_is_too_small->filename . ' could not be uploaded. The image is too small; the minimum dimensions are 50x50 pixels.'), t('Node save failed when minimum image resolution was not met.'));
|
||||
$this->assertText(t('The specified file ' . $image_that_is_too_small->filename . ' could not be uploaded. The image is too small; the minimum dimensions are 50x50 pixels.'), 'Node save failed when minimum image resolution was not met.');
|
||||
$nid = $this->uploadNodeImage($image_that_is_too_big, $field_name, 'article');
|
||||
$this->assertText(t('The image was resized to fit within the maximum allowed dimensions of 100x100 pixels.'), t('Image exceeding max resolution was properly resized.'));
|
||||
$this->assertText(t('The image was resized to fit within the maximum allowed dimensions of 100x100 pixels.'), 'Image exceeding max resolution was properly resized.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1116,7 +1127,7 @@ class ImageDimensionsTestCase extends DrupalWebTestCase {
|
||||
$original_uri = file_unmanaged_copy($file->uri, 'public://', FILE_EXISTS_RENAME);
|
||||
|
||||
// Create a style.
|
||||
$style = image_style_save(array('name' => 'test'));
|
||||
$style = image_style_save(array('name' => 'test', 'label' => 'Test'));
|
||||
$generated_uri = 'public://styles/test/public/'. drupal_basename($original_uri);
|
||||
$url = image_style_url('test', $original_uri);
|
||||
|
||||
@@ -1140,14 +1151,14 @@ class ImageDimensionsTestCase extends DrupalWebTestCase {
|
||||
|
||||
image_effect_save($effect);
|
||||
$img_tag = theme_image_style($variables);
|
||||
$this->assertEqual($img_tag, '<img typeof="foaf:Image" src="' . check_plain($url) . '" width="120" height="60" alt="" />', t('Expected img tag was found.'));
|
||||
$this->assertFalse(file_exists($generated_uri), t('Generated file does not exist.'));
|
||||
$this->assertEqual($img_tag, '<img typeof="foaf:Image" src="' . check_plain($url) . '" width="120" height="60" alt="" />', 'Expected img tag was found.');
|
||||
$this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.');
|
||||
$this->drupalGet($url);
|
||||
$this->assertResponse(200, t('Image was generated at the URL.'));
|
||||
$this->assertTrue(file_exists($generated_uri), t('Generated file does exist after we accessed it.'));
|
||||
$this->assertResponse(200, 'Image was generated at the URL.');
|
||||
$this->assertTrue(file_exists($generated_uri), 'Generated file does exist after we accessed it.');
|
||||
$image_info = image_get_info($generated_uri);
|
||||
$this->assertEqual($image_info['width'], 120, t('Expected width was found.'));
|
||||
$this->assertEqual($image_info['height'], 60, t('Expected height was found.'));
|
||||
$this->assertEqual($image_info['width'], 120, 'Expected width was found.');
|
||||
$this->assertEqual($image_info['height'], 60, 'Expected height was found.');
|
||||
|
||||
// Rotate 90 degrees anticlockwise.
|
||||
$effect = array(
|
||||
@@ -1161,14 +1172,14 @@ class ImageDimensionsTestCase extends DrupalWebTestCase {
|
||||
|
||||
image_effect_save($effect);
|
||||
$img_tag = theme_image_style($variables);
|
||||
$this->assertEqual($img_tag, '<img typeof="foaf:Image" src="' . check_plain($url) . '" width="60" height="120" alt="" />', t('Expected img tag was found.'));
|
||||
$this->assertFalse(file_exists($generated_uri), t('Generated file does not exist.'));
|
||||
$this->assertEqual($img_tag, '<img typeof="foaf:Image" src="' . check_plain($url) . '" width="60" height="120" alt="" />', 'Expected img tag was found.');
|
||||
$this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.');
|
||||
$this->drupalGet($url);
|
||||
$this->assertResponse(200, t('Image was generated at the URL.'));
|
||||
$this->assertTrue(file_exists($generated_uri), t('Generated file does exist after we accessed it.'));
|
||||
$this->assertResponse(200, 'Image was generated at the URL.');
|
||||
$this->assertTrue(file_exists($generated_uri), 'Generated file does exist after we accessed it.');
|
||||
$image_info = image_get_info($generated_uri);
|
||||
$this->assertEqual($image_info['width'], 60, t('Expected width was found.'));
|
||||
$this->assertEqual($image_info['height'], 120, t('Expected height was found.'));
|
||||
$this->assertEqual($image_info['width'], 60, 'Expected width was found.');
|
||||
$this->assertEqual($image_info['height'], 120, 'Expected height was found.');
|
||||
|
||||
// Scale an image that is higher than it is wide (rotated by previous effect).
|
||||
$effect = array(
|
||||
@@ -1183,14 +1194,14 @@ class ImageDimensionsTestCase extends DrupalWebTestCase {
|
||||
|
||||
image_effect_save($effect);
|
||||
$img_tag = theme_image_style($variables);
|
||||
$this->assertEqual($img_tag, '<img typeof="foaf:Image" src="' . check_plain($url) . '" width="45" height="90" alt="" />', t('Expected img tag was found.'));
|
||||
$this->assertFalse(file_exists($generated_uri), t('Generated file does not exist.'));
|
||||
$this->assertEqual($img_tag, '<img typeof="foaf:Image" src="' . check_plain($url) . '" width="45" height="90" alt="" />', 'Expected img tag was found.');
|
||||
$this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.');
|
||||
$this->drupalGet($url);
|
||||
$this->assertResponse(200, t('Image was generated at the URL.'));
|
||||
$this->assertTrue(file_exists($generated_uri), t('Generated file does exist after we accessed it.'));
|
||||
$this->assertResponse(200, 'Image was generated at the URL.');
|
||||
$this->assertTrue(file_exists($generated_uri), 'Generated file does exist after we accessed it.');
|
||||
$image_info = image_get_info($generated_uri);
|
||||
$this->assertEqual($image_info['width'], 45, t('Expected width was found.'));
|
||||
$this->assertEqual($image_info['height'], 90, t('Expected height was found.'));
|
||||
$this->assertEqual($image_info['width'], 45, 'Expected width was found.');
|
||||
$this->assertEqual($image_info['height'], 90, 'Expected height was found.');
|
||||
|
||||
// Test upscale disabled.
|
||||
$effect = array(
|
||||
@@ -1205,14 +1216,14 @@ class ImageDimensionsTestCase extends DrupalWebTestCase {
|
||||
|
||||
image_effect_save($effect);
|
||||
$img_tag = theme_image_style($variables);
|
||||
$this->assertEqual($img_tag, '<img typeof="foaf:Image" src="' . check_plain($url) . '" width="45" height="90" alt="" />', t('Expected img tag was found.'));
|
||||
$this->assertFalse(file_exists($generated_uri), t('Generated file does not exist.'));
|
||||
$this->assertEqual($img_tag, '<img typeof="foaf:Image" src="' . check_plain($url) . '" width="45" height="90" alt="" />', 'Expected img tag was found.');
|
||||
$this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.');
|
||||
$this->drupalGet($url);
|
||||
$this->assertResponse(200, t('Image was generated at the URL.'));
|
||||
$this->assertTrue(file_exists($generated_uri), t('Generated file does exist after we accessed it.'));
|
||||
$this->assertResponse(200, 'Image was generated at the URL.');
|
||||
$this->assertTrue(file_exists($generated_uri), 'Generated file does exist after we accessed it.');
|
||||
$image_info = image_get_info($generated_uri);
|
||||
$this->assertEqual($image_info['width'], 45, t('Expected width was found.'));
|
||||
$this->assertEqual($image_info['height'], 90, t('Expected height was found.'));
|
||||
$this->assertEqual($image_info['width'], 45, 'Expected width was found.');
|
||||
$this->assertEqual($image_info['height'], 90, 'Expected height was found.');
|
||||
|
||||
// Add a desaturate effect.
|
||||
$effect = array(
|
||||
@@ -1223,14 +1234,14 @@ class ImageDimensionsTestCase extends DrupalWebTestCase {
|
||||
|
||||
image_effect_save($effect);
|
||||
$img_tag = theme_image_style($variables);
|
||||
$this->assertEqual($img_tag, '<img typeof="foaf:Image" src="' . check_plain($url) . '" width="45" height="90" alt="" />', t('Expected img tag was found.'));
|
||||
$this->assertFalse(file_exists($generated_uri), t('Generated file does not exist.'));
|
||||
$this->assertEqual($img_tag, '<img typeof="foaf:Image" src="' . check_plain($url) . '" width="45" height="90" alt="" />', 'Expected img tag was found.');
|
||||
$this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.');
|
||||
$this->drupalGet($url);
|
||||
$this->assertResponse(200, t('Image was generated at the URL.'));
|
||||
$this->assertTrue(file_exists($generated_uri), t('Generated file does exist after we accessed it.'));
|
||||
$this->assertResponse(200, 'Image was generated at the URL.');
|
||||
$this->assertTrue(file_exists($generated_uri), 'Generated file does exist after we accessed it.');
|
||||
$image_info = image_get_info($generated_uri);
|
||||
$this->assertEqual($image_info['width'], 45, t('Expected width was found.'));
|
||||
$this->assertEqual($image_info['height'], 90, t('Expected height was found.'));
|
||||
$this->assertEqual($image_info['width'], 45, 'Expected width was found.');
|
||||
$this->assertEqual($image_info['height'], 90, 'Expected height was found.');
|
||||
|
||||
// Add a random rotate effect.
|
||||
$effect = array(
|
||||
@@ -1244,11 +1255,11 @@ class ImageDimensionsTestCase extends DrupalWebTestCase {
|
||||
|
||||
image_effect_save($effect);
|
||||
$img_tag = theme_image_style($variables);
|
||||
$this->assertEqual($img_tag, '<img typeof="foaf:Image" src="' . check_plain($url) . '" alt="" />', t('Expected img tag was found.'));
|
||||
$this->assertFalse(file_exists($generated_uri), t('Generated file does not exist.'));
|
||||
$this->assertEqual($img_tag, '<img typeof="foaf:Image" src="' . check_plain($url) . '" alt="" />', 'Expected img tag was found.');
|
||||
$this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.');
|
||||
$this->drupalGet($url);
|
||||
$this->assertResponse(200, t('Image was generated at the URL.'));
|
||||
$this->assertTrue(file_exists($generated_uri), t('Generated file does exist after we accessed it.'));
|
||||
$this->assertResponse(200, 'Image was generated at the URL.');
|
||||
$this->assertTrue(file_exists($generated_uri), 'Generated file does exist after we accessed it.');
|
||||
|
||||
|
||||
// Add a crop effect.
|
||||
@@ -1264,14 +1275,14 @@ class ImageDimensionsTestCase extends DrupalWebTestCase {
|
||||
|
||||
image_effect_save($effect);
|
||||
$img_tag = theme_image_style($variables);
|
||||
$this->assertEqual($img_tag, '<img typeof="foaf:Image" src="' . check_plain($url) . '" width="30" height="30" alt="" />', t('Expected img tag was found.'));
|
||||
$this->assertFalse(file_exists($generated_uri), t('Generated file does not exist.'));
|
||||
$this->assertEqual($img_tag, '<img typeof="foaf:Image" src="' . check_plain($url) . '" width="30" height="30" alt="" />', 'Expected img tag was found.');
|
||||
$this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.');
|
||||
$this->drupalGet($url);
|
||||
$this->assertResponse(200, t('Image was generated at the URL.'));
|
||||
$this->assertTrue(file_exists($generated_uri), t('Generated file does exist after we accessed it.'));
|
||||
$this->assertResponse(200, 'Image was generated at the URL.');
|
||||
$this->assertTrue(file_exists($generated_uri), 'Generated file does exist after we accessed it.');
|
||||
$image_info = image_get_info($generated_uri);
|
||||
$this->assertEqual($image_info['width'], 30, t('Expected width was found.'));
|
||||
$this->assertEqual($image_info['height'], 30, t('Expected height was found.'));
|
||||
$this->assertEqual($image_info['width'], 30, 'Expected width was found.');
|
||||
$this->assertEqual($image_info['height'], 30, 'Expected height was found.');
|
||||
|
||||
// Rotate to a non-multiple of 90 degrees.
|
||||
$effect = array(
|
||||
@@ -1285,11 +1296,11 @@ class ImageDimensionsTestCase extends DrupalWebTestCase {
|
||||
|
||||
$effect = image_effect_save($effect);
|
||||
$img_tag = theme_image_style($variables);
|
||||
$this->assertEqual($img_tag, '<img typeof="foaf:Image" src="' . check_plain($url) . '" alt="" />', t('Expected img tag was found.'));
|
||||
$this->assertFalse(file_exists($generated_uri), t('Generated file does not exist.'));
|
||||
$this->assertEqual($img_tag, '<img typeof="foaf:Image" src="' . check_plain($url) . '" alt="" />', 'Expected img tag was found.');
|
||||
$this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.');
|
||||
$this->drupalGet($url);
|
||||
$this->assertResponse(200, t('Image was generated at the URL.'));
|
||||
$this->assertTrue(file_exists($generated_uri), t('Generated file does exist after we accessed it.'));
|
||||
$this->assertResponse(200, 'Image was generated at the URL.');
|
||||
$this->assertTrue(file_exists($generated_uri), 'Generated file does exist after we accessed it.');
|
||||
|
||||
image_effect_delete($effect);
|
||||
|
||||
@@ -1303,7 +1314,7 @@ class ImageDimensionsTestCase extends DrupalWebTestCase {
|
||||
|
||||
image_effect_save($effect);
|
||||
$img_tag = theme_image_style($variables);
|
||||
$this->assertEqual($img_tag, '<img typeof="foaf:Image" src="' . check_plain($url) . '" alt="" />', t('Expected img tag was found.'));
|
||||
$this->assertEqual($img_tag, '<img typeof="foaf:Image" src="' . check_plain($url) . '" alt="" />', 'Expected img tag was found.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1437,13 +1448,13 @@ class ImageDimensionsScaleTestCase extends DrupalUnitTestCase {
|
||||
$return_value = image_dimensions_scale($test['input']['dimensions'], $test['input']['width'], $test['input']['height'], $test['input']['upscale']);
|
||||
|
||||
// Check the width.
|
||||
$this->assertEqual($test['output']['dimensions']['width'], $test['input']['dimensions']['width'], t('Computed width (@computed_width) equals expected width (@expected_width)', array('@computed_width' => $test['output']['dimensions']['width'], '@expected_width' => $test['input']['dimensions']['width'])));
|
||||
$this->assertEqual($test['output']['dimensions']['width'], $test['input']['dimensions']['width'], format_string('Computed width (@computed_width) equals expected width (@expected_width)', array('@computed_width' => $test['output']['dimensions']['width'], '@expected_width' => $test['input']['dimensions']['width'])));
|
||||
|
||||
// Check the height.
|
||||
$this->assertEqual($test['output']['dimensions']['height'], $test['input']['dimensions']['height'], t('Computed height (@computed_height) equals expected height (@expected_height)', array('@computed_height' => $test['output']['dimensions']['height'], '@expected_height' => $test['input']['dimensions']['height'])));
|
||||
$this->assertEqual($test['output']['dimensions']['height'], $test['input']['dimensions']['height'], format_string('Computed height (@computed_height) equals expected height (@expected_height)', array('@computed_height' => $test['output']['dimensions']['height'], '@expected_height' => $test['input']['dimensions']['height'])));
|
||||
|
||||
// Check the return value.
|
||||
$this->assertEqual($test['output']['return_value'], $return_value, t('Correct return value.'));
|
||||
$this->assertEqual($test['output']['return_value'], $return_value, 'Correct return value.');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1704,7 +1715,7 @@ class ImageThemeFunctionWebTestCase extends DrupalWebTestCase {
|
||||
$original_uri = file_unmanaged_copy($file->uri, 'public://', FILE_EXISTS_RENAME);
|
||||
|
||||
// Create a style.
|
||||
image_style_save(array('name' => 'test'));
|
||||
image_style_save(array('name' => 'test', 'label' => 'Test'));
|
||||
$url = image_style_url('test', $original_uri);
|
||||
|
||||
// Test using theme_image_formatter() without an image title, alt text, or
|
||||
@@ -1737,3 +1748,108 @@ class ImageThemeFunctionWebTestCase extends DrupalWebTestCase {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests flushing of image styles.
|
||||
*/
|
||||
class ImageStyleFlushTest extends ImageFieldTestCase {
|
||||
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => 'Image style flushing',
|
||||
'description' => 'Tests flushing of image styles.',
|
||||
'group' => 'Image',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an image style and a wrapper, generate an image.
|
||||
*/
|
||||
function createSampleImage($style, $wrapper) {
|
||||
static $file;
|
||||
|
||||
if (!isset($file)) {
|
||||
$files = $this->drupalGetTestFiles('image');
|
||||
$file = reset($files);
|
||||
}
|
||||
|
||||
// Make sure we have an image in our wrapper testing file directory.
|
||||
$source_uri = file_unmanaged_copy($file->uri, $wrapper . '://');
|
||||
// Build the derivative image.
|
||||
$derivative_uri = image_style_path($style['name'], $source_uri);
|
||||
$derivative = image_style_create_derivative($style, $source_uri, $derivative_uri);
|
||||
|
||||
return $derivative ? $derivative_uri : FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Count the number of images currently created for a style in a wrapper.
|
||||
*/
|
||||
function getImageCount($style, $wrapper) {
|
||||
return count(file_scan_directory($wrapper . '://styles/' . $style['name'], '/.*/'));
|
||||
}
|
||||
|
||||
/**
|
||||
* General test to flush a style.
|
||||
*/
|
||||
function testFlush() {
|
||||
|
||||
// Setup a style to be created and effects to add to it.
|
||||
$style_name = strtolower($this->randomName(10));
|
||||
$style_label = $this->randomString();
|
||||
$style_path = 'admin/config/media/image-styles/edit/' . $style_name;
|
||||
$effect_edits = array(
|
||||
'image_resize' => array(
|
||||
'data[width]' => 100,
|
||||
'data[height]' => 101,
|
||||
),
|
||||
'image_scale' => array(
|
||||
'data[width]' => 110,
|
||||
'data[height]' => 111,
|
||||
'data[upscale]' => 1,
|
||||
),
|
||||
);
|
||||
|
||||
// Add style form.
|
||||
$edit = array(
|
||||
'name' => $style_name,
|
||||
'label' => $style_label,
|
||||
);
|
||||
$this->drupalPost('admin/config/media/image-styles/add', $edit, t('Create new style'));
|
||||
// Add each sample effect to the style.
|
||||
foreach ($effect_edits as $effect => $edit) {
|
||||
// Add the effect.
|
||||
$this->drupalPost($style_path, array('new' => $effect), t('Add'));
|
||||
if (!empty($edit)) {
|
||||
$this->drupalPost(NULL, $edit, t('Add effect'));
|
||||
}
|
||||
}
|
||||
|
||||
// Load the saved image style.
|
||||
$style = image_style_load($style_name);
|
||||
|
||||
// Create an image for the 'public' wrapper.
|
||||
$image_path = $this->createSampleImage($style, 'public');
|
||||
// Expecting to find 2 images, one is the sample.png image shown in
|
||||
// image style preview.
|
||||
$this->assertEqual($this->getImageCount($style, 'public'), 2, format_string('Image style %style image %file successfully generated.', array('%style' => $style['name'], '%file' => $image_path)));
|
||||
|
||||
// Create an image for the 'private' wrapper.
|
||||
$image_path = $this->createSampleImage($style, 'private');
|
||||
$this->assertEqual($this->getImageCount($style, 'private'), 1, format_string('Image style %style image %file successfully generated.', array('%style' => $style['name'], '%file' => $image_path)));
|
||||
|
||||
// Remove the 'image_scale' effect and updates the style, which in turn
|
||||
// forces an image style flush.
|
||||
$effect = array_pop($style['effects']);
|
||||
$this->drupalPost($style_path . '/effects/' . $effect['ieid'] . '/delete', array(), t('Delete'));
|
||||
$this->assertResponse(200);
|
||||
$this->drupalPost($style_path, array(), t('Update style'));
|
||||
$this->assertResponse(200);
|
||||
|
||||
// Post flush, expected 1 image in the 'public' wrapper (sample.png).
|
||||
$this->assertEqual($this->getImageCount($style, 'public'), 1, format_string('Image style %style flushed correctly for %wrapper wrapper.', array('%style' => $style['name'], '%wrapper' => 'public')));
|
||||
|
||||
// Post flush, expected no image in the 'private' wrapper.
|
||||
$this->assertEqual($this->getImageCount($style, 'private'), 0, format_string('Image style %style flushed correctly for %wrapper wrapper.', array('%style' => $style['name'], '%wrapper' => 'private')));
|
||||
}
|
||||
}
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
files[] = image_module_test.module
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
files[] = locale.test
|
||||
configure = admin/config/regional/language
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -972,7 +972,7 @@ function locale_css_alter(&$css) {
|
||||
// Replicate the same item, but with the RTL path and a little larger
|
||||
// weight so that it appears directly after the original CSS file.
|
||||
$item['data'] = $rtl_path;
|
||||
$item['weight'] += 0.01;
|
||||
$item['weight'] += 0.0001;
|
||||
$css[$rtl_path] = $item;
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -5,8 +5,8 @@ package = Testing
|
||||
version = VERSION
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
files[] = menu.test
|
||||
configure = admin/structure/menu
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -70,7 +70,7 @@ class MenuTestCase extends DrupalWebTestCase {
|
||||
$item['options']['attributes']['title'] = $description;
|
||||
menu_link_save($item);
|
||||
$saved_item = menu_link_load($item['mlid']);
|
||||
$this->assertEqual($description, $saved_item['options']['attributes']['title'], t('Saving an existing link updates the description (title attribute)'));
|
||||
$this->assertEqual($description, $saved_item['options']['attributes']['title'], 'Saving an existing link updates the description (title attribute)');
|
||||
$this->resetMenuLink($item, $old_title);
|
||||
}
|
||||
|
||||
@@ -111,14 +111,14 @@ class MenuTestCase extends DrupalWebTestCase {
|
||||
|
||||
// Assert the new menu.
|
||||
$this->drupalGet('admin/structure/menu/manage/' . $menu_name . '/edit');
|
||||
$this->assertRaw($title, t('Custom menu was added.'));
|
||||
$this->assertRaw($title, 'Custom menu was added.');
|
||||
|
||||
// Edit the menu.
|
||||
$new_title = $this->randomName(16);
|
||||
$menu['title'] = $new_title;
|
||||
menu_save($menu);
|
||||
$this->drupalGet('admin/structure/menu/manage/' . $menu_name . '/edit');
|
||||
$this->assertRaw($new_title, t('Custom menu was edited.'));
|
||||
$this->assertRaw($new_title, 'Custom menu was edited.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -167,7 +167,7 @@ class MenuTestCase extends DrupalWebTestCase {
|
||||
$edit['blocks[menu_' . $menu_name . '][region]'] = 'sidebar_first';
|
||||
$this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
|
||||
$this->assertResponse(200);
|
||||
$this->assertText(t('The block settings have been updated.'), t('Custom menu block was enabled'));
|
||||
$this->assertText(t('The block settings have been updated.'), 'Custom menu block was enabled');
|
||||
|
||||
return menu_load($menu_name);
|
||||
}
|
||||
@@ -184,11 +184,11 @@ class MenuTestCase extends DrupalWebTestCase {
|
||||
// Delete custom menu.
|
||||
$this->drupalPost("admin/structure/menu/manage/$menu_name/delete", array(), t('Delete'));
|
||||
$this->assertResponse(200);
|
||||
$this->assertRaw(t('The custom menu %title has been deleted.', array('%title' => $title)), t('Custom menu was deleted'));
|
||||
$this->assertRaw(t('The custom menu %title has been deleted.', array('%title' => $title)), 'Custom menu was deleted');
|
||||
$this->assertFalse(menu_load($menu_name), 'Custom menu was deleted');
|
||||
// Test if all menu links associated to the menu were removed from database.
|
||||
$result = db_query("SELECT menu_name FROM {menu_links} WHERE menu_name = :menu_name", array(':menu_name' => $menu_name))->fetchField();
|
||||
$this->assertFalse($result, t('All menu links associated to the custom menu were deleted.'));
|
||||
$this->assertFalse($result, 'All menu links associated to the custom menu were deleted.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -266,13 +266,13 @@ class MenuTestCase extends DrupalWebTestCase {
|
||||
$item = $this->addMenuLink(0, $path);
|
||||
|
||||
$this->drupalGet('admin/structure/menu/item/' . $item['mlid'] . '/edit');
|
||||
$this->assertFieldByName('link_path', $path, t('Path is found with both query and fragment.'));
|
||||
$this->assertFieldByName('link_path', $path, 'Path is found with both query and fragment.');
|
||||
|
||||
// Now change the path to something without query and fragment.
|
||||
$path = 'node';
|
||||
$this->drupalPost('admin/structure/menu/item/' . $item['mlid'] . '/edit', array('link_path' => $path), t('Save'));
|
||||
$this->drupalGet('admin/structure/menu/item/' . $item['mlid'] . '/edit');
|
||||
$this->assertFieldByName('link_path', $path, t('Path no longer has query or fragment.'));
|
||||
$this->assertFieldByName('link_path', $path, 'Path no longer has query or fragment.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -350,7 +350,7 @@ class MenuTestCase extends DrupalWebTestCase {
|
||||
// Verify menu link link.
|
||||
$this->clickLink($title);
|
||||
$title = $parent_node->title;
|
||||
$this->assertTitle(t("@title | Drupal", array('@title' => $title)), t('Parent menu link link target was correct'));
|
||||
$this->assertTitle(t("@title | Drupal", array('@title' => $title)), 'Parent menu link link target was correct');
|
||||
}
|
||||
|
||||
// Verify menu link.
|
||||
@@ -360,7 +360,7 @@ class MenuTestCase extends DrupalWebTestCase {
|
||||
// Verify menu link link.
|
||||
$this->clickLink($title);
|
||||
$title = $item_node->title;
|
||||
$this->assertTitle(t("@title | Drupal", array('@title' => $title)), t('Menu link link target was correct'));
|
||||
$this->assertTitle(t("@title | Drupal", array('@title' => $title)), 'Menu link link target was correct');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -412,7 +412,7 @@ class MenuTestCase extends DrupalWebTestCase {
|
||||
// Reset menu link.
|
||||
$this->drupalPost("admin/structure/menu/item/$mlid/reset", array(), t('Reset'));
|
||||
$this->assertResponse(200);
|
||||
$this->assertRaw(t('The menu link was reset to its default settings.'), t('Menu link was reset'));
|
||||
$this->assertRaw(t('The menu link was reset to its default settings.'), 'Menu link was reset');
|
||||
|
||||
// Verify menu link.
|
||||
$this->drupalGet('');
|
||||
@@ -432,7 +432,7 @@ class MenuTestCase extends DrupalWebTestCase {
|
||||
// Delete menu link.
|
||||
$this->drupalPost("admin/structure/menu/item/$mlid/delete", array(), t('Confirm'));
|
||||
$this->assertResponse(200);
|
||||
$this->assertRaw(t('The menu link %title has been deleted.', array('%title' => $title)), t('Menu link was deleted'));
|
||||
$this->assertRaw(t('The menu link %title has been deleted.', array('%title' => $title)), 'Menu link was deleted');
|
||||
|
||||
// Verify deletion.
|
||||
$this->drupalGet('');
|
||||
@@ -509,7 +509,7 @@ class MenuTestCase extends DrupalWebTestCase {
|
||||
$item['link_path'] .= '#' . $options['fragment'];
|
||||
}
|
||||
foreach ($expected_item as $key => $value) {
|
||||
$this->assertEqual($item[$key], $value, t('Parameter %key had expected value.', array('%key' => $key)));
|
||||
$this->assertEqual($item[$key], $value, format_string('Parameter %key had expected value.', array('%key' => $key)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -537,21 +537,21 @@ class MenuTestCase extends DrupalWebTestCase {
|
||||
$this->drupalGet('admin/help/menu');
|
||||
$this->assertResponse($response);
|
||||
if ($response == 200) {
|
||||
$this->assertText(t('Menu'), t('Menu help was displayed'));
|
||||
$this->assertText(t('Menu'), 'Menu help was displayed');
|
||||
}
|
||||
|
||||
// View menu build overview node.
|
||||
$this->drupalGet('admin/structure/menu');
|
||||
$this->assertResponse($response);
|
||||
if ($response == 200) {
|
||||
$this->assertText(t('Menus'), t('Menu build overview node was displayed'));
|
||||
$this->assertText(t('Menus'), 'Menu build overview node was displayed');
|
||||
}
|
||||
|
||||
// View navigation menu customization node.
|
||||
$this->drupalGet('admin/structure/menu/manage/navigation');
|
||||
$this->assertResponse($response);
|
||||
if ($response == 200) {
|
||||
$this->assertText(t('Navigation'), t('Navigation menu node was displayed'));
|
||||
$this->assertText(t('Navigation'), 'Navigation menu node was displayed');
|
||||
}
|
||||
|
||||
// View menu edit node.
|
||||
@@ -559,21 +559,21 @@ class MenuTestCase extends DrupalWebTestCase {
|
||||
$this->drupalGet('admin/structure/menu/item/' . $item['mlid'] . '/edit');
|
||||
$this->assertResponse($response);
|
||||
if ($response == 200) {
|
||||
$this->assertText(t('Edit menu item'), t('Menu edit node was displayed'));
|
||||
$this->assertText(t('Edit menu item'), 'Menu edit node was displayed');
|
||||
}
|
||||
|
||||
// View menu settings node.
|
||||
$this->drupalGet('admin/structure/menu/settings');
|
||||
$this->assertResponse($response);
|
||||
if ($response == 200) {
|
||||
$this->assertText(t('Menus'), t('Menu settings node was displayed'));
|
||||
$this->assertText(t('Menus'), 'Menu settings node was displayed');
|
||||
}
|
||||
|
||||
// View add menu node.
|
||||
$this->drupalGet('admin/structure/menu/add');
|
||||
$this->assertResponse($response);
|
||||
if ($response == 200) {
|
||||
$this->assertText(t('Menus'), t('Add menu node was displayed'));
|
||||
$this->assertText(t('Menus'), 'Add menu node was displayed');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -654,7 +654,7 @@ class MenuNodeTestCase extends DrupalWebTestCase {
|
||||
$this->assertLink($node_title);
|
||||
|
||||
$this->drupalGet('node/' . $node->nid . '/edit');
|
||||
$this->assertOptionSelected('edit-menu-weight', 17, t('Menu weight correct in edit form'));
|
||||
$this->assertOptionSelected('edit-menu-weight', 17, 'Menu weight correct in edit form');
|
||||
|
||||
// Edit the node and remove the menu link.
|
||||
$edit = array(
|
||||
@@ -675,11 +675,11 @@ class MenuNodeTestCase extends DrupalWebTestCase {
|
||||
|
||||
// Assert that disabled Management menu is not shown on the node/$nid/edit page.
|
||||
$this->drupalGet('node/' . $node->nid . '/edit');
|
||||
$this->assertText('Provide a menu link', t('Link in not allowed menu not shown in node edit form'));
|
||||
$this->assertText('Provide a menu link', 'Link in not allowed menu not shown in node edit form');
|
||||
// Assert that the link is still in the management menu after save.
|
||||
$this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
|
||||
$link = menu_link_load($item['mlid']);
|
||||
$this->assertTrue($link, t('Link in not allowed menu still exists after saving node'));
|
||||
$this->assertTrue($link, 'Link in not allowed menu still exists after saving node');
|
||||
|
||||
// Move the menu link back to the Navigation menu.
|
||||
$item['menu_name'] = 'navigation';
|
||||
|
@@ -9,8 +9,8 @@ required = TRUE
|
||||
configure = admin/structure/types
|
||||
stylesheets[all][] = node.css
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -244,13 +244,7 @@ function node_field_display_node_alter(&$display, $context) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Entity URI callback.
|
||||
*
|
||||
* @param $node
|
||||
* A node entity.
|
||||
*
|
||||
* @return array
|
||||
* An array with 'path' as the key and the path to the node as its value.
|
||||
* Implements callback_entity_info_uri().
|
||||
*/
|
||||
function node_uri($node) {
|
||||
return array(
|
||||
@@ -1593,6 +1587,9 @@ function node_permission() {
|
||||
),
|
||||
'access content overview' => array(
|
||||
'title' => t('Access the content overview page'),
|
||||
'description' => user_access('access content overview')
|
||||
? t('Get an overview of <a href="@url">all content</a>.', array('@url' => url('admin/content')))
|
||||
: t('Get an overview of all content.'),
|
||||
),
|
||||
'access content' => array(
|
||||
'title' => t('View published content'),
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ package = Core
|
||||
core = 7.x
|
||||
files[] = openid.test
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
dependencies[] = openid
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -4,8 +4,8 @@ package = Core
|
||||
version = VERSION
|
||||
core = 7.x
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
files[] = path.test
|
||||
configure = admin/config/search/path
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -42,12 +42,12 @@ class PathTestCase extends DrupalWebTestCase {
|
||||
// created.
|
||||
cache_clear_all('*', 'cache_path', TRUE);
|
||||
$this->drupalGet($edit['source']);
|
||||
$this->assertTrue(cache_get($edit['source'], 'cache_path'), t('Cache entry was created.'));
|
||||
$this->assertTrue(cache_get($edit['source'], 'cache_path'), 'Cache entry was created.');
|
||||
|
||||
// Visit the alias for the node and confirm a cache entry is created.
|
||||
cache_clear_all('*', 'cache_path', TRUE);
|
||||
$this->drupalGet($edit['alias']);
|
||||
$this->assertTrue(cache_get($edit['source'], 'cache_path'), t('Cache entry was created.'));
|
||||
$this->assertTrue(cache_get($edit['source'], 'cache_path'), 'Cache entry was created.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -334,7 +334,7 @@ class PathLanguageTestCase extends DrupalWebTestCase {
|
||||
drupal_static_reset('locale_url_outbound_alter');
|
||||
$languages = language_list();
|
||||
$url = url('node/' . $french_node->nid, array('language' => $languages[$french_node->language]));
|
||||
$this->assertTrue(strpos($url, $edit['path[alias]']), t('URL contains the path alias.'));
|
||||
$this->assertTrue(strpos($url, $edit['path[alias]']), 'URL contains the path alias.');
|
||||
|
||||
// Confirm that the alias works even when changing language negotiation
|
||||
// options. Enable User language detection and selection over URL one.
|
||||
@@ -378,23 +378,23 @@ class PathLanguageTestCase extends DrupalWebTestCase {
|
||||
// situation only aliases in the default language and language neutral ones
|
||||
// should keep working.
|
||||
$this->drupalGet($french_alias);
|
||||
$this->assertResponse(404, t('Alias for French translation is unavailable when URL language negotiation is disabled.'));
|
||||
$this->assertResponse(404, 'Alias for French translation is unavailable when URL language negotiation is disabled.');
|
||||
|
||||
// drupal_lookup_path() has an internal static cache. Check to see that
|
||||
// it has the appropriate contents at this point.
|
||||
drupal_lookup_path('wipe');
|
||||
$french_node_path = drupal_lookup_path('source', $french_alias, $french_node->language);
|
||||
$this->assertEqual($french_node_path, 'node/' . $french_node->nid, t('Normal path works.'));
|
||||
$this->assertEqual($french_node_path, 'node/' . $french_node->nid, 'Normal path works.');
|
||||
// Second call should return the same path.
|
||||
$french_node_path = drupal_lookup_path('source', $french_alias, $french_node->language);
|
||||
$this->assertEqual($french_node_path, 'node/' . $french_node->nid, t('Normal path is the same.'));
|
||||
$this->assertEqual($french_node_path, 'node/' . $french_node->nid, 'Normal path is the same.');
|
||||
|
||||
// Confirm that the alias works.
|
||||
$french_node_alias = drupal_lookup_path('alias', 'node/' . $french_node->nid, $french_node->language);
|
||||
$this->assertEqual($french_node_alias, $french_alias, t('Alias works.'));
|
||||
$this->assertEqual($french_node_alias, $french_alias, 'Alias works.');
|
||||
// Second call should return the same alias.
|
||||
$french_node_alias = drupal_lookup_path('alias', 'node/' . $french_node->nid, $french_node->language);
|
||||
$this->assertEqual($french_node_alias, $french_alias, t('Alias is the same.'));
|
||||
$this->assertEqual($french_node_alias, $french_alias, 'Alias is the same.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -508,8 +508,8 @@ class PathMonolingualTestCase extends DrupalWebTestCase {
|
||||
$this->drupalPost('admin/config/regional/language', $edit, t('Save configuration'));
|
||||
|
||||
// Verify that French is the only language.
|
||||
$this->assertFalse(drupal_multilingual(), t('Site is mono-lingual'));
|
||||
$this->assertEqual(language_default('language'), 'fr', t('French is the default language'));
|
||||
$this->assertFalse(drupal_multilingual(), 'Site is mono-lingual');
|
||||
$this->assertEqual(language_default('language'), 'fr', 'French is the default language');
|
||||
|
||||
// Set language detection to URL.
|
||||
$edit = array('language[enabled][locale-url]' => TRUE);
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
files[] = php.test
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -47,7 +47,7 @@ function php_permission() {
|
||||
* overwrite any variables in the calling code, unlike a regular eval() call.
|
||||
*
|
||||
* This function is also used as an implementation of
|
||||
* hook_filter_FILTER_process().
|
||||
* callback_filter_process().
|
||||
*
|
||||
* @param $code
|
||||
* The code to evaluate.
|
||||
@@ -88,7 +88,7 @@ function php_eval($code) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_filter_FILTER_tips().
|
||||
* Implements callback_filter_tips().
|
||||
*
|
||||
* @see php_filter_info()
|
||||
*/
|
||||
|
@@ -21,20 +21,20 @@ class PHPTestCase extends DrupalWebTestCase {
|
||||
// Verify that the PHP code text format was inserted.
|
||||
$php_format_id = 'php_code';
|
||||
$this->php_code_format = filter_format_load($php_format_id);
|
||||
$this->assertEqual($this->php_code_format->name, 'PHP code', t('PHP code text format was created.'));
|
||||
$this->assertEqual($this->php_code_format->name, 'PHP code', 'PHP code text format was created.');
|
||||
|
||||
// Verify that the format has the PHP code filter enabled.
|
||||
$filters = filter_list_format($php_format_id);
|
||||
$this->assertTrue($filters['php_code']->status, t('PHP code filter is enabled.'));
|
||||
$this->assertTrue($filters['php_code']->status, 'PHP code filter is enabled.');
|
||||
|
||||
// Verify that the format exists on the administration page.
|
||||
$this->drupalGet('admin/config/content/formats');
|
||||
$this->assertText('PHP code', t('PHP code text format was created.'));
|
||||
$this->assertText('PHP code', 'PHP code text format was created.');
|
||||
|
||||
// Verify that anonymous and authenticated user roles do not have access.
|
||||
$this->drupalGet('admin/config/content/formats/' . $php_format_id);
|
||||
$this->assertFieldByName('roles[' . DRUPAL_ANONYMOUS_RID . ']', FALSE, t('Anonymous users do not have access to PHP code format.'));
|
||||
$this->assertFieldByName('roles[' . DRUPAL_AUTHENTICATED_RID . ']', FALSE, t('Authenticated users do not have access to PHP code format.'));
|
||||
$this->assertFieldByName('roles[' . DRUPAL_ANONYMOUS_RID . ']', FALSE, 'Anonymous users do not have access to PHP code format.');
|
||||
$this->assertFieldByName('roles[' . DRUPAL_AUTHENTICATED_RID . ']', FALSE, 'Authenticated users do not have access to PHP code format.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,18 +73,18 @@ class PHPFilterTestCase extends PHPTestCase {
|
||||
|
||||
// Make sure that the PHP code shows up as text.
|
||||
$this->drupalGet('node/' . $node->nid);
|
||||
$this->assertText('print "SimpleTest PHP was executed!"', t('PHP code is displayed.'));
|
||||
$this->assertText('print "SimpleTest PHP was executed!"', 'PHP code is displayed.');
|
||||
|
||||
// Change filter to PHP filter and see that PHP code is evaluated.
|
||||
$edit = array();
|
||||
$langcode = LANGUAGE_NONE;
|
||||
$edit["body[$langcode][0][format]"] = $this->php_code_format->format;
|
||||
$this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
|
||||
$this->assertRaw(t('Basic page %title has been updated.', array('%title' => $node->title)), t('PHP code filter turned on.'));
|
||||
$this->assertRaw(t('Basic page %title has been updated.', array('%title' => $node->title)), 'PHP code filter turned on.');
|
||||
|
||||
// Make sure that the PHP code shows up as text.
|
||||
$this->assertNoText('print "SimpleTest PHP was executed!"', t("PHP code isn't displayed."));
|
||||
$this->assertText('SimpleTest PHP was executed!', t('PHP code has been evaluated.'));
|
||||
$this->assertNoText('print "SimpleTest PHP was executed!"', "PHP code isn't displayed.");
|
||||
$this->assertText('SimpleTest PHP was executed!', 'PHP code has been evaluated.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,10 +111,10 @@ class PHPAccessTestCase extends PHPTestCase {
|
||||
|
||||
// Make sure that the PHP code shows up as text.
|
||||
$this->drupalGet('node/' . $node->nid);
|
||||
$this->assertText('print', t('PHP code was not evaluated.'));
|
||||
$this->assertText('print', 'PHP code was not evaluated.');
|
||||
|
||||
// Make sure that user doesn't have access to filter.
|
||||
$this->drupalGet('node/' . $node->nid . '/edit');
|
||||
$this->assertNoRaw('<option value="' . $this->php_code_format->format . '">', t('PHP code format not available.'));
|
||||
$this->assertNoRaw('<option value="' . $this->php_code_format->format . '">', 'PHP code format not available.');
|
||||
}
|
||||
}
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
files[] = poll.test
|
||||
stylesheets[all][] = poll.css
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -11,8 +11,8 @@ configure = admin/config/people/profile
|
||||
; See user_system_info_alter().
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
files[] = rdf.test
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -30,15 +30,11 @@
|
||||
*
|
||||
* @return
|
||||
* Array with optional keys:
|
||||
* - 'title': Title for the tab on the search page for this module. Defaults
|
||||
* - title: Title for the tab on the search page for this module. Defaults
|
||||
* to the module name if not given.
|
||||
* - 'path': Path component after 'search/' for searching with this module.
|
||||
* - path: Path component after 'search/' for searching with this module.
|
||||
* Defaults to the module name if not given.
|
||||
* - 'conditions_callback': Name of a callback function that is invoked by
|
||||
* search_view() to get an array of additional search conditions to pass to
|
||||
* search_data(). For example, a search module may get additional keywords,
|
||||
* filters, or modifiers for the search from the query string. Sample
|
||||
* callback function: sample_search_conditions_callback().
|
||||
* - conditions_callback: An implementation of callback_search_conditions().
|
||||
*
|
||||
* @ingroup search
|
||||
*/
|
||||
@@ -46,35 +42,10 @@ function hook_search_info() {
|
||||
return array(
|
||||
'title' => 'Content',
|
||||
'path' => 'node',
|
||||
'conditions_callback' => 'sample_search_conditions_callback',
|
||||
'conditions_callback' => 'callback_search_conditions',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* An example conditions callback function for search.
|
||||
*
|
||||
* This example pulls additional search keywords out of the $_REQUEST variable,
|
||||
* (i.e. from the query string of the request). The conditions may also be
|
||||
* generated internally - for example based on a module's settings.
|
||||
*
|
||||
* @see hook_search_info()
|
||||
* @ingroup search
|
||||
*/
|
||||
function sample_search_conditions_callback($keys) {
|
||||
$conditions = array();
|
||||
|
||||
if (!empty($_REQUEST['keys'])) {
|
||||
$conditions['keys'] = $_REQUEST['keys'];
|
||||
}
|
||||
if (!empty($_REQUEST['sample_search_keys'])) {
|
||||
$conditions['sample_search_keys'] = $_REQUEST['sample_search_keys'];
|
||||
}
|
||||
if ($force_keys = variable_get('sample_search_force_keywords', '')) {
|
||||
$conditions['sample_search_force_keywords'] = $force_keys;
|
||||
}
|
||||
return $conditions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Define access to a custom search routine.
|
||||
*
|
||||
@@ -252,22 +223,23 @@ function hook_search_execute($keys = NULL, $conditions = NULL) {
|
||||
/**
|
||||
* Override the rendering of search results.
|
||||
*
|
||||
* A module that implements hook_search_info() to define a type of search
|
||||
* may implement this hook in order to override the default theming of
|
||||
* its search results, which is otherwise themed using theme('search_results').
|
||||
* A module that implements hook_search_info() to define a type of search may
|
||||
* implement this hook in order to override the default theming of its search
|
||||
* results, which is otherwise themed using theme('search_results').
|
||||
*
|
||||
* Note that by default, theme('search_results') and theme('search_result')
|
||||
* work together to create an ordered list (OL). So your hook_search_page()
|
||||
* implementation should probably do this as well.
|
||||
*
|
||||
* @see search-result.tpl.php, search-results.tpl.php
|
||||
*
|
||||
* @param $results
|
||||
* An array of search results.
|
||||
*
|
||||
* @return
|
||||
* A renderable array, which will render the formatted search results with
|
||||
* a pager included.
|
||||
* A renderable array, which will render the formatted search results with a
|
||||
* pager included.
|
||||
*
|
||||
* @see search-result.tpl.php
|
||||
* @see search-results.tpl.php
|
||||
*/
|
||||
function hook_search_page($results) {
|
||||
$output['prefix']['#markup'] = '<ol class="search-results">';
|
||||
@@ -364,3 +336,41 @@ function hook_update_index() {
|
||||
/**
|
||||
* @} End of "addtogroup hooks".
|
||||
*/
|
||||
|
||||
/**
|
||||
* Provide search query conditions.
|
||||
*
|
||||
* Callback for hook_search_info().
|
||||
*
|
||||
* This callback is invoked by search_view() to get an array of additional
|
||||
* search conditions to pass to search_data(). For example, a search module
|
||||
* may get additional keywords, filters, or modifiers for the search from
|
||||
* the query string.
|
||||
*
|
||||
* This example pulls additional search keywords out of the $_REQUEST variable,
|
||||
* (i.e. from the query string of the request). The conditions may also be
|
||||
* generated internally - for example based on a module's settings.
|
||||
*
|
||||
* @param $keys
|
||||
* The search keywords string.
|
||||
*
|
||||
* @return
|
||||
* An array of additional conditions, such as filters.
|
||||
*
|
||||
* @ingroup callbacks
|
||||
* @ingroup search
|
||||
*/
|
||||
function callback_search_conditions($keys) {
|
||||
$conditions = array();
|
||||
|
||||
if (!empty($_REQUEST['keys'])) {
|
||||
$conditions['keys'] = $_REQUEST['keys'];
|
||||
}
|
||||
if (!empty($_REQUEST['sample_search_keys'])) {
|
||||
$conditions['sample_search_keys'] = $_REQUEST['sample_search_keys'];
|
||||
}
|
||||
if ($force_keys = config('sample_search.settings')->get('force_keywords')) {
|
||||
$conditions['sample_search_force_keywords'] = $force_keys;
|
||||
}
|
||||
return $conditions;
|
||||
}
|
||||
|
@@ -8,8 +8,8 @@ files[] = search.test
|
||||
configure = admin/config/search/settings
|
||||
stylesheets[all][] = search.css
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -1067,7 +1067,7 @@ function template_preprocess_search_block_form(&$variables) {
|
||||
$hidden = array();
|
||||
// Provide variables named after form keys so themers can print each element independently.
|
||||
foreach (element_children($variables['form']) as $key) {
|
||||
$type = $variables['form'][$key]['#type'];
|
||||
$type = isset($variables['form'][$key]['#type']) ? $variables['form'][$key]['#type'] : '';
|
||||
if ($type == 'hidden' || $type == 'token') {
|
||||
$hidden[] = drupal_render($variables['form'][$key]);
|
||||
}
|
||||
|
@@ -275,7 +275,7 @@ class SearchPageText extends DrupalWebTestCase {
|
||||
$edit = array();
|
||||
$edit['keys'] = 'bike shed ' . $this->randomName();
|
||||
$this->drupalPost('search/node', $edit, t('Search'));
|
||||
$this->assertText(t('Consider loosening your query with OR. bike OR shed will often show more results than bike shed.'), t('Help text is displayed when search returns no results.'));
|
||||
$this->assertText(t('Consider loosening your query with OR. bike OR shed will often show more results than bike shed.'), 'Help text is displayed when search returns no results.');
|
||||
$this->assertText(t('Search'));
|
||||
$this->assertTitle($title, 'Search page title is correct');
|
||||
|
||||
@@ -342,31 +342,31 @@ class SearchAdvancedSearchForm extends DrupalWebTestCase {
|
||||
* Test using the advanced search form to limit search to nodes of type "Basic page".
|
||||
*/
|
||||
function testNodeType() {
|
||||
$this->assertTrue($this->node->type == 'page', t('Node type is Basic page.'));
|
||||
$this->assertTrue($this->node->type == 'page', 'Node type is Basic page.');
|
||||
|
||||
// Assert that the dummy title doesn't equal the real title.
|
||||
$dummy_title = 'Lorem ipsum';
|
||||
$this->assertNotEqual($dummy_title, $this->node->title, t("Dummy title doesn't equal node title"));
|
||||
$this->assertNotEqual($dummy_title, $this->node->title, "Dummy title doesn't equal node title");
|
||||
|
||||
// Search for the dummy title with a GET query.
|
||||
$this->drupalGet('search/node/' . $dummy_title);
|
||||
$this->assertNoText($this->node->title, t('Basic page node is not found with dummy title.'));
|
||||
$this->assertNoText($this->node->title, 'Basic page node is not found with dummy title.');
|
||||
|
||||
// Search for the title of the node with a GET query.
|
||||
$this->drupalGet('search/node/' . $this->node->title);
|
||||
$this->assertText($this->node->title, t('Basic page node is found with GET query.'));
|
||||
$this->assertText($this->node->title, 'Basic page node is found with GET query.');
|
||||
|
||||
// Search for the title of the node with a POST query.
|
||||
$edit = array('or' => $this->node->title);
|
||||
$this->drupalPost('search/node', $edit, t('Advanced search'));
|
||||
$this->assertText($this->node->title, t('Basic page node is found with POST query.'));
|
||||
$this->assertText($this->node->title, 'Basic page node is found with POST query.');
|
||||
|
||||
// Advanced search type option.
|
||||
$this->drupalPost('search/node', array_merge($edit, array('type[page]' => 'page')), t('Advanced search'));
|
||||
$this->assertText($this->node->title, t('Basic page node is found with POST query and type:page.'));
|
||||
$this->assertText($this->node->title, 'Basic page node is found with POST query and type:page.');
|
||||
|
||||
$this->drupalPost('search/node', array_merge($edit, array('type[article]' => 'article')), t('Advanced search'));
|
||||
$this->assertText('bike shed', t('Article node is not found with POST query and type:article.'));
|
||||
$this->assertText('bike shed', 'Article node is not found with POST query and type:article.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -464,7 +464,7 @@ class SearchRankingTestCase extends DrupalWebTestCase {
|
||||
function testHTMLRankings() {
|
||||
// Login with sufficient privileges.
|
||||
$this->drupalLogin($this->drupalCreateUser(array('create page content')));
|
||||
|
||||
|
||||
// Test HTML tags with different weights.
|
||||
$sorted_tags = array('h1', 'h2', 'h3', 'h4', 'a', 'h5', 'h6', 'notag');
|
||||
$shuffled_tags = $sorted_tags;
|
||||
@@ -496,7 +496,7 @@ class SearchRankingTestCase extends DrupalWebTestCase {
|
||||
|
||||
// Refresh variables after the treatment.
|
||||
$this->refreshVariables();
|
||||
|
||||
|
||||
// Disable all other rankings.
|
||||
$node_ranks = array('sticky', 'promote', 'recent', 'comments', 'views');
|
||||
foreach ($node_ranks as $node_rank) {
|
||||
@@ -534,7 +534,7 @@ class SearchRankingTestCase extends DrupalWebTestCase {
|
||||
|
||||
// Assert the results.
|
||||
$this->assertEqual($set[0]['node']->nid, $node->nid, 'Search tag ranking for "<' . $tag . '>" order.');
|
||||
|
||||
|
||||
// Delete node so it doesn't show up in subsequent search results.
|
||||
node_delete($node->nid);
|
||||
}
|
||||
@@ -600,13 +600,13 @@ class SearchBlockTestCase extends DrupalWebTestCase {
|
||||
function testSearchFormBlock() {
|
||||
// Set block title to confirm that the interface is available.
|
||||
$this->drupalPost('admin/structure/block/manage/search/form/configure', array('title' => $this->randomName(8)), t('Save block'));
|
||||
$this->assertText(t('The block configuration has been saved.'), t('Block configuration set.'));
|
||||
$this->assertText(t('The block configuration has been saved.'), 'Block configuration set.');
|
||||
|
||||
// Set the block to a region to confirm block is available.
|
||||
$edit = array();
|
||||
$edit['blocks[search_form][region]'] = 'footer';
|
||||
$this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
|
||||
$this->assertText(t('The block settings have been updated.'), t('Block successfully move to footer region.'));
|
||||
$this->assertText(t('The block settings have been updated.'), 'Block successfully move to footer region.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -640,7 +640,7 @@ class SearchBlockTestCase extends DrupalWebTestCase {
|
||||
$this->assertEqual(
|
||||
$this->getUrl(),
|
||||
url('search/node/' . $terms['search_block_form'], array('absolute' => TRUE)),
|
||||
t('Redirected to correct url.')
|
||||
'Redirected to correct url.'
|
||||
);
|
||||
|
||||
// Test an empty search via the block form, from the front page.
|
||||
@@ -652,7 +652,7 @@ class SearchBlockTestCase extends DrupalWebTestCase {
|
||||
$this->assertEqual(
|
||||
$this->getUrl(),
|
||||
url('search/node/', array('absolute' => TRUE)),
|
||||
t('Redirected to correct url.')
|
||||
'Redirected to correct url.'
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -790,20 +790,20 @@ class SearchCommentTestCase extends DrupalWebTestCase {
|
||||
'search_block_form' => "'" . $edit_comment['subject'] . "'",
|
||||
);
|
||||
$this->drupalPost('', $edit, t('Search'));
|
||||
$this->assertText($node->title, t('Node found in search results.'));
|
||||
$this->assertText($edit_comment['subject'], t('Comment subject found in search results.'));
|
||||
$this->assertText($node->title, 'Node found in search results.');
|
||||
$this->assertText($edit_comment['subject'], 'Comment subject found in search results.');
|
||||
|
||||
// Search for the comment body.
|
||||
$edit = array(
|
||||
'search_block_form' => "'" . $comment_body . "'",
|
||||
);
|
||||
$this->drupalPost('', $edit, t('Search'));
|
||||
$this->assertText($node->title, t('Node found in search results.'));
|
||||
$this->assertText($node->title, 'Node found in search results.');
|
||||
|
||||
// Verify that comment is rendered using proper format.
|
||||
$this->assertText($comment_body, t('Comment body text found in search results.'));
|
||||
$this->assertNoRaw(t('n/a'), t('HTML in comment body is not hidden.'));
|
||||
$this->assertNoRaw(check_plain($edit_comment['comment_body[' . LANGUAGE_NONE . '][0][value]']), t('HTML in comment body is not escaped.'));
|
||||
$this->assertText($comment_body, 'Comment body text found in search results.');
|
||||
$this->assertNoRaw(t('n/a'), 'HTML in comment body is not hidden.');
|
||||
$this->assertNoRaw(check_plain($edit_comment['comment_body[' . LANGUAGE_NONE . '][0][value]']), 'HTML in comment body is not escaped.');
|
||||
|
||||
// Hide comments.
|
||||
$this->drupalLogin($this->admin_user);
|
||||
@@ -816,7 +816,7 @@ class SearchCommentTestCase extends DrupalWebTestCase {
|
||||
|
||||
// Search for $title.
|
||||
$this->drupalPost('', $edit, t('Search'));
|
||||
$this->assertNoText($comment_body, t('Comment body text not found in search results.'));
|
||||
$this->assertNoText($comment_body, 'Comment body text not found in search results.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -875,7 +875,7 @@ class SearchCommentTestCase extends DrupalWebTestCase {
|
||||
$this->setRolePermissions(DRUPAL_AUTHENTICATED_RID, TRUE, TRUE);
|
||||
$this->setRolePermissions($this->admin_role, TRUE, FALSE);
|
||||
$this->checkCommentAccess('Admin user has access comments permission and no search permission, but comments should be indexed because admin user inherits authenticated user\'s permission to search', TRUE);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -926,7 +926,7 @@ class SearchCommentTestCase extends DrupalWebTestCase {
|
||||
// Verify that if you view the node on its own page, 'add new comment'
|
||||
// is there.
|
||||
$this->drupalGet('node/' . $node->nid);
|
||||
$this->assertText(t('Add new comment'), t('Add new comment appears on node page'));
|
||||
$this->assertText(t('Add new comment'), 'Add new comment appears on node page');
|
||||
|
||||
// Run cron to index this page.
|
||||
$this->drupalLogout();
|
||||
@@ -935,13 +935,13 @@ class SearchCommentTestCase extends DrupalWebTestCase {
|
||||
// Search for 'comment'. Should be no results.
|
||||
$this->drupalLogin($user);
|
||||
$this->drupalPost('search/node', array('keys' => 'comment'), t('Search'));
|
||||
$this->assertText(t('Your search yielded no results'), t('No results searching for the word comment'));
|
||||
$this->assertText(t('Your search yielded no results'), 'No results searching for the word comment');
|
||||
|
||||
// Search for the node title. Should be found, and 'Add new comment' should
|
||||
// not be part of the search snippet.
|
||||
$this->drupalPost('search/node', array('keys' => 'short'), t('Search'));
|
||||
$this->assertText($node->title, t('Search for keyword worked'));
|
||||
$this->assertNoText(t('Add new comment'), t('Add new comment does not appear on search results page'));
|
||||
$this->assertText($node->title, 'Search for keyword worked');
|
||||
$this->assertNoText(t('Add new comment'), 'Add new comment does not appear on search results page');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1074,8 +1074,8 @@ class SearchCommentCountToggleTestCase extends DrupalWebTestCase {
|
||||
|
||||
// Test comment count display for nodes with comment status set to Open
|
||||
$this->drupalPost('', $edit, t('Search'));
|
||||
$this->assertText(t('0 comments'), t('Empty comment count displays for nodes with comment status set to Open'));
|
||||
$this->assertText(t('1 comment'), t('Non-empty comment count displays for nodes with comment status set to Open'));
|
||||
$this->assertText(t('0 comments'), 'Empty comment count displays for nodes with comment status set to Open');
|
||||
$this->assertText(t('1 comment'), 'Non-empty comment count displays for nodes with comment status set to Open');
|
||||
|
||||
// Test comment count display for nodes with comment status set to Closed
|
||||
$this->searchable_nodes['0 comments']->comment = COMMENT_NODE_CLOSED;
|
||||
@@ -1084,8 +1084,8 @@ class SearchCommentCountToggleTestCase extends DrupalWebTestCase {
|
||||
node_save($this->searchable_nodes['1 comment']);
|
||||
|
||||
$this->drupalPost('', $edit, t('Search'));
|
||||
$this->assertNoText(t('0 comments'), t('Empty comment count does not display for nodes with comment status set to Closed'));
|
||||
$this->assertText(t('1 comment'), t('Non-empty comment count displays for nodes with comment status set to Closed'));
|
||||
$this->assertNoText(t('0 comments'), 'Empty comment count does not display for nodes with comment status set to Closed');
|
||||
$this->assertText(t('1 comment'), 'Non-empty comment count displays for nodes with comment status set to Closed');
|
||||
|
||||
// Test comment count display for nodes with comment status set to Hidden
|
||||
$this->searchable_nodes['0 comments']->comment = COMMENT_NODE_HIDDEN;
|
||||
@@ -1094,8 +1094,8 @@ class SearchCommentCountToggleTestCase extends DrupalWebTestCase {
|
||||
node_save($this->searchable_nodes['1 comment']);
|
||||
|
||||
$this->drupalPost('', $edit, t('Search'));
|
||||
$this->assertNoText(t('0 comments'), t('Empty comment count does not display for nodes with comment status set to Hidden'));
|
||||
$this->assertNoText(t('1 comment'), t('Non-empty comment count does not display for nodes with comment status set to Hidden'));
|
||||
$this->assertNoText(t('0 comments'), 'Empty comment count does not display for nodes with comment status set to Hidden');
|
||||
$this->assertNoText(t('1 comment'), 'Non-empty comment count does not display for nodes with comment status set to Hidden');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1160,7 +1160,7 @@ class SearchSimplifyTestCase extends DrupalWebTestCase {
|
||||
for ($i = 0; $i < 32; $i++) {
|
||||
$string .= chr($i);
|
||||
}
|
||||
$this->assertIdentical(' ', search_simplify($string), t('Search simplify works for ASCII control characters.'));
|
||||
$this->assertIdentical(' ', search_simplify($string), 'Search simplify works for ASCII control characters.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1316,7 +1316,7 @@ class SearchNumbersTestCase extends DrupalWebTestCase {
|
||||
$this->drupalPost('search/node',
|
||||
array('keys' => $number),
|
||||
t('Search'));
|
||||
$this->assertText($node->title, $type . ': node title shown (search found the node) in search for number ' . $number);
|
||||
$this->assertText($node->title, format_string('%type: node title shown (search found the node) in search for number %number.', array('%type' => $type, '%number' => $number)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1384,7 +1384,7 @@ class SearchNumberMatchingTestCase extends DrupalWebTestCase {
|
||||
$this->drupalPost('search/node',
|
||||
array('keys' => 'foo'),
|
||||
t('Search'));
|
||||
$this->assertNoText($node->title, $i . ': node title not shown in dummy search');
|
||||
$this->assertNoText($node->title, format_string('%number: node title not shown in dummy search', array('%number' => $i)));
|
||||
|
||||
// Now verify that we can find node i by searching for any of the
|
||||
// numbers.
|
||||
@@ -1397,7 +1397,7 @@ class SearchNumberMatchingTestCase extends DrupalWebTestCase {
|
||||
$this->drupalPost('search/node',
|
||||
array('keys' => $number),
|
||||
t('Search'));
|
||||
$this->assertText($node->title, $i . ': node title shown (search found the node) in search for number ' . $number);
|
||||
$this->assertText($node->title, format_string('%i: node title shown (search found the node) in search for number %number', array('%i' => $i, '%number' => $number)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1558,7 +1558,7 @@ class SearchConfigSettingsForm extends DrupalWebTestCase {
|
||||
$this->drupalGet($path);
|
||||
foreach ($modules as $module) {
|
||||
$title = $module_info[$module]['title'];
|
||||
$this->assertText($title, $title . ' search tab is shown');
|
||||
$this->assertText($title, format_string('%title search tab is shown', array('%title' => $title)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1955,42 +1955,42 @@ class SearchLanguageTestCase extends DrupalWebTestCase {
|
||||
function testLanguages() {
|
||||
// Check that there are initially no languages displayed.
|
||||
$this->drupalGet('search/node');
|
||||
$this->assertNoText(t('Languages'), t('No languages to choose from.'));
|
||||
$this->assertNoText(t('Languages'), 'No languages to choose from.');
|
||||
|
||||
// Add predefined language.
|
||||
$edit = array('langcode' => 'fr');
|
||||
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add language'));
|
||||
$this->assertText('fr', t('Language added successfully.'));
|
||||
$this->assertText('fr', 'Language added successfully.');
|
||||
|
||||
// Now we should have languages displayed.
|
||||
$this->drupalGet('search/node');
|
||||
$this->assertText(t('Languages'), t('Languages displayed to choose from.'));
|
||||
$this->assertText(t('English'), t('English is a possible choice.'));
|
||||
$this->assertText(t('French'), t('French is a possible choice.'));
|
||||
$this->assertText(t('Languages'), 'Languages displayed to choose from.');
|
||||
$this->assertText(t('English'), 'English is a possible choice.');
|
||||
$this->assertText(t('French'), 'French is a possible choice.');
|
||||
|
||||
// Ensure selecting no language does not make the query different.
|
||||
$this->drupalPost('search/node', array(), t('Advanced search'));
|
||||
$this->assertEqual($this->getUrl(), url('search/node/', array('absolute' => TRUE)), t('Correct page redirection, no language filtering.'));
|
||||
$this->assertEqual($this->getUrl(), url('search/node/', array('absolute' => TRUE)), 'Correct page redirection, no language filtering.');
|
||||
|
||||
// Pick French and ensure it is selected.
|
||||
$edit = array('language[fr]' => TRUE);
|
||||
$this->drupalPost('search/node', $edit, t('Advanced search'));
|
||||
$this->assertFieldByXPath('//input[@name="keys"]', 'language:fr', t('Language filter added to query.'));
|
||||
$this->assertFieldByXPath('//input[@name="keys"]', 'language:fr', 'Language filter added to query.');
|
||||
|
||||
// Change the default language and disable English.
|
||||
$path = 'admin/config/regional/language';
|
||||
$this->drupalGet($path);
|
||||
$this->assertFieldChecked('edit-site-default-en', t('English is the default language.'));
|
||||
$this->assertFieldChecked('edit-site-default-en', 'English is the default language.');
|
||||
$edit = array('site_default' => 'fr');
|
||||
$this->drupalPost(NULL, $edit, t('Save configuration'));
|
||||
$this->assertNoFieldChecked('edit-site-default-en', t('Default language updated.'));
|
||||
$this->assertNoFieldChecked('edit-site-default-en', 'Default language updated.');
|
||||
$edit = array('enabled[en]' => FALSE);
|
||||
$this->drupalPost('admin/config/regional/language', $edit, t('Save configuration'));
|
||||
$this->assertNoFieldChecked('edit-enabled-en', t('Language disabled.'));
|
||||
$this->assertNoFieldChecked('edit-enabled-en', 'Language disabled.');
|
||||
|
||||
// Check that there are again no languages displayed.
|
||||
$this->drupalGet('search/node');
|
||||
$this->assertNoText(t('Languages'), t('No languages to choose from.'));
|
||||
$this->assertNoText(t('Languages'), 'No languages to choose from.');
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
files[] = shortcut.test
|
||||
configure = admin/config/user-interface/shortcut
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
; Information added by drupal.org packaging script on 2013-08-08
|
||||
version = "7.23"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
datestamp = "1375928238"
|
||||
|
||||
|
@@ -211,16 +211,16 @@ class ShortcutLinksTestCase extends ShortcutTestCase {
|
||||
variable_set('theme_default', 'seven');
|
||||
|
||||
$this->drupalGet('page-that-does-not-exist');
|
||||
$this->assertNoRaw('add-shortcut', t('Add to shortcuts link was not shown on a page not found.'));
|
||||
$this->assertNoRaw('add-shortcut', 'Add to shortcuts link was not shown on a page not found.');
|
||||
|
||||
// The user does not have access to this path.
|
||||
$this->drupalGet('admin/modules');
|
||||
$this->assertNoRaw('add-shortcut', t('Add to shortcuts link was not shown on a page the user does not have access to.'));
|
||||
$this->assertNoRaw('add-shortcut', 'Add to shortcuts link was not shown on a page the user does not have access to.');
|
||||
|
||||
// Verify that the testing mechanism works by verifying the shortcut
|
||||
// link appears on admin/content/node.
|
||||
$this->drupalGet('admin/content/node');
|
||||
$this->assertRaw('add-shortcut', t('Add to shortcuts link was shown on a page the user does have access to.'));
|
||||
$this->assertRaw('add-shortcut', 'Add to shortcuts link was shown on a page the user does have access to.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -334,7 +334,7 @@ class ShortcutSetsTestCase extends ShortcutTestCase {
|
||||
$this->drupalPost('admin/config/user-interface/shortcut/' . $set->set_name . '/edit', array('title' => $existing_title), t('Save'));
|
||||
$this->assertRaw(t('The shortcut set %name already exists. Choose another name.', array('%name' => $existing_title)));
|
||||
$set = shortcut_set_load($set->set_name);
|
||||
$this->assertNotEqual($set->title, $existing_title, t('The shortcut set %title cannot be renamed to %new-title because a shortcut set with that title already exists.', array('%title' => $set->title, '%new-title' => $existing_title)));
|
||||
$this->assertNotEqual($set->title, $existing_title, format_string('The shortcut set %title cannot be renamed to %new-title because a shortcut set with that title already exists.', array('%title' => $set->title, '%new-title' => $existing_title)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user