@@ -77,7 +77,7 @@ function aggregator_form_feed($form, &$form_state, stdClass $feed = NULL) {
|
||||
$form['url'] = array('#type' => 'textfield',
|
||||
'#title' => t('URL'),
|
||||
'#default_value' => isset($feed->url) ? $feed->url : '',
|
||||
'#maxlength' => 255,
|
||||
'#maxlength' => NULL,
|
||||
'#description' => t('The fully-qualified URL of the feed.'),
|
||||
'#required' => TRUE,
|
||||
);
|
||||
|
@@ -19,8 +19,8 @@
|
||||
* parser; and finally, it is passed to all active processors, which manipulate
|
||||
* or store the data.
|
||||
*
|
||||
* Modules that define this hook can be set as active fetcher on
|
||||
* admin/config/services/aggregator. Only one fetcher can be active at a time.
|
||||
* Modules that define this hook can be set as the active fetcher within the
|
||||
* configuration page. Only one fetcher can be active at a time.
|
||||
*
|
||||
* @param $feed
|
||||
* A feed object representing the resource to be downloaded. $feed->url
|
||||
@@ -43,10 +43,9 @@ function hook_aggregator_fetch($feed) {
|
||||
/**
|
||||
* Specify the title and short description of your fetcher.
|
||||
*
|
||||
* The title and the description provided are shown on
|
||||
* admin/config/services/aggregator among other places. Use as title the human
|
||||
* readable name of the fetcher and as description a brief (40 to 80 characters)
|
||||
* explanation of the fetcher's functionality.
|
||||
* The title and the description provided are shown within the configuration
|
||||
* page. Use as title the human readable name of the fetcher and as description
|
||||
* a brief (40 to 80 characters) explanation of the fetcher's functionality.
|
||||
*
|
||||
* This hook is only called if your module implements hook_aggregator_fetch().
|
||||
* If this hook is not implemented aggregator will use your module's file name
|
||||
@@ -75,8 +74,8 @@ function hook_aggregator_fetch_info() {
|
||||
* active parser; and finally, it is passed to all active processors which
|
||||
* manipulate or store the data.
|
||||
*
|
||||
* Modules that define this hook can be set as the active parser on
|
||||
* admin/config/services/aggregator. Only one parser can be active at a time.
|
||||
* Modules that define this hook can be set as the active parser within the
|
||||
* configuration page. Only one parser can be active at a time.
|
||||
*
|
||||
* @param $feed
|
||||
* An object describing the resource to be parsed. $feed->source_string
|
||||
@@ -119,10 +118,9 @@ function hook_aggregator_parse($feed) {
|
||||
/**
|
||||
* Specify the title and short description of your parser.
|
||||
*
|
||||
* The title and the description provided are shown on
|
||||
* admin/config/services/aggregator among other places. Use as title the human
|
||||
* readable name of the parser and as description a brief (40 to 80 characters)
|
||||
* explanation of the parser's functionality.
|
||||
* The title and the description provided are shown within the configuration
|
||||
* page. Use as title the human readable name of the parser and as description
|
||||
* a brief (40 to 80 characters) explanation of the parser's functionality.
|
||||
*
|
||||
* This hook is only called if your module implements hook_aggregator_parse().
|
||||
* If this hook is not implemented aggregator will use your module's file name
|
||||
@@ -151,8 +149,8 @@ function hook_aggregator_parse_info() {
|
||||
* parser; and finally, it is passed to all active processors that manipulate or
|
||||
* store the data.
|
||||
*
|
||||
* Modules that define this hook can be activated as processor on
|
||||
* admin/config/services/aggregator.
|
||||
* Modules that define this hook can be activated as a processor within the
|
||||
* configuration page.
|
||||
*
|
||||
* @param $feed
|
||||
* A feed object representing the resource to be processed. $feed->items
|
||||
@@ -176,10 +174,9 @@ function hook_aggregator_process($feed) {
|
||||
/**
|
||||
* Specify the title and short description of your processor.
|
||||
*
|
||||
* The title and the description provided are shown most importantly on
|
||||
* admin/config/services/aggregator. Use as title the natural name of the
|
||||
* processor and as description a brief (40 to 80 characters) explanation of the
|
||||
* functionality.
|
||||
* The title and the description provided are shown within the configuration
|
||||
* page. Use as title the natural name of the processor and as description a
|
||||
* brief (40 to 80 characters) explanation of the functionality.
|
||||
*
|
||||
* This hook is only called if your module implements hook_aggregator_process().
|
||||
* If this hook is not implemented aggregator will use your module's file name
|
||||
|
@@ -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 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -130,10 +130,8 @@ function aggregator_schema() {
|
||||
'description' => 'Title of the feed.',
|
||||
),
|
||||
'url' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 255,
|
||||
'type' => 'text',
|
||||
'not null' => TRUE,
|
||||
'default' => '',
|
||||
'description' => 'URL to the feed.',
|
||||
),
|
||||
'refresh' => array(
|
||||
@@ -155,10 +153,8 @@ function aggregator_schema() {
|
||||
'description' => 'Time when this feed was queued for refresh, 0 if not queued.',
|
||||
),
|
||||
'link' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 255,
|
||||
'type' => 'text',
|
||||
'not null' => TRUE,
|
||||
'default' => '',
|
||||
'description' => 'The parent website of the feed; comes from the <link> element in the feed.',
|
||||
),
|
||||
'description' => array(
|
||||
@@ -202,13 +198,13 @@ function aggregator_schema() {
|
||||
)
|
||||
),
|
||||
'primary key' => array('fid'),
|
||||
'unique keys' => array(
|
||||
'url' => array('url'),
|
||||
'title' => array('title'),
|
||||
),
|
||||
'indexes' => array(
|
||||
'url' => array(array('url', 255)),
|
||||
'queued' => array('queued'),
|
||||
),
|
||||
'unique keys' => array(
|
||||
'title' => array('title'),
|
||||
),
|
||||
);
|
||||
|
||||
$schema['aggregator_item'] = array(
|
||||
@@ -233,10 +229,8 @@ function aggregator_schema() {
|
||||
'description' => 'Title of the feed item.',
|
||||
),
|
||||
'link' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 255,
|
||||
'type' => 'text',
|
||||
'not null' => TRUE,
|
||||
'default' => '',
|
||||
'description' => 'Link to the feed item.',
|
||||
),
|
||||
'author' => array(
|
||||
@@ -258,9 +252,8 @@ function aggregator_schema() {
|
||||
'description' => 'Posted date of the feed item, as a Unix timestamp.',
|
||||
),
|
||||
'guid' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 255,
|
||||
'not null' => FALSE,
|
||||
'type' => 'text',
|
||||
'not null' => TRUE,
|
||||
'description' => 'Unique identifier for the feed item.',
|
||||
)
|
||||
),
|
||||
@@ -279,6 +272,11 @@ function aggregator_schema() {
|
||||
return $schema;
|
||||
}
|
||||
|
||||
/**
|
||||
* @addtogroup updates-6.x-to-7.x
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Add hash column to aggregator_feed table.
|
||||
*/
|
||||
@@ -306,3 +304,27 @@ function aggregator_update_7002() {
|
||||
db_add_index('aggregator_feed', 'queued', array('queued'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @} End of "addtogroup updates-6.x-to-7.x"
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup updates-7.x-extra
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Increase the length of {aggregator_feed}.url.
|
||||
*/
|
||||
function aggregator_update_7003() {
|
||||
db_drop_unique_key('aggregator_feed', 'url');
|
||||
db_change_field('aggregator_feed', 'url', 'url', array('type' => 'text', 'not null' => TRUE, 'description' => 'URL to the feed.'));
|
||||
db_change_field('aggregator_feed', 'link', 'link', array('type' => 'text', 'not null' => TRUE, 'description' => 'The parent website of the feed; comes from the <link> element in the feed.'));
|
||||
db_change_field('aggregator_item', 'link', 'link', array('type' => 'text', 'not null' => TRUE, 'description' => 'Link to the feed item.'));
|
||||
db_change_field('aggregator_item', 'guid', 'guid', array('type' => 'text', 'not null' => TRUE, 'description' => 'Unique identifier for the feed item.'));
|
||||
db_add_index('aggregator_feed', 'url', array(array('url', 255)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @} End of "addtogroup updates-7.x-extra"
|
||||
*/
|
||||
|
@@ -534,6 +534,7 @@ function aggregator_save_feed($edit) {
|
||||
'url' => $edit['url'],
|
||||
'refresh' => $edit['refresh'],
|
||||
'block' => $edit['block'],
|
||||
'link' => '',
|
||||
'description' => '',
|
||||
'image' => '',
|
||||
))
|
||||
@@ -568,15 +569,13 @@ function aggregator_remove($feed) {
|
||||
// Call hook_aggregator_remove() on all modules.
|
||||
module_invoke_all('aggregator_remove', $feed);
|
||||
// Reset feed.
|
||||
db_merge('aggregator_feed')
|
||||
->key(array('fid' => $feed->fid))
|
||||
db_update('aggregator_feed')
|
||||
->condition('fid', $feed->fid)
|
||||
->fields(array(
|
||||
'checked' => 0,
|
||||
'hash' => '',
|
||||
'etag' => '',
|
||||
'modified' => 0,
|
||||
'description' => $feed->description,
|
||||
'image' => $feed->image,
|
||||
))
|
||||
->execute();
|
||||
}
|
||||
|
@@ -38,8 +38,9 @@ function aggregator_aggregator_process($feed) {
|
||||
$item['timestamp'] = isset($entry->timestamp) ? $entry->timestamp : REQUEST_TIME;
|
||||
}
|
||||
|
||||
// Make sure the item title fits in 255 varchar column.
|
||||
// Make sure the item title and author fit in the 255 varchar column.
|
||||
$item['title'] = truncate_utf8($item['title'], 255, TRUE, TRUE);
|
||||
$item['author'] = truncate_utf8($item['author'], 255, TRUE, TRUE);
|
||||
aggregator_save_item(array('iid' => (isset($entry->iid) ? $entry->iid : ''), 'fid' => $feed->fid, 'timestamp' => $item['timestamp'], 'title' => $item['title'], 'link' => $item['link'], 'author' => $item['author'], 'description' => $item['description'], 'guid' => $item['guid']));
|
||||
}
|
||||
}
|
||||
|
@@ -25,10 +25,10 @@ class AggregatorTestCase extends DrupalWebTestCase {
|
||||
function createFeed($feed_url = NULL) {
|
||||
$edit = $this->getFeedEditArray($feed_url);
|
||||
$this->drupalPost('admin/config/services/aggregator/add/feed', $edit, t('Save'));
|
||||
$this->assertRaw(t('The feed %name has been added.', array('%name' => $edit['title'])), t('The feed !name has been added.', array('!name' => $edit['title'])));
|
||||
$this->assertRaw(t('The feed %name has been added.', array('%name' => $edit['title'])), format_string('The feed !name has been added.', array('!name' => $edit['title'])));
|
||||
|
||||
$feed = db_query("SELECT * FROM {aggregator_feed} WHERE title = :title AND url = :url", array(':title' => $edit['title'], ':url' => $edit['url']))->fetch();
|
||||
$this->assertTrue(!empty($feed), t('The feed found in database.'));
|
||||
$this->assertTrue(!empty($feed), 'The feed found in database.');
|
||||
return $feed;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class AggregatorTestCase extends DrupalWebTestCase {
|
||||
*/
|
||||
function deleteFeed($feed) {
|
||||
$this->drupalPost('admin/config/services/aggregator/edit/feed/' . $feed->fid, array(), t('Delete'));
|
||||
$this->assertRaw(t('The feed %title has been deleted.', array('%title' => $feed->title)), t('Feed deleted successfully.'));
|
||||
$this->assertRaw(t('The feed %title has been deleted.', array('%title' => $feed->title)), 'Feed deleted successfully.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -90,7 +90,7 @@ class AggregatorTestCase extends DrupalWebTestCase {
|
||||
function updateFeedItems(&$feed, $expected_count) {
|
||||
// First, let's ensure we can get to the rss xml.
|
||||
$this->drupalGet($feed->url);
|
||||
$this->assertResponse(200, t('!url is reachable.', array('!url' => $feed->url)));
|
||||
$this->assertResponse(200, format_string('!url is reachable.', array('!url' => $feed->url)));
|
||||
|
||||
// Attempt to access the update link directly without an access token.
|
||||
$this->drupalGet('admin/config/services/aggregator/update/' . $feed->fid);
|
||||
@@ -108,7 +108,7 @@ class AggregatorTestCase extends DrupalWebTestCase {
|
||||
$feed->items[] = $item->iid;
|
||||
}
|
||||
$feed->item_count = count($feed->items);
|
||||
$this->assertEqual($expected_count, $feed->item_count, t('Total items in feed equal to the total items in database (!val1 != !val2)', array('!val1' => $expected_count, '!val2' => $feed->item_count)));
|
||||
$this->assertEqual($expected_count, $feed->item_count, format_string('Total items in feed equal to the total items in database (!val1 != !val2)', array('!val1' => $expected_count, '!val2' => $feed->item_count)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -119,7 +119,7 @@ class AggregatorTestCase extends DrupalWebTestCase {
|
||||
*/
|
||||
function removeFeedItems($feed) {
|
||||
$this->drupalPost('admin/config/services/aggregator/remove/' . $feed->fid, array(), t('Remove items'));
|
||||
$this->assertRaw(t('The news items from %title have been removed.', array('%title' => $feed->title)), t('Feed items removed.'));
|
||||
$this->assertRaw(t('The news items from %title have been removed.', array('%title' => $feed->title)), 'Feed items removed.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -167,12 +167,12 @@ class AggregatorTestCase extends DrupalWebTestCase {
|
||||
|
||||
|
||||
/**
|
||||
* Check if the feed name and url is unique.
|
||||
* Check if the feed name and URL is unique.
|
||||
*
|
||||
* @param $feed_name
|
||||
* String containing the feed name to check.
|
||||
* @param $feed_url
|
||||
* String containing the feed url to check.
|
||||
* String containing the feed URL to check.
|
||||
* @return
|
||||
* TRUE if feed is unique.
|
||||
*/
|
||||
@@ -316,7 +316,7 @@ class AggregatorConfigurationTestCase extends AggregatorTestCase {
|
||||
$this->assertText(t('The configuration options have been saved.'));
|
||||
|
||||
foreach ($edit as $name => $value) {
|
||||
$this->assertFieldByName($name, $value, t('"@name" has correct default value.', array('@name' => $name)));
|
||||
$this->assertFieldByName($name, $value, format_string('"@name" has correct default value.', array('@name' => $name)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -337,19 +337,48 @@ class AddFeedTestCase extends AggregatorTestCase {
|
||||
$feed = $this->createFeed();
|
||||
|
||||
// Check feed data.
|
||||
$this->assertEqual($this->getUrl(), url('admin/config/services/aggregator/add/feed', array('absolute' => TRUE)), t('Directed to correct url.'));
|
||||
$this->assertTrue($this->uniqueFeed($feed->title, $feed->url), t('The feed is unique.'));
|
||||
$this->assertEqual($this->getUrl(), url('admin/config/services/aggregator/add/feed', array('absolute' => TRUE)), 'Directed to correct url.');
|
||||
$this->assertTrue($this->uniqueFeed($feed->title, $feed->url), 'The feed is unique.');
|
||||
|
||||
// Check feed source.
|
||||
$this->drupalGet('aggregator/sources/' . $feed->fid);
|
||||
$this->assertResponse(200, t('Feed source exists.'));
|
||||
$this->assertText($feed->title, t('Page title'));
|
||||
$this->assertResponse(200, 'Feed source exists.');
|
||||
$this->assertText($feed->title, 'Page title');
|
||||
$this->drupalGet('aggregator/sources/' . $feed->fid . '/categorize');
|
||||
$this->assertResponse(200, t('Feed categorization page exists.'));
|
||||
$this->assertResponse(200, 'Feed categorization page exists.');
|
||||
|
||||
// Delete feed.
|
||||
$this->deleteFeed($feed);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests feeds with very long URLs.
|
||||
*/
|
||||
function testAddLongFeed() {
|
||||
// Create a feed with a URL of > 255 characters.
|
||||
$long_url = "https://www.google.com/search?ix=heb&sourceid=chrome&ie=UTF-8&q=angie+byron#sclient=psy-ab&hl=en&safe=off&source=hp&q=angie+byron&pbx=1&oq=angie+byron&aq=f&aqi=&aql=&gs_sm=3&gs_upl=0l0l0l10534l0l0l0l0l0l0l0l0ll0l0&bav=on.2,or.r_gc.r_pw.r_cp.,cf.osb&fp=a70b6b1f0abe28d8&biw=1629&bih=889&ix=heb";
|
||||
$feed = $this->createFeed($long_url);
|
||||
|
||||
// Create a second feed of > 255 characters, where the only difference is
|
||||
// after the 255th character.
|
||||
$long_url_2 = "https://www.google.com/search?ix=heb&sourceid=chrome&ie=UTF-8&q=angie+byron#sclient=psy-ab&hl=en&safe=off&source=hp&q=angie+byron&pbx=1&oq=angie+byron&aq=f&aqi=&aql=&gs_sm=3&gs_upl=0l0l0l10534l0l0l0l0l0l0l0l0ll0l0&bav=on.2,or.r_gc.r_pw.r_cp.,cf.osb&fp=a70b6b1f0abe28d8&biw=1629&bih=889";
|
||||
$feed_2 = $this->createFeed($long_url_2);
|
||||
|
||||
// Check feed data.
|
||||
$this->assertTrue($this->uniqueFeed($feed->title, $feed->url), 'The first long URL feed is unique.');
|
||||
$this->assertTrue($this->uniqueFeed($feed_2->title, $feed_2->url), 'The second long URL feed is unique.');
|
||||
|
||||
// Check feed source.
|
||||
$this->drupalGet('aggregator/sources/' . $feed->fid);
|
||||
$this->assertResponse(200, 'Long URL feed source exists.');
|
||||
$this->assertText($feed->title, 'Page title');
|
||||
$this->drupalGet('aggregator/sources/' . $feed->fid . '/categorize');
|
||||
$this->assertResponse(200, 'Long URL feed categorization page exists.');
|
||||
|
||||
// Delete feeds.
|
||||
$this->deleteFeed($feed);
|
||||
$this->deleteFeed($feed_2);
|
||||
}
|
||||
}
|
||||
|
||||
class CategorizeFeedTestCase extends AggregatorTestCase {
|
||||
@@ -369,11 +398,11 @@ class CategorizeFeedTestCase extends AggregatorTestCase {
|
||||
// Create 2 categories.
|
||||
$category_1 = array('title' => $this->randomName(10), 'description' => '');
|
||||
$this->drupalPost('admin/config/services/aggregator/add/category', $category_1, t('Save'));
|
||||
$this->assertRaw(t('The category %title has been added.', array('%title' => $category_1['title'])), t('The category %title has been added.', array('%title' => $category_1['title'])));
|
||||
$this->assertRaw(t('The category %title has been added.', array('%title' => $category_1['title'])), format_string('The category %title has been added.', array('%title' => $category_1['title'])));
|
||||
|
||||
$category_2 = array('title' => $this->randomName(10), 'description' => '');
|
||||
$this->drupalPost('admin/config/services/aggregator/add/category', $category_2, t('Save'));
|
||||
$this->assertRaw(t('The category %title has been added.', array('%title' => $category_2['title'])), t('The category %title has been added.', array('%title' => $category_2['title'])));
|
||||
$this->assertRaw(t('The category %title has been added.', array('%title' => $category_2['title'])), format_string('The category %title has been added.', array('%title' => $category_2['title'])));
|
||||
|
||||
// Get categories from database.
|
||||
$categories = $this->getCategories();
|
||||
@@ -391,7 +420,7 @@ class CategorizeFeedTestCase extends AggregatorTestCase {
|
||||
|
||||
// Assert the feed has two categories.
|
||||
$this->getFeedCategories($db_feed);
|
||||
$this->assertEqual(count($db_feed->categories), 2, t('Feed has 2 categories'));
|
||||
$this->assertEqual(count($db_feed->categories), 2, 'Feed has 2 categories');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -419,16 +448,16 @@ class UpdateFeedTestCase extends AggregatorTestCase {
|
||||
$edit[$same_field] = $feed->{$same_field};
|
||||
}
|
||||
$this->drupalPost('admin/config/services/aggregator/edit/feed/' . $feed->fid, $edit, t('Save'));
|
||||
$this->assertRaw(t('The feed %name has been updated.', array('%name' => $edit['title'])), t('The feed %name has been updated.', array('%name' => $edit['title'])));
|
||||
$this->assertRaw(t('The feed %name has been updated.', array('%name' => $edit['title'])), format_string('The feed %name has been updated.', array('%name' => $edit['title'])));
|
||||
|
||||
// Check feed data.
|
||||
$this->assertEqual($this->getUrl(), url('admin/config/services/aggregator/', array('absolute' => TRUE)));
|
||||
$this->assertTrue($this->uniqueFeed($edit['title'], $edit['url']), t('The feed is unique.'));
|
||||
$this->assertTrue($this->uniqueFeed($edit['title'], $edit['url']), 'The feed is unique.');
|
||||
|
||||
// Check feed source.
|
||||
$this->drupalGet('aggregator/sources/' . $feed->fid);
|
||||
$this->assertResponse(200, t('Feed source exists.'));
|
||||
$this->assertText($edit['title'], t('Page title'));
|
||||
$this->assertResponse(200, 'Feed source exists.');
|
||||
$this->assertText($edit['title'], 'Page title');
|
||||
|
||||
// Delete feed.
|
||||
$feed->title = $edit['title']; // Set correct title so deleteFeed() will work.
|
||||
@@ -457,11 +486,11 @@ class RemoveFeedTestCase extends AggregatorTestCase {
|
||||
|
||||
// Check feed source.
|
||||
$this->drupalGet('aggregator/sources/' . $feed->fid);
|
||||
$this->assertResponse(404, t('Deleted feed source does not exists.'));
|
||||
$this->assertResponse(404, 'Deleted feed source does not exists.');
|
||||
|
||||
// Check database for feed.
|
||||
$result = db_query("SELECT COUNT(*) FROM {aggregator_feed} WHERE title = :title AND url = :url", array(':title' => $feed->title, ':url' => $feed->url))->fetchField();
|
||||
$this->assertFalse($result, t('Feed not found in database'));
|
||||
$this->assertFalse($result, 'Feed not found in database');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -497,10 +526,10 @@ class UpdateFeedItemTestCase extends AggregatorTestCase {
|
||||
);
|
||||
|
||||
$this->drupalGet($edit['url']);
|
||||
$this->assertResponse(array(200), t('URL !url is accessible', array('!url' => $edit['url'])));
|
||||
$this->assertResponse(array(200), format_string('URL !url is accessible', array('!url' => $edit['url'])));
|
||||
|
||||
$this->drupalPost('admin/config/services/aggregator/add/feed', $edit, t('Save'));
|
||||
$this->assertRaw(t('The feed %name has been added.', array('%name' => $edit['title'])), t('The feed !name has been added.', array('!name' => $edit['title'])));
|
||||
$this->assertRaw(t('The feed %name has been added.', array('%name' => $edit['title'])), format_string('The feed !name has been added.', array('!name' => $edit['title'])));
|
||||
|
||||
$feed = db_query("SELECT * FROM {aggregator_feed} WHERE url = :url", array(':url' => $edit['url']))->fetchObject();
|
||||
|
||||
@@ -521,7 +550,7 @@ class UpdateFeedItemTestCase extends AggregatorTestCase {
|
||||
aggregator_refresh($feed);
|
||||
|
||||
$after = db_query('SELECT timestamp FROM {aggregator_item} WHERE fid = :fid', array(':fid' => $feed->fid))->fetchField();
|
||||
$this->assertTrue($before === $after, t('Publish timestamp of feed item was not updated (!before === !after)', array('!before' => $before, '!after' => $after)));
|
||||
$this->assertTrue($before === $after, format_string('Publish timestamp of feed item was not updated (!before === !after)', array('!before' => $before, '!after' => $after)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -554,9 +583,9 @@ class RemoveFeedItemTestCase extends AggregatorTestCase {
|
||||
// Update and remove items two times in a row to make sure that removal
|
||||
// resets all 'modified' information (modified, etag, hash) and allows for
|
||||
// immediate update.
|
||||
$this->updateAndRemove($feed, 2);
|
||||
$this->updateAndRemove($feed, 2);
|
||||
$this->updateAndRemove($feed, 2);
|
||||
$this->updateAndRemove($feed, 4);
|
||||
$this->updateAndRemove($feed, 4);
|
||||
$this->updateAndRemove($feed, 4);
|
||||
// Delete feed.
|
||||
$this->deleteFeed($feed);
|
||||
}
|
||||
@@ -582,14 +611,14 @@ class CategorizeFeedItemTestCase extends AggregatorTestCase {
|
||||
// Simulate form submission on "admin/config/services/aggregator/add/category".
|
||||
$edit = array('title' => $this->randomName(10), 'description' => '');
|
||||
$this->drupalPost('admin/config/services/aggregator/add/category', $edit, t('Save'));
|
||||
$this->assertRaw(t('The category %title has been added.', array('%title' => $edit['title'])), t('The category %title has been added.', array('%title' => $edit['title'])));
|
||||
$this->assertRaw(t('The category %title has been added.', array('%title' => $edit['title'])), format_string('The category %title has been added.', array('%title' => $edit['title'])));
|
||||
|
||||
$category = db_query("SELECT * FROM {aggregator_category} WHERE title = :title", array(':title' => $edit['title']))->fetch();
|
||||
$this->assertTrue(!empty($category), t('The category found in database.'));
|
||||
$this->assertTrue(!empty($category), 'The category found in database.');
|
||||
|
||||
$link_path = 'aggregator/categories/' . $category->cid;
|
||||
$menu_link = db_query("SELECT * FROM {menu_links} WHERE link_path = :link_path", array(':link_path' => $link_path))->fetch();
|
||||
$this->assertTrue(!empty($menu_link), t('The menu link associated with the category found in database.'));
|
||||
$this->assertTrue(!empty($menu_link), 'The menu link associated with the category found in database.');
|
||||
|
||||
$feed = $this->createFeed();
|
||||
db_insert('aggregator_category_feed')
|
||||
@@ -600,7 +629,7 @@ class CategorizeFeedItemTestCase extends AggregatorTestCase {
|
||||
->execute();
|
||||
$this->updateFeedItems($feed, $this->getDefaultFeedItemCount());
|
||||
$this->getFeedCategories($feed);
|
||||
$this->assertTrue(!empty($feed->categories), t('The category found in the feed.'));
|
||||
$this->assertTrue(!empty($feed->categories), 'The category found in the feed.');
|
||||
|
||||
// For each category of a feed, ensure feed items have that category, too.
|
||||
if (!empty($feed->categories) && !empty($feed->items)) {
|
||||
@@ -611,7 +640,7 @@ class CategorizeFeedItemTestCase extends AggregatorTestCase {
|
||||
->execute()
|
||||
->fetchField();
|
||||
|
||||
$this->assertEqual($feed->item_count, $categorized_count, t('Total items in feed equal to the total categorized feed items in database'));
|
||||
$this->assertEqual($feed->item_count, $categorized_count, 'Total items in feed equal to the total categorized feed items in database');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -644,11 +673,11 @@ class ImportOPMLTestCase extends AggregatorTestCase {
|
||||
->execute();
|
||||
|
||||
$this->drupalGet('admin/config/services/aggregator/add/opml');
|
||||
$this->assertText('A single OPML document may contain a collection of many feeds.', t('Found OPML help text.'));
|
||||
$this->assertField('files[upload]', t('Found file upload field.'));
|
||||
$this->assertField('remote', t('Found Remote URL field.'));
|
||||
$this->assertField('refresh', '', t('Found Refresh field.'));
|
||||
$this->assertFieldByName("category[$cid]", $cid, t('Found category field.'));
|
||||
$this->assertText('A single OPML document may contain a collection of many feeds.', 'Found OPML help text.');
|
||||
$this->assertField('files[upload]', 'Found file upload field.');
|
||||
$this->assertField('remote', 'Found Remote URL field.');
|
||||
$this->assertField('refresh', 'Found Refresh field.');
|
||||
$this->assertFieldByName("category[$cid]", $cid, 'Found category field.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -659,7 +688,7 @@ class ImportOPMLTestCase extends AggregatorTestCase {
|
||||
|
||||
$edit = array();
|
||||
$this->drupalPost('admin/config/services/aggregator/add/opml', $edit, t('Import'));
|
||||
$this->assertRaw(t('You must <em>either</em> upload a file or enter a URL.'), t('Error if no fields are filled.'));
|
||||
$this->assertRaw(t('You must <em>either</em> upload a file or enter a URL.'), 'Error if no fields are filled.');
|
||||
|
||||
$path = $this->getEmptyOpml();
|
||||
$edit = array(
|
||||
@@ -667,14 +696,14 @@ class ImportOPMLTestCase extends AggregatorTestCase {
|
||||
'remote' => file_create_url($path),
|
||||
);
|
||||
$this->drupalPost('admin/config/services/aggregator/add/opml', $edit, t('Import'));
|
||||
$this->assertRaw(t('You must <em>either</em> upload a file or enter a URL.'), t('Error if both fields are filled.'));
|
||||
$this->assertRaw(t('You must <em>either</em> upload a file or enter a URL.'), 'Error if both fields are filled.');
|
||||
|
||||
$edit = array('remote' => 'invalidUrl://empty');
|
||||
$this->drupalPost('admin/config/services/aggregator/add/opml', $edit, t('Import'));
|
||||
$this->assertText(t('This URL is not valid.'), t('Error if the URL is invalid.'));
|
||||
$this->assertText(t('This URL is not valid.'), 'Error if the URL is invalid.');
|
||||
|
||||
$after = db_query('SELECT COUNT(*) FROM {aggregator_feed}')->fetchField();
|
||||
$this->assertEqual($before, $after, t('No feeds were added during the three last form submissions.'));
|
||||
$this->assertEqual($before, $after, 'No feeds were added during the three last form submissions.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -685,14 +714,14 @@ class ImportOPMLTestCase extends AggregatorTestCase {
|
||||
|
||||
$form['files[upload]'] = $this->getInvalidOpml();
|
||||
$this->drupalPost('admin/config/services/aggregator/add/opml', $form, t('Import'));
|
||||
$this->assertText(t('No new feed has been added.'), t('Attempting to upload invalid XML.'));
|
||||
$this->assertText(t('No new feed has been added.'), 'Attempting to upload invalid XML.');
|
||||
|
||||
$edit = array('remote' => file_create_url($this->getEmptyOpml()));
|
||||
$this->drupalPost('admin/config/services/aggregator/add/opml', $edit, t('Import'));
|
||||
$this->assertText(t('No new feed has been added.'), t('Attempting to load empty OPML from remote URL.'));
|
||||
$this->assertText(t('No new feed has been added.'), 'Attempting to load empty OPML from remote URL.');
|
||||
|
||||
$after = db_query('SELECT COUNT(*) FROM {aggregator_feed}')->fetchField();
|
||||
$this->assertEqual($before, $after, t('No feeds were added during the two last form submissions.'));
|
||||
$this->assertEqual($before, $after, 'No feeds were added during the two last form submissions.');
|
||||
|
||||
db_delete('aggregator_feed')->execute();
|
||||
db_delete('aggregator_category')->execute();
|
||||
@@ -716,11 +745,11 @@ class ImportOPMLTestCase extends AggregatorTestCase {
|
||||
'category[1]' => $category,
|
||||
);
|
||||
$this->drupalPost('admin/config/services/aggregator/add/opml', $edit, t('Import'));
|
||||
$this->assertRaw(t('A feed with the URL %url already exists.', array('%url' => $feeds[0]['url'])), t('Verifying that a duplicate URL was identified'));
|
||||
$this->assertRaw(t('A feed named %title already exists.', array('%title' => $feeds[1]['title'])), t('Verifying that a duplicate title was identified'));
|
||||
$this->assertRaw(t('A feed with the URL %url already exists.', array('%url' => $feeds[0]['url'])), 'Verifying that a duplicate URL was identified');
|
||||
$this->assertRaw(t('A feed named %title already exists.', array('%title' => $feeds[1]['title'])), 'Verifying that a duplicate title was identified');
|
||||
|
||||
$after = db_query('SELECT COUNT(*) FROM {aggregator_feed}')->fetchField();
|
||||
$this->assertEqual($after, 2, t('Verifying that two distinct feeds were added.'));
|
||||
$this->assertEqual($after, 2, 'Verifying that two distinct feeds were added.');
|
||||
|
||||
$feeds_from_db = db_query("SELECT f.title, f.url, f.refresh, cf.cid FROM {aggregator_feed} f LEFT JOIN {aggregator_category_feed} cf ON f.fid = cf.fid");
|
||||
$refresh = $category = TRUE;
|
||||
@@ -731,10 +760,10 @@ class ImportOPMLTestCase extends AggregatorTestCase {
|
||||
$refresh = $refresh && $feed->refresh == 900;
|
||||
}
|
||||
|
||||
$this->assertEqual($title[$feeds[0]['url']], $feeds[0]['title'], t('First feed was added correctly.'));
|
||||
$this->assertEqual($url[$feeds[1]['title']], $feeds[1]['url'], t('Second feed was added correctly.'));
|
||||
$this->assertTrue($refresh, t('Refresh times are correct.'));
|
||||
$this->assertTrue($category, t('Categories are correct.'));
|
||||
$this->assertEqual($title[$feeds[0]['url']], $feeds[0]['title'], 'First feed was added correctly.');
|
||||
$this->assertEqual($url[$feeds[1]['title']], $feeds[1]['url'], 'Second feed was added correctly.');
|
||||
$this->assertTrue($refresh, 'Refresh times are correct.');
|
||||
$this->assertTrue($category, 'Categories are correct.');
|
||||
}
|
||||
|
||||
function testOPMLImport() {
|
||||
@@ -834,20 +863,20 @@ class AggregatorRenderingTestCase extends AggregatorTestCase {
|
||||
$this->assertFieldByName('blocks[' . $block['module'] . '_' . $block['delta'] . '][region]', '', 'Aggregator feed block is available for positioning.');
|
||||
// Position it.
|
||||
$this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
|
||||
$this->assertText(t('The block settings have been updated.'), t('Block successfully moved to %region_name region.', array( '%region_name' => $region)));
|
||||
$this->assertText(t('The block settings have been updated.'), format_string('Block successfully moved to %region_name region.', array( '%region_name' => $region)));
|
||||
// Confirm that the block is now being displayed on pages.
|
||||
$this->drupalGet('node');
|
||||
$this->assertText(t($block['title']), t('Feed block is displayed on the page.'));
|
||||
$this->assertText(t($block['title']), 'Feed block is displayed on the page.');
|
||||
|
||||
// Find the expected read_more link.
|
||||
$href = 'aggregator/sources/' . $feed->fid;
|
||||
$links = $this->xpath('//a[@href = :href]', array(':href' => url($href)));
|
||||
$this->assert(isset($links[0]), t('Link to href %href found.', array('%href' => $href)));
|
||||
$this->assert(isset($links[0]), format_string('Link to href %href found.', array('%href' => $href)));
|
||||
|
||||
// Visit that page.
|
||||
$this->drupalGet($href);
|
||||
$correct_titles = $this->xpath('//h1[normalize-space(text())=:title]', array(':title' => $feed->title));
|
||||
$this->assertFalse(empty($correct_titles), t('Aggregator feed page is available and has the correct title.'));
|
||||
$this->assertFalse(empty($correct_titles), 'Aggregator feed page is available and has the correct title.');
|
||||
|
||||
// Set the number of news items to 0 to test that the block does not show
|
||||
// up.
|
||||
@@ -876,7 +905,7 @@ class AggregatorRenderingTestCase extends AggregatorTestCase {
|
||||
// Check for the presence of a pager.
|
||||
$this->drupalGet('aggregator/sources/' . $feed->fid);
|
||||
$elements = $this->xpath("//ul[@class=:class]", array(':class' => 'pager'));
|
||||
$this->assertTrue(!empty($elements), t('Individual source page contains a pager.'));
|
||||
$this->assertTrue(!empty($elements), 'Individual source page contains a pager.');
|
||||
|
||||
// Reset the number of items in rss.xml to the default value.
|
||||
variable_set('feed_default_items', 10);
|
||||
@@ -910,10 +939,19 @@ class FeedParserTestCase extends AggregatorTestCase {
|
||||
$feed = $this->createFeed($this->getRSS091Sample());
|
||||
aggregator_refresh($feed);
|
||||
$this->drupalGet('aggregator/sources/' . $feed->fid);
|
||||
$this->assertResponse(200, t('Feed %name exists.', array('%name' => $feed->title)));
|
||||
$this->assertResponse(200, format_string('Feed %name exists.', array('%name' => $feed->title)));
|
||||
$this->assertText('First example feed item title');
|
||||
$this->assertLinkByHref('http://example.com/example-turns-one');
|
||||
$this->assertText('First example feed item description.');
|
||||
|
||||
// Several additional items that include elements over 255 characters.
|
||||
$this->assertRaw("Second example feed item title.");
|
||||
$this->assertText('Long link feed item title');
|
||||
$this->assertText('Long link feed item description');
|
||||
$this->assertLinkByHref('http://example.com/tomorrow/and/tomorrow/and/tomorrow/creeps/in/this/petty/pace/from/day/to/day/to/the/last/syllable/of/recorded/time/and/all/our/yesterdays/have/lighted/fools/the/way/to/dusty/death/out/out/brief/candle/life/is/but/a/walking/shadow/a/poor/player/that/struts/and/frets/his/hour/upon/the/stage/and/is/heard/no/more/it/is/a/tale/told/by/an/idiot/full/of/sound/and/fury/signifying/nothing');
|
||||
$this->assertText('Long author feed item title');
|
||||
$this->assertText('Long author feed item description');
|
||||
$this->assertLinkByHref('http://example.com/long/author');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -923,7 +961,7 @@ class FeedParserTestCase extends AggregatorTestCase {
|
||||
$feed = $this->createFeed($this->getAtomSample());
|
||||
aggregator_refresh($feed);
|
||||
$this->drupalGet('aggregator/sources/' . $feed->fid);
|
||||
$this->assertResponse(200, t('Feed %name exists.', array('%name' => $feed->title)));
|
||||
$this->assertResponse(200, format_string('Feed %name exists.', array('%name' => $feed->title)));
|
||||
$this->assertText('Atom-Powered Robots Run Amok');
|
||||
$this->assertLinkByHref('http://example.org/2003/12/13/atom03');
|
||||
$this->assertText('Some text.');
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -26,5 +26,16 @@
|
||||
<link>http://example.com/example-turns-two</link>
|
||||
<description>Second example feed item description.</description>
|
||||
</item>
|
||||
<item>
|
||||
<title>Long link feed item title.</title>
|
||||
<link>http://example.com/tomorrow/and/tomorrow/and/tomorrow/creeps/in/this/petty/pace/from/day/to/day/to/the/last/syllable/of/recorded/time/and/all/our/yesterdays/have/lighted/fools/the/way/to/dusty/death/out/out/brief/candle/life/is/but/a/walking/shadow/a/poor/player/that/struts/and/frets/his/hour/upon/the/stage/and/is/heard/no/more/it/is/a/tale/told/by/an/idiot/full/of/sound/and/fury/signifying/nothing</link>
|
||||
<description>Long link feed item description.</description>
|
||||
</item>
|
||||
<item>
|
||||
<title>Long author feed item title.</title>
|
||||
<link>http://example.com/long/author</link>
|
||||
<author>I wanted to get out and walk eastward toward the park through the soft twilight, but each time I tried to go I became entangled in some wild, strident argument which pulled me back, as if with ropes, into my chair. Yet high over the city our line of yellow windows must have contributed their share of human secrecy to the casual watcher in the darkening streets, and I was him too, looking up and wondering. I was within and without, simultaneously enchanted and repelled by the inexhaustible variety of life.</author>
|
||||
<description>Long author feed item description.</description>
|
||||
</item>
|
||||
</channel>
|
||||
</rss>
|
||||
|
@@ -55,6 +55,7 @@
|
||||
* viewed.
|
||||
* - DRUPAL_CACHE_GLOBAL: The block is the same for every user on every page
|
||||
* where it is visible.
|
||||
* - DRUPAL_CACHE_CUSTOM: The module implements its own caching system.
|
||||
* - DRUPAL_NO_CACHE: The block should not get cached.
|
||||
* - properties: (optional) Array of additional metadata to add to the block.
|
||||
* Common properties include:
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
files[] = block.test
|
||||
configure = admin/structure/block
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -45,9 +45,9 @@ class BlockTestCase extends DrupalWebTestCase {
|
||||
function testCustomBlock() {
|
||||
// Confirm that the add block link appears on block overview pages.
|
||||
$this->drupalGet('admin/structure/block');
|
||||
$this->assertRaw(l('Add block', 'admin/structure/block/add'), t('Add block link is present on block overview page for default theme.'));
|
||||
$this->assertRaw(l('Add block', 'admin/structure/block/add'), 'Add block link is present on block overview page for default theme.');
|
||||
$this->drupalGet('admin/structure/block/list/seven');
|
||||
$this->assertRaw(l('Add block', 'admin/structure/block/list/seven/add'), t('Add block link is present on block overview page for non-default theme.'));
|
||||
$this->assertRaw(l('Add block', 'admin/structure/block/list/seven/add'), 'Add block link is present on block overview page for non-default theme.');
|
||||
|
||||
// Confirm that hidden regions are not shown as options for block placement
|
||||
// when adding a new block.
|
||||
@@ -58,7 +58,7 @@ class BlockTestCase extends DrupalWebTestCase {
|
||||
if ($theme->status) {
|
||||
foreach ($theme->info['regions_hidden'] as $hidden_region) {
|
||||
$elements = $this->xpath('//select[@id=:id]//option[@value=:value]', array(':id' => 'edit-regions-' . $key, ':value' => $hidden_region));
|
||||
$this->assertFalse(isset($elements[0]), t('The hidden region @region is not available for @theme.', array('@region' => $hidden_region, '@theme' => $key)));
|
||||
$this->assertFalse(isset($elements[0]), format_string('The hidden region @region is not available for @theme.', array('@region' => $hidden_region, '@theme' => $key)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -71,17 +71,17 @@ class BlockTestCase extends DrupalWebTestCase {
|
||||
$this->drupalPost('admin/structure/block/add', $custom_block, t('Save block'));
|
||||
|
||||
// Confirm that the custom block has been created, and then query the created bid.
|
||||
$this->assertText(t('The block has been created.'), t('Custom block successfully created.'));
|
||||
$this->assertText(t('The block has been created.'), 'Custom block successfully created.');
|
||||
$bid = db_query("SELECT bid FROM {block_custom} WHERE info = :info", array(':info' => $custom_block['info']))->fetchField();
|
||||
|
||||
// Check to see if the custom block was created by checking that it's in the database.
|
||||
$this->assertNotNull($bid, t('Custom block found in database'));
|
||||
$this->assertNotNull($bid, 'Custom block found in database');
|
||||
|
||||
// Check that block_block_view() returns the correct title and content.
|
||||
$data = block_block_view($bid);
|
||||
$format = db_query("SELECT format FROM {block_custom} WHERE bid = :bid", array(':bid' => $bid))->fetchField();
|
||||
$this->assertTrue(array_key_exists('subject', $data) && empty($data['subject']), t('block_block_view() provides an empty block subject, since custom blocks do not have default titles.'));
|
||||
$this->assertEqual(check_markup($custom_block['body[value]'], $format), $data['content'], t('block_block_view() provides correct block content.'));
|
||||
$this->assertTrue(array_key_exists('subject', $data) && empty($data['subject']), 'block_block_view() provides an empty block subject, since custom blocks do not have default titles.');
|
||||
$this->assertEqual(check_markup($custom_block['body[value]'], $format), $data['content'], 'block_block_view() provides correct block content.');
|
||||
|
||||
// Check whether the block can be moved to all available regions.
|
||||
$custom_block['module'] = 'block';
|
||||
@@ -92,8 +92,8 @@ class BlockTestCase extends DrupalWebTestCase {
|
||||
|
||||
// Verify presence of configure and delete links for custom block.
|
||||
$this->drupalGet('admin/structure/block');
|
||||
$this->assertLinkByHref('admin/structure/block/manage/block/' . $bid . '/configure', 0, t('Custom block configure link found.'));
|
||||
$this->assertLinkByHref('admin/structure/block/manage/block/' . $bid . '/delete', 0, t('Custom block delete link found.'));
|
||||
$this->assertLinkByHref('admin/structure/block/manage/block/' . $bid . '/configure', 0, 'Custom block configure link found.');
|
||||
$this->assertLinkByHref('admin/structure/block/manage/block/' . $bid . '/delete', 0, 'Custom block delete link found.');
|
||||
|
||||
// Set visibility only for authenticated users, to verify delete functionality.
|
||||
$edit = array();
|
||||
@@ -103,10 +103,10 @@ class BlockTestCase extends DrupalWebTestCase {
|
||||
// Delete the created custom block & verify that it's been deleted and no longer appearing on the page.
|
||||
$this->clickLink(t('delete'));
|
||||
$this->drupalPost('admin/structure/block/manage/block/' . $bid . '/delete', array(), t('Delete'));
|
||||
$this->assertRaw(t('The block %title has been removed.', array('%title' => $custom_block['info'])), t('Custom block successfully deleted.'));
|
||||
$this->assertNoText(t($custom_block['title']), t('Custom block no longer appears on page.'));
|
||||
$this->assertRaw(t('The block %title has been removed.', array('%title' => $custom_block['info'])), 'Custom block successfully deleted.');
|
||||
$this->assertNoText(t($custom_block['title']), 'Custom block no longer appears on page.');
|
||||
$count = db_query("SELECT 1 FROM {block_role} WHERE module = :module AND delta = :delta", array(':module' => $custom_block['module'], ':delta' => $custom_block['delta']))->fetchField();
|
||||
$this->assertFalse($count, t('Table block_role being cleaned.'));
|
||||
$this->assertFalse($count, 'Table block_role being cleaned.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -130,20 +130,20 @@ class BlockTestCase extends DrupalWebTestCase {
|
||||
|
||||
// Confirm that the custom block is being displayed using configured text format.
|
||||
$this->drupalGet('node');
|
||||
$this->assertRaw('<h1>Full HTML</h1>', t('Custom block successfully being displayed using Full HTML.'));
|
||||
$this->assertRaw('<h1>Full HTML</h1>', 'Custom block successfully being displayed using Full HTML.');
|
||||
|
||||
// Confirm that a user without access to Full HTML can not see the body field,
|
||||
// but can still submit the form without errors.
|
||||
$block_admin = $this->drupalCreateUser(array('administer blocks'));
|
||||
$this->drupalLogin($block_admin);
|
||||
$this->drupalGet('admin/structure/block/manage/block/' . $bid . '/configure');
|
||||
$this->assertFieldByXPath("//textarea[@name='body[value]' and @disabled='disabled']", t('This field has been disabled because you do not have sufficient permissions to edit it.'), t('Body field contains denied message'));
|
||||
$this->assertFieldByXPath("//textarea[@name='body[value]' and @disabled='disabled']", t('This field has been disabled because you do not have sufficient permissions to edit it.'), 'Body field contains denied message');
|
||||
$this->drupalPost('admin/structure/block/manage/block/' . $bid . '/configure', array(), t('Save block'));
|
||||
$this->assertNoText(t('Ensure that each block description is unique.'));
|
||||
|
||||
// Confirm that the custom block is still being displayed using configured text format.
|
||||
$this->drupalGet('node');
|
||||
$this->assertRaw('<h1>Full HTML</h1>', t('Custom block successfully being displayed using Full HTML.'));
|
||||
$this->assertRaw('<h1>Full HTML</h1>', 'Custom block successfully being displayed using Full HTML.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -178,18 +178,18 @@ class BlockTestCase extends DrupalWebTestCase {
|
||||
$this->moveBlockToRegion($block, $this->regions[1]);
|
||||
|
||||
$this->drupalGet('');
|
||||
$this->assertText($title, t('Block was displayed on the front page.'));
|
||||
$this->assertText($title, 'Block was displayed on the front page.');
|
||||
|
||||
$this->drupalGet('user');
|
||||
$this->assertNoText($title, t('Block was not displayed according to block visibility rules.'));
|
||||
$this->assertNoText($title, 'Block was not displayed according to block visibility rules.');
|
||||
|
||||
$this->drupalGet('USER/' . $this->admin_user->uid);
|
||||
$this->assertNoText($title, t('Block was not displayed according to block visibility rules regardless of path case.'));
|
||||
$this->assertNoText($title, 'Block was not displayed according to block visibility rules regardless of path case.');
|
||||
|
||||
// Confirm that the block is not displayed to anonymous users.
|
||||
$this->drupalLogout();
|
||||
$this->drupalGet('');
|
||||
$this->assertNoText($title, t('Block was not displayed to anonymous users.'));
|
||||
$this->assertNoText($title, 'Block was not displayed to anonymous users.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -224,15 +224,15 @@ class BlockTestCase extends DrupalWebTestCase {
|
||||
$this->drupalPost('admin/structure/block/manage/' . $block['module'] . '/' . $block['delta'] . '/configure', $edit, t('Save block'));
|
||||
|
||||
$this->drupalGet('');
|
||||
$this->assertNoText($title, t('Block was not displayed according to block visibility rules.'));
|
||||
$this->assertNoText($title, 'Block was not displayed according to block visibility rules.');
|
||||
|
||||
$this->drupalGet('user');
|
||||
$this->assertNoText($title, t('Block was not displayed according to block visibility rules regardless of path case.'));
|
||||
$this->assertNoText($title, 'Block was not displayed according to block visibility rules regardless of path case.');
|
||||
|
||||
// Confirm that the block is not displayed to anonymous users.
|
||||
$this->drupalLogout();
|
||||
$this->drupalGet('');
|
||||
$this->assertNoText($title, t('Block was not displayed to anonymous users.'));
|
||||
$this->assertNoText($title, 'Block was not displayed to anonymous users.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -270,7 +270,7 @@ class BlockTestCase extends DrupalWebTestCase {
|
||||
$this->drupalPost('user/' . $this->admin_user->uid . '/edit', $edit, t('Save'));
|
||||
|
||||
$this->drupalGet('');
|
||||
$this->assertNoText($block['title'], t('Block was not displayed according to per user block visibility setting.'));
|
||||
$this->assertNoText($block['title'], 'Block was not displayed according to per user block visibility setting.');
|
||||
|
||||
// Set the block to be customizable per user, hidden by default.
|
||||
$edit = array();
|
||||
@@ -283,7 +283,7 @@ class BlockTestCase extends DrupalWebTestCase {
|
||||
$this->drupalPost('user/' . $this->admin_user->uid . '/edit', $edit, t('Save'));
|
||||
|
||||
$this->drupalGet('');
|
||||
$this->assertText($block['title'], t('Block was displayed according to per user block visibility setting.'));
|
||||
$this->assertText($block['title'], 'Block was displayed according to per user block visibility setting.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -298,14 +298,14 @@ class BlockTestCase extends DrupalWebTestCase {
|
||||
|
||||
// Set block title to confirm that interface works and override any custom titles.
|
||||
$this->drupalPost('admin/structure/block/manage/' . $block['module'] . '/' . $block['delta'] . '/configure', array('title' => $block['title']), t('Save block'));
|
||||
$this->assertText(t('The block configuration has been saved.'), t('Block title set.'));
|
||||
$this->assertText(t('The block configuration has been saved.'), 'Block title set.');
|
||||
$bid = db_query("SELECT bid FROM {block} WHERE module = :module AND delta = :delta", array(
|
||||
':module' => $block['module'],
|
||||
':delta' => $block['delta'],
|
||||
))->fetchField();
|
||||
|
||||
// Check to see if the block was created by checking that it's in the database.
|
||||
$this->assertNotNull($bid, t('Block found in database'));
|
||||
$this->assertNotNull($bid, 'Block found in database');
|
||||
|
||||
// Check whether the block can be moved to all available regions.
|
||||
foreach ($this->regions as $region) {
|
||||
@@ -318,21 +318,21 @@ class BlockTestCase extends DrupalWebTestCase {
|
||||
$this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
|
||||
|
||||
// Confirm that the block was moved to the proper region.
|
||||
$this->assertText(t('The block settings have been updated.'), t('Block successfully move to disabled region.'));
|
||||
$this->assertNoText(t($block['title']), t('Block no longer appears on page.'));
|
||||
$this->assertText(t('The block settings have been updated.'), 'Block successfully move to disabled region.');
|
||||
$this->assertNoText(t($block['title']), 'Block no longer appears on page.');
|
||||
|
||||
// Confirm that the region's xpath is not available.
|
||||
$xpath = $this->buildXPathQuery('//div[@id=:id]/*', array(':id' => 'block-block-' . $bid));
|
||||
$this->assertNoFieldByXPath($xpath, FALSE, t('Custom block found in no regions.'));
|
||||
$this->assertNoFieldByXPath($xpath, FALSE, 'Custom block found in no regions.');
|
||||
|
||||
// For convenience of developers, put the navigation block back.
|
||||
$edit = array();
|
||||
$edit['blocks[' . $block['module'] . '_' . $block['delta'] . '][region]'] = $this->regions[1];
|
||||
$this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
|
||||
$this->assertText(t('The block settings have been updated.'), t('Block successfully move to first sidebar region.'));
|
||||
$this->assertText(t('The block settings have been updated.'), 'Block successfully move to first sidebar region.');
|
||||
|
||||
$this->drupalPost('admin/structure/block/manage/' . $block['module'] . '/' . $block['delta'] . '/configure', array('title' => 'Navigation'), t('Save block'));
|
||||
$this->assertText(t('The block configuration has been saved.'), t('Block title set.'));
|
||||
$this->assertText(t('The block configuration has been saved.'), 'Block title set.');
|
||||
}
|
||||
|
||||
function moveBlockToRegion($block, $region) {
|
||||
@@ -342,18 +342,18 @@ class BlockTestCase extends DrupalWebTestCase {
|
||||
$this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
|
||||
|
||||
// Confirm that the block was moved to the proper region.
|
||||
$this->assertText(t('The block settings have been updated.'), t('Block successfully moved to %region_name region.', array( '%region_name' => $region)));
|
||||
$this->assertText(t('The block settings have been updated.'), format_string('Block successfully moved to %region_name region.', array( '%region_name' => $region)));
|
||||
|
||||
// Confirm that the block is being displayed.
|
||||
$this->drupalGet('node');
|
||||
$this->assertText(t($block['title']), t('Block successfully being displayed on the page.'));
|
||||
$this->assertText(t($block['title']), 'Block successfully being displayed on the page.');
|
||||
|
||||
// Confirm that the custom block was found at the proper region.
|
||||
$xpath = $this->buildXPathQuery('//div[@class=:region-class]//div[@id=:block-id]/*', array(
|
||||
':region-class' => 'region region-' . str_replace('_', '-', $region),
|
||||
':block-id' => 'block-' . $block['module'] . '-' . $block['delta'],
|
||||
));
|
||||
$this->assertFieldByXPath($xpath, NULL, t('Custom block found in %region_name region.', array('%region_name' => $region)));
|
||||
$this->assertFieldByXPath($xpath, NULL, format_string('Custom block found in %region_name region.', array('%region_name' => $region)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -361,14 +361,14 @@ class BlockTestCase extends DrupalWebTestCase {
|
||||
*/
|
||||
function testBlockRehash() {
|
||||
module_enable(array('block_test'));
|
||||
$this->assertTrue(module_exists('block_test'), t('Test block module enabled.'));
|
||||
$this->assertTrue(module_exists('block_test'), 'Test block module enabled.');
|
||||
|
||||
// Our new block should be inserted in the database when we visit the
|
||||
// block management page.
|
||||
$this->drupalGet('admin/structure/block');
|
||||
// Our test block's caching should default to DRUPAL_CACHE_PER_ROLE.
|
||||
$current_caching = db_query("SELECT cache FROM {block} WHERE module = 'block_test' AND delta = 'test_cache'")->fetchField();
|
||||
$this->assertEqual($current_caching, DRUPAL_CACHE_PER_ROLE, t('Test block cache mode defaults to DRUPAL_CACHE_PER_ROLE.'));
|
||||
$this->assertEqual($current_caching, DRUPAL_CACHE_PER_ROLE, 'Test block cache mode defaults to DRUPAL_CACHE_PER_ROLE.');
|
||||
|
||||
// Disable caching for this block.
|
||||
variable_set('block_test_caching', DRUPAL_NO_CACHE);
|
||||
@@ -376,7 +376,7 @@ class BlockTestCase extends DrupalWebTestCase {
|
||||
drupal_flush_all_caches();
|
||||
// Verify that the database is updated with the new caching mode.
|
||||
$current_caching = db_query("SELECT cache FROM {block} WHERE module = 'block_test' AND delta = 'test_cache'")->fetchField();
|
||||
$this->assertEqual($current_caching, DRUPAL_NO_CACHE, t("Test block's database entry updated to DRUPAL_NO_CACHE."));
|
||||
$this->assertEqual($current_caching, DRUPAL_NO_CACHE, "Test block's database entry updated to DRUPAL_NO_CACHE.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -427,7 +427,7 @@ class NewDefaultThemeBlocks extends DrupalWebTestCase {
|
||||
$themes['admin'] = $admin_theme;
|
||||
}
|
||||
$count = db_query_range('SELECT 1 FROM {block} WHERE theme NOT IN (:themes)', 0, 1, array(':themes' => $themes))->fetchField();
|
||||
$this->assertFalse($count, t('Only the default theme and the admin theme have blocks.'));
|
||||
$this->assertFalse($count, 'Only the default theme and the admin theme have blocks.');
|
||||
|
||||
// Populate list of all blocks for matching against new theme.
|
||||
$blocks = array();
|
||||
@@ -445,7 +445,7 @@ class NewDefaultThemeBlocks extends DrupalWebTestCase {
|
||||
$result = db_query('SELECT * FROM {block} WHERE theme = :theme', array(':theme' => 'stark'));
|
||||
foreach ($result as $block) {
|
||||
unset($block->theme, $block->bid);
|
||||
$this->assertEqual($blocks[$block->module][$block->delta], $block, t('Block %name matched', array('%name' => $block->module . '-' . $block->delta)));
|
||||
$this->assertEqual($blocks[$block->module][$block->delta], $block, format_string('Block %name matched', array('%name' => $block->module . '-' . $block->delta)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -472,13 +472,13 @@ class BlockAdminThemeTestCase extends DrupalWebTestCase {
|
||||
|
||||
// Ensure that access to block admin page is denied when theme is disabled.
|
||||
$this->drupalGet('admin/structure/block/list/stark');
|
||||
$this->assertResponse(403, t('The block admin page for a disabled theme can not be accessed'));
|
||||
$this->assertResponse(403, 'The block admin page for a disabled theme can not be accessed');
|
||||
|
||||
// Enable admin theme and confirm that tab is accessible.
|
||||
$edit['admin_theme'] = 'stark';
|
||||
$this->drupalPost('admin/appearance', $edit, t('Save configuration'));
|
||||
$this->drupalGet('admin/structure/block/list/stark');
|
||||
$this->assertResponse(200, t('The block admin page for the admin theme can be accessed'));
|
||||
$this->assertResponse(200, 'The block admin page for the admin theme can be accessed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -532,20 +532,20 @@ class BlockCacheTestCase extends DrupalWebTestCase {
|
||||
variable_set('block_test_content', $current_content);
|
||||
$this->drupalLogin($this->normal_user);
|
||||
$this->drupalGet('');
|
||||
$this->assertText($current_content, t('Block content displays.'));
|
||||
$this->assertText($current_content, 'Block content displays.');
|
||||
|
||||
// Change the content, but the cached copy should still be served.
|
||||
$old_content = $current_content;
|
||||
$current_content = $this->randomName();
|
||||
variable_set('block_test_content', $current_content);
|
||||
$this->drupalGet('');
|
||||
$this->assertText($old_content, t('Block is served from the cache.'));
|
||||
$this->assertText($old_content, 'Block is served from the cache.');
|
||||
|
||||
// Clear the cache and verify that the stale data is no longer there.
|
||||
cache_clear_all();
|
||||
$this->drupalGet('');
|
||||
$this->assertNoText($old_content, t('Block cache clear removes stale cache data.'));
|
||||
$this->assertText($current_content, t('Fresh block content is displayed after clearing the cache.'));
|
||||
$this->assertNoText($old_content, 'Block cache clear removes stale cache data.');
|
||||
$this->assertText($current_content, 'Fresh block content is displayed after clearing the cache.');
|
||||
|
||||
// Test whether the cached data is served for the correct users.
|
||||
$old_content = $current_content;
|
||||
@@ -553,19 +553,19 @@ class BlockCacheTestCase extends DrupalWebTestCase {
|
||||
variable_set('block_test_content', $current_content);
|
||||
$this->drupalLogout();
|
||||
$this->drupalGet('');
|
||||
$this->assertNoText($old_content, t('Anonymous user does not see content cached per-role for normal user.'));
|
||||
$this->assertNoText($old_content, 'Anonymous user does not see content cached per-role for normal user.');
|
||||
|
||||
$this->drupalLogin($this->normal_user_alt);
|
||||
$this->drupalGet('');
|
||||
$this->assertText($old_content, t('User with the same roles sees per-role cached content.'));
|
||||
$this->assertText($old_content, 'User with the same roles sees per-role cached content.');
|
||||
|
||||
$this->drupalLogin($this->admin_user);
|
||||
$this->drupalGet('');
|
||||
$this->assertNoText($old_content, t('Admin user does not see content cached per-role for normal user.'));
|
||||
$this->assertNoText($old_content, 'Admin user does not see content cached per-role for normal user.');
|
||||
|
||||
$this->drupalLogin($this->normal_user);
|
||||
$this->drupalGet('');
|
||||
$this->assertText($old_content, t('Block is served from the per-role cache.'));
|
||||
$this->assertText($old_content, 'Block is served from the per-role cache.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -577,7 +577,7 @@ class BlockCacheTestCase extends DrupalWebTestCase {
|
||||
variable_set('block_test_content', $current_content);
|
||||
|
||||
$this->drupalGet('');
|
||||
$this->assertText($current_content, t('Block content displays.'));
|
||||
$this->assertText($current_content, 'Block content displays.');
|
||||
|
||||
$old_content = $current_content;
|
||||
$current_content = $this->randomName();
|
||||
@@ -585,7 +585,7 @@ class BlockCacheTestCase extends DrupalWebTestCase {
|
||||
|
||||
$this->drupalLogout();
|
||||
$this->drupalGet('user');
|
||||
$this->assertText($old_content, t('Block content served from global cache.'));
|
||||
$this->assertText($old_content, 'Block content served from global cache.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -598,13 +598,13 @@ class BlockCacheTestCase extends DrupalWebTestCase {
|
||||
|
||||
// If DRUPAL_NO_CACHE has no effect, the next request would be cached.
|
||||
$this->drupalGet('');
|
||||
$this->assertText($current_content, t('Block content displays.'));
|
||||
$this->assertText($current_content, 'Block content displays.');
|
||||
|
||||
// A cached copy should not be served.
|
||||
$current_content = $this->randomName();
|
||||
variable_set('block_test_content', $current_content);
|
||||
$this->drupalGet('');
|
||||
$this->assertText($current_content, t('DRUPAL_NO_CACHE prevents blocks from being cached.'));
|
||||
$this->assertText($current_content, 'DRUPAL_NO_CACHE prevents blocks from being cached.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -617,22 +617,22 @@ class BlockCacheTestCase extends DrupalWebTestCase {
|
||||
$this->drupalLogin($this->normal_user);
|
||||
|
||||
$this->drupalGet('');
|
||||
$this->assertText($current_content, t('Block content displays.'));
|
||||
$this->assertText($current_content, 'Block content displays.');
|
||||
|
||||
$old_content = $current_content;
|
||||
$current_content = $this->randomName();
|
||||
variable_set('block_test_content', $current_content);
|
||||
|
||||
$this->drupalGet('');
|
||||
$this->assertText($old_content, t('Block is served from per-user cache.'));
|
||||
$this->assertText($old_content, 'Block is served from per-user cache.');
|
||||
|
||||
$this->drupalLogin($this->normal_user_alt);
|
||||
$this->drupalGet('');
|
||||
$this->assertText($current_content, t('Per-user block cache is not served for other users.'));
|
||||
$this->assertText($current_content, 'Per-user block cache is not served for other users.');
|
||||
|
||||
$this->drupalLogin($this->normal_user);
|
||||
$this->drupalGet('');
|
||||
$this->assertText($old_content, t('Per-user block cache is persistent.'));
|
||||
$this->assertText($old_content, 'Per-user block cache is persistent.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -644,16 +644,16 @@ class BlockCacheTestCase extends DrupalWebTestCase {
|
||||
variable_set('block_test_content', $current_content);
|
||||
|
||||
$this->drupalGet('node');
|
||||
$this->assertText($current_content, t('Block content displays on the node page.'));
|
||||
$this->assertText($current_content, 'Block content displays on the node page.');
|
||||
|
||||
$old_content = $current_content;
|
||||
$current_content = $this->randomName();
|
||||
variable_set('block_test_content', $current_content);
|
||||
|
||||
$this->drupalGet('user');
|
||||
$this->assertNoText($old_content, t('Block content cached for the node page does not show up for the user page.'));
|
||||
$this->assertNoText($old_content, 'Block content cached for the node page does not show up for the user page.');
|
||||
$this->drupalGet('node');
|
||||
$this->assertText($old_content, t('Block content cached for the node page.'));
|
||||
$this->assertText($old_content, 'Block content cached for the node page.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -706,7 +706,7 @@ class BlockHTMLIdTestCase extends DrupalWebTestCase {
|
||||
*/
|
||||
function testHTMLId() {
|
||||
$this->drupalGet('');
|
||||
$this->assertRaw('block-block-test-test-html-id', t('HTML id for test block is valid.'));
|
||||
$this->assertRaw('block-block-test-test-html-id', 'HTML id for test block is valid.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -736,7 +736,7 @@ class BlockTemplateSuggestionsUnitTest extends DrupalUnitTestCase {
|
||||
$variables1['elements']['#block'] = $block1;
|
||||
$variables1['elements']['#children'] = '';
|
||||
template_preprocess_block($variables1);
|
||||
$this->assertEqual($variables1['theme_hook_suggestions'], array('block__footer', 'block__block', 'block__block__underscore_test'), t('Found expected block suggestions for delta with underscore'));
|
||||
$this->assertEqual($variables1['theme_hook_suggestions'], array('block__footer', 'block__block', 'block__block__underscore_test'), 'Found expected block suggestions for delta with underscore');
|
||||
|
||||
// Define block delta with hyphens to be preprocessed. Hyphens should be
|
||||
// replaced with underscores.
|
||||
@@ -748,7 +748,7 @@ class BlockTemplateSuggestionsUnitTest extends DrupalUnitTestCase {
|
||||
$variables2['elements']['#block'] = $block2;
|
||||
$variables2['elements']['#children'] = '';
|
||||
template_preprocess_block($variables2);
|
||||
$this->assertEqual($variables2['theme_hook_suggestions'], array('block__footer', 'block__block', 'block__block__hyphen_test'), t('Hyphens (-) in block delta were replaced by underscore (_)'));
|
||||
$this->assertEqual($variables2['theme_hook_suggestions'], array('block__footer', 'block__block', 'block__block__hyphen_test'), 'Hyphens (-) in block delta were replaced by underscore (_)');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -784,11 +784,11 @@ class BlockHiddenRegionTestCase extends DrupalWebTestCase {
|
||||
|
||||
// Ensure that "block_test_theme" is set as the default theme.
|
||||
$this->drupalGet('admin/structure/block');
|
||||
$this->assertText('Block test theme(' . t('active tab') . ')', t('Default local task on blocks admin page is the block test theme.'));
|
||||
$this->assertText('Block test theme(' . t('active tab') . ')', 'Default local task on blocks admin page is the block test theme.');
|
||||
|
||||
// Ensure that the search form block is displayed.
|
||||
$this->drupalGet('');
|
||||
$this->assertText('Search form', t('Block was displayed on the front page.'));
|
||||
$this->assertText('Search form', 'Block was displayed on the front page.');
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -13,8 +13,8 @@ regions[footer] = Footer
|
||||
regions[highlighted] = Highlighted
|
||||
regions[help] = Help
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
files[] = blog.test
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -278,5 +278,5 @@ function theme_book_admin_table($variables) {
|
||||
$rows[] = $row;
|
||||
}
|
||||
|
||||
return theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'book-outline')));
|
||||
return theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'book-outline'), 'empty' => t('No book content available.')));
|
||||
}
|
||||
|
@@ -7,8 +7,8 @@ files[] = book.test
|
||||
configure = admin/content/book/settings
|
||||
stylesheets[all][] = book.css
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -1,3 +1,9 @@
|
||||
/**
|
||||
* @file
|
||||
* Javascript behaviors for the Book module.
|
||||
*/
|
||||
|
||||
|
||||
(function ($) {
|
||||
|
||||
Drupal.behaviors.bookFieldsetSummaries = {
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
files[] = color.test
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -32,7 +32,8 @@
|
||||
* into a string within the variable $classes.
|
||||
*
|
||||
* @see template_preprocess_comment_wrapper()
|
||||
* @see theme_comment_wrapper()
|
||||
*
|
||||
* @ingroup themeable
|
||||
*/
|
||||
?>
|
||||
<div id="comments" class="<?php print $classes; ?>"<?php print $attributes; ?>>
|
||||
|
@@ -9,8 +9,8 @@ files[] = comment.test
|
||||
configure = admin/content/comment
|
||||
stylesheets[all][] = comment.css
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -152,7 +152,7 @@ function comment_node_type_load($name) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Entity uri callback.
|
||||
* Entity URI callback.
|
||||
*/
|
||||
function comment_uri($comment) {
|
||||
return array(
|
||||
@@ -992,6 +992,14 @@ function comment_build_content($comment, $node, $view_mode = 'full', $langcode =
|
||||
// Remove previously built content, if exists.
|
||||
$comment->content = array();
|
||||
|
||||
// Allow modules to change the view mode.
|
||||
$context = array(
|
||||
'entity_type' => 'comment',
|
||||
'entity' => $comment,
|
||||
'langcode' => $langcode,
|
||||
);
|
||||
drupal_alter('entity_view_mode', $view_mode, $context);
|
||||
|
||||
// Build fields content.
|
||||
field_attach_prepare_view('comment', array($comment->cid => $comment), $view_mode, $langcode);
|
||||
entity_prepare_view('comment', array($comment->cid => $comment), $langcode);
|
||||
@@ -1013,6 +1021,10 @@ function comment_build_content($comment, $node, $view_mode = 'full', $langcode =
|
||||
// Allow modules to make their own additions to the comment.
|
||||
module_invoke_all('comment_view', $comment, $view_mode, $langcode);
|
||||
module_invoke_all('entity_view', $comment, 'comment', $view_mode, $langcode);
|
||||
|
||||
// Make sure the current view mode is stored if no module has already
|
||||
// populated the related key.
|
||||
$comment->content += array('#view_mode' => $view_mode);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2375,7 +2387,6 @@ function theme_comment_post_forbidden($variables) {
|
||||
* Process variables for comment-wrapper.tpl.php.
|
||||
*
|
||||
* @see comment-wrapper.tpl.php
|
||||
* @see theme_comment_wrapper()
|
||||
*/
|
||||
function template_preprocess_comment_wrapper(&$variables) {
|
||||
// Provide contextual information.
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @file
|
||||
* Tests for comment.module.
|
||||
*/
|
||||
|
||||
@@ -48,7 +48,7 @@ class CommentHelperCase extends DrupalWebTestCase {
|
||||
$edit['subject'] = $subject;
|
||||
}
|
||||
else {
|
||||
$this->assertNoFieldByName('subject', '', t('Subject field not found.'));
|
||||
$this->assertNoFieldByName('subject', '', 'Subject field not found.');
|
||||
}
|
||||
|
||||
if ($contact !== NULL && is_array($contact)) {
|
||||
@@ -57,19 +57,19 @@ class CommentHelperCase extends DrupalWebTestCase {
|
||||
switch ($preview_mode) {
|
||||
case DRUPAL_REQUIRED:
|
||||
// Preview required so no save button should be found.
|
||||
$this->assertNoFieldByName('op', t('Save'), t('Save button not found.'));
|
||||
$this->assertNoFieldByName('op', t('Save'), 'Save button not found.');
|
||||
$this->drupalPost(NULL, $edit, t('Preview'));
|
||||
// Don't break here so that we can test post-preview field presence and
|
||||
// function below.
|
||||
case DRUPAL_OPTIONAL:
|
||||
$this->assertFieldByName('op', t('Preview'), t('Preview button found.'));
|
||||
$this->assertFieldByName('op', t('Save'), t('Save button found.'));
|
||||
$this->assertFieldByName('op', t('Preview'), 'Preview button found.');
|
||||
$this->assertFieldByName('op', t('Save'), 'Save button found.');
|
||||
$this->drupalPost(NULL, $edit, t('Save'));
|
||||
break;
|
||||
|
||||
case DRUPAL_DISABLED:
|
||||
$this->assertNoFieldByName('op', t('Preview'), t('Preview button not found.'));
|
||||
$this->assertFieldByName('op', t('Save'), t('Save button found.'));
|
||||
$this->assertNoFieldByName('op', t('Preview'), 'Preview button not found.');
|
||||
$this->assertFieldByName('op', t('Save'), 'Save button found.');
|
||||
$this->drupalPost(NULL, $edit, t('Save'));
|
||||
break;
|
||||
}
|
||||
@@ -83,7 +83,7 @@ class CommentHelperCase extends DrupalWebTestCase {
|
||||
$this->assertText($subject, 'Comment subject posted.');
|
||||
}
|
||||
$this->assertText($comment, 'Comment body posted.');
|
||||
$this->assertTrue((!empty($match) && !empty($match[1])), t('Comment id found.'));
|
||||
$this->assertTrue((!empty($match) && !empty($match[1])), 'Comment id found.');
|
||||
}
|
||||
|
||||
if (isset($match[1])) {
|
||||
@@ -122,7 +122,7 @@ class CommentHelperCase extends DrupalWebTestCase {
|
||||
*/
|
||||
function deleteComment($comment) {
|
||||
$this->drupalPost('comment/' . $comment->id . '/delete', array(), t('Delete'));
|
||||
$this->assertText(t('The comment and all its replies have been deleted.'), t('Comment deleted.'));
|
||||
$this->assertText(t('The comment and all its replies have been deleted.'), 'Comment deleted.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -200,7 +200,8 @@ class CommentHelperCase extends DrupalWebTestCase {
|
||||
*/
|
||||
function setCommentSettings($name, $value, $message) {
|
||||
variable_set($name . '_article', $value);
|
||||
$this->assertTrue(TRUE, t($message)); // Display status message.
|
||||
// Display status message.
|
||||
$this->assertTrue(TRUE, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -230,10 +231,10 @@ class CommentHelperCase extends DrupalWebTestCase {
|
||||
|
||||
if ($operation == 'delete') {
|
||||
$this->drupalPost(NULL, array(), t('Delete comments'));
|
||||
$this->assertRaw(format_plural(1, 'Deleted 1 comment.', 'Deleted @count comments.'), t('Operation "' . $operation . '" was performed on comment.'));
|
||||
$this->assertRaw(format_plural(1, 'Deleted 1 comment.', 'Deleted @count comments.'), format_string('Operation @operation was performed on comment.', array('@operation' => $operation)));
|
||||
}
|
||||
else {
|
||||
$this->assertText(t('The update has been performed.'), t('Operation "' . $operation . '" was performed on comment.'));
|
||||
$this->assertText(t('The update has been performed.'), format_string('Operation @operation was performed on comment.', array('@operation' => $operation)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -280,7 +281,7 @@ class CommentInterfaceTest extends CommentHelperCase {
|
||||
$comment_text = $this->randomName();
|
||||
$comment = $this->postComment($this->node, $comment_text);
|
||||
$comment_loaded = comment_load($comment->id);
|
||||
$this->assertTrue($this->commentExists($comment), t('Comment found.'));
|
||||
$this->assertTrue($this->commentExists($comment), 'Comment found.');
|
||||
|
||||
// Set comments to have subject and preview to required.
|
||||
$this->drupalLogout();
|
||||
@@ -295,12 +296,12 @@ class CommentInterfaceTest extends CommentHelperCase {
|
||||
$comment_text = $this->randomName();
|
||||
$comment = $this->postComment($this->node, $comment_text, $subject_text, TRUE);
|
||||
$comment_loaded = comment_load($comment->id);
|
||||
$this->assertTrue($this->commentExists($comment), t('Comment found.'));
|
||||
$this->assertTrue($this->commentExists($comment), 'Comment found.');
|
||||
|
||||
// Check comment display.
|
||||
$this->drupalGet('node/' . $this->node->nid . '/' . $comment->id);
|
||||
$this->assertText($subject_text, t('Individual comment subject found.'));
|
||||
$this->assertText($comment_text, t('Individual comment body found.'));
|
||||
$this->assertText($subject_text, 'Individual comment subject found.');
|
||||
$this->assertText($comment_text, 'Individual comment body found.');
|
||||
|
||||
// Set comments to have subject and preview to optional.
|
||||
$this->drupalLogout();
|
||||
@@ -312,20 +313,20 @@ class CommentInterfaceTest extends CommentHelperCase {
|
||||
$this->drupalGet('comment/' . $comment->id . '/edit');
|
||||
$comment = $this->postComment(NULL, $comment->comment, $comment->subject, array('name' => ''));
|
||||
$comment_loaded = comment_load($comment->id);
|
||||
$this->assertTrue(empty($comment_loaded->name) && $comment_loaded->uid == 0, t('Comment author successfully changed to anonymous.'));
|
||||
$this->assertTrue(empty($comment_loaded->name) && $comment_loaded->uid == 0, 'Comment author successfully changed to anonymous.');
|
||||
|
||||
// Test changing the comment author to an unverified user.
|
||||
$random_name = $this->randomName();
|
||||
$this->drupalGet('comment/' . $comment->id . '/edit');
|
||||
$comment = $this->postComment(NULL, $comment->comment, $comment->subject, array('name' => $random_name));
|
||||
$this->drupalGet('node/' . $this->node->nid);
|
||||
$this->assertText($random_name . ' (' . t('not verified') . ')', t('Comment author successfully changed to an unverified user.'));
|
||||
$this->assertText($random_name . ' (' . t('not verified') . ')', 'Comment author successfully changed to an unverified user.');
|
||||
|
||||
// Test changing the comment author to a verified user.
|
||||
$this->drupalGet('comment/' . $comment->id . '/edit');
|
||||
$comment = $this->postComment(NULL, $comment->comment, $comment->subject, array('name' => $this->web_user->name));
|
||||
$comment_loaded = comment_load($comment->id);
|
||||
$this->assertTrue($comment_loaded->name == $this->web_user->name && $comment_loaded->uid == $this->web_user->uid, t('Comment author successfully changed to a registered user.'));
|
||||
$this->assertTrue($comment_loaded->name == $this->web_user->name && $comment_loaded->uid == $this->web_user->uid, 'Comment author successfully changed to a registered user.');
|
||||
|
||||
$this->drupalLogout();
|
||||
|
||||
@@ -333,60 +334,60 @@ class CommentInterfaceTest extends CommentHelperCase {
|
||||
// subject though field enabled.
|
||||
$this->drupalLogin($this->web_user);
|
||||
$this->drupalGet('comment/reply/' . $this->node->nid . '/' . $comment->id);
|
||||
$this->assertText($subject_text, t('Individual comment-reply subject found.'));
|
||||
$this->assertText($comment_text, t('Individual comment-reply body found.'));
|
||||
$this->assertText($subject_text, 'Individual comment-reply subject found.');
|
||||
$this->assertText($comment_text, 'Individual comment-reply body found.');
|
||||
$reply = $this->postComment(NULL, $this->randomName(), '', TRUE);
|
||||
$reply_loaded = comment_load($reply->id);
|
||||
$this->assertTrue($this->commentExists($reply, TRUE), t('Reply found.'));
|
||||
$this->assertEqual($comment->id, $reply_loaded->pid, t('Pid of a reply to a comment is set correctly.'));
|
||||
$this->assertEqual(rtrim($comment_loaded->thread, '/') . '.00/', $reply_loaded->thread, t('Thread of reply grows correctly.'));
|
||||
$this->assertTrue($this->commentExists($reply, TRUE), 'Reply found.');
|
||||
$this->assertEqual($comment->id, $reply_loaded->pid, 'Pid of a reply to a comment is set correctly.');
|
||||
$this->assertEqual(rtrim($comment_loaded->thread, '/') . '.00/', $reply_loaded->thread, 'Thread of reply grows correctly.');
|
||||
|
||||
// Second reply to comment #3 creating comment #4.
|
||||
$this->drupalGet('comment/reply/' . $this->node->nid . '/' . $comment->id);
|
||||
$this->assertText($subject_text, t('Individual comment-reply subject found.'));
|
||||
$this->assertText($comment_text, t('Individual comment-reply body found.'));
|
||||
$this->assertText($subject_text, 'Individual comment-reply subject found.');
|
||||
$this->assertText($comment_text, 'Individual comment-reply body found.');
|
||||
$reply = $this->postComment(NULL, $this->randomName(), $this->randomName(), TRUE);
|
||||
$reply_loaded = comment_load($reply->id);
|
||||
$this->assertTrue($this->commentExists($reply, TRUE), t('Second reply found.'));
|
||||
$this->assertEqual(rtrim($comment_loaded->thread, '/') . '.01/', $reply_loaded->thread, t('Thread of second reply grows correctly.'));
|
||||
$this->assertTrue($this->commentExists($reply, TRUE), 'Second reply found.');
|
||||
$this->assertEqual(rtrim($comment_loaded->thread, '/') . '.01/', $reply_loaded->thread, 'Thread of second reply grows correctly.');
|
||||
|
||||
// Edit reply.
|
||||
$this->drupalGet('comment/' . $reply->id . '/edit');
|
||||
$reply = $this->postComment(NULL, $this->randomName(), $this->randomName(), TRUE);
|
||||
$this->assertTrue($this->commentExists($reply, TRUE), t('Modified reply found.'));
|
||||
$this->assertTrue($this->commentExists($reply, TRUE), 'Modified reply found.');
|
||||
|
||||
// Correct link count
|
||||
$this->drupalGet('node');
|
||||
$this->assertRaw('4 comments', t('Link to the 4 comments exist.'));
|
||||
$this->assertRaw('4 comments', 'Link to the 4 comments exist.');
|
||||
|
||||
// Confirm a new comment is posted to the correct page.
|
||||
$this->setCommentsPerPage(2);
|
||||
$comment_new_page = $this->postComment($this->node, $this->randomName(), $this->randomName(), TRUE);
|
||||
$this->assertTrue($this->commentExists($comment_new_page), t('Page one exists. %s'));
|
||||
$this->assertTrue($this->commentExists($comment_new_page), 'Page one exists. %s');
|
||||
$this->drupalGet('node/' . $this->node->nid, array('query' => array('page' => 1)));
|
||||
$this->assertTrue($this->commentExists($reply, TRUE), t('Page two exists. %s'));
|
||||
$this->assertTrue($this->commentExists($reply, TRUE), 'Page two exists. %s');
|
||||
$this->setCommentsPerPage(50);
|
||||
|
||||
// Attempt to post to node with comments disabled.
|
||||
$this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'comment' => COMMENT_NODE_HIDDEN));
|
||||
$this->assertTrue($this->node, t('Article node created.'));
|
||||
$this->assertTrue($this->node, 'Article node created.');
|
||||
$this->drupalGet('comment/reply/' . $this->node->nid);
|
||||
$this->assertText('This discussion is closed', t('Posting to node with comments disabled'));
|
||||
$this->assertNoField('edit-comment', t('Comment body field found.'));
|
||||
$this->assertText('This discussion is closed', 'Posting to node with comments disabled');
|
||||
$this->assertNoField('edit-comment', 'Comment body field found.');
|
||||
|
||||
// Attempt to post to node with read-only comments.
|
||||
$this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'comment' => COMMENT_NODE_CLOSED));
|
||||
$this->assertTrue($this->node, t('Article node created.'));
|
||||
$this->assertTrue($this->node, 'Article node created.');
|
||||
$this->drupalGet('comment/reply/' . $this->node->nid);
|
||||
$this->assertText('This discussion is closed', t('Posting to node with comments read-only'));
|
||||
$this->assertNoField('edit-comment', t('Comment body field found.'));
|
||||
$this->assertText('This discussion is closed', 'Posting to node with comments read-only');
|
||||
$this->assertNoField('edit-comment', 'Comment body field found.');
|
||||
|
||||
// Attempt to post to node with comments enabled (check field names etc).
|
||||
$this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'comment' => COMMENT_NODE_OPEN));
|
||||
$this->assertTrue($this->node, t('Article node created.'));
|
||||
$this->assertTrue($this->node, 'Article node created.');
|
||||
$this->drupalGet('comment/reply/' . $this->node->nid);
|
||||
$this->assertNoText('This discussion is closed', t('Posting to node with comments enabled'));
|
||||
$this->assertField('edit-comment-body-' . $langcode . '-0-value', t('Comment body field found.'));
|
||||
$this->assertNoText('This discussion is closed', 'Posting to node with comments enabled');
|
||||
$this->assertField('edit-comment-body-' . $langcode . '-0-value', 'Comment body field found.');
|
||||
|
||||
// Delete comment and make sure that reply is also removed.
|
||||
$this->drupalLogout();
|
||||
@@ -395,8 +396,8 @@ class CommentInterfaceTest extends CommentHelperCase {
|
||||
$this->deleteComment($comment_new_page);
|
||||
|
||||
$this->drupalGet('node/' . $this->node->nid);
|
||||
$this->assertFalse($this->commentExists($comment), t('Comment not found.'));
|
||||
$this->assertFalse($this->commentExists($reply, TRUE), t('Reply not found.'));
|
||||
$this->assertFalse($this->commentExists($comment), 'Comment not found.');
|
||||
$this->assertFalse($this->commentExists($reply, TRUE), 'Reply not found.');
|
||||
|
||||
// Enabled comment form on node page.
|
||||
$this->drupalLogin($this->admin_user);
|
||||
@@ -407,7 +408,7 @@ class CommentInterfaceTest extends CommentHelperCase {
|
||||
$this->drupalLogin($this->web_user);
|
||||
$this->drupalGet('node/' . $this->node->nid);
|
||||
$form_comment = $this->postComment(NULL, $this->randomName(), $this->randomName(), TRUE);
|
||||
$this->assertTrue($this->commentExists($form_comment), t('Form comment found.'));
|
||||
$this->assertTrue($this->commentExists($form_comment), 'Form comment found.');
|
||||
|
||||
// Disable comment form on node page.
|
||||
$this->drupalLogout();
|
||||
@@ -428,7 +429,7 @@ class CommentInterfaceTest extends CommentHelperCase {
|
||||
$this->assertNoLink(t('@count new comments', array('@count' => 0)));
|
||||
$this->assertLink(t('Read more'));
|
||||
$count = $this->xpath('//div[@id=:id]/div[@class=:class]/ul/li', array(':id' => 'node-' . $this->node->nid, ':class' => 'link-wrapper'));
|
||||
$this->assertTrue(count($count) == 1, t('One child found'));
|
||||
$this->assertTrue(count($count) == 1, 'One child found');
|
||||
|
||||
// Create a new comment. This helper function may be run with different
|
||||
// comment settings so use comment_save() to avoid complex setup.
|
||||
@@ -452,8 +453,8 @@ class CommentInterfaceTest extends CommentHelperCase {
|
||||
$this->drupalGet('node');
|
||||
$this->assertLink(t('1 new comment'));
|
||||
$this->clickLink(t('1 new comment'));
|
||||
$this->assertRaw('<a id="new"></a>', t('Found "new" marker.'));
|
||||
$this->assertTrue($this->xpath('//a[@id=:new]/following-sibling::a[1][@id=:comment_id]', array(':new' => 'new', ':comment_id' => 'comment-1')), t('The "new" anchor is positioned at the right comment.'));
|
||||
$this->assertRaw('<a id="new"></a>', 'Found "new" marker.');
|
||||
$this->assertTrue($this->xpath('//a[@id=:new]/following-sibling::a[1][@id=:comment_id]', array(':new' => 'new', ':comment_id' => 'comment-1')), 'The "new" anchor is positioned at the right comment.');
|
||||
|
||||
// Test if "new comment" link is correctly removed.
|
||||
$this->drupalGet('node');
|
||||
@@ -590,10 +591,10 @@ class CommentInterfaceTest extends CommentHelperCase {
|
||||
|
||||
// Checks the initial values of node comment statistics with no comment.
|
||||
$node = node_load($this->node->nid);
|
||||
$this->assertEqual($node->last_comment_timestamp, $this->node->created, t('The initial value of node last_comment_timestamp is the node created date.'));
|
||||
$this->assertEqual($node->last_comment_name, NULL, t('The initial value of node last_comment_name is NULL.'));
|
||||
$this->assertEqual($node->last_comment_uid, $this->web_user->uid, t('The initial value of node last_comment_uid is the node uid.'));
|
||||
$this->assertEqual($node->comment_count, 0, t('The initial value of node comment_count is zero.'));
|
||||
$this->assertEqual($node->last_comment_timestamp, $this->node->created, 'The initial value of node last_comment_timestamp is the node created date.');
|
||||
$this->assertEqual($node->last_comment_name, NULL, 'The initial value of node last_comment_name is NULL.');
|
||||
$this->assertEqual($node->last_comment_uid, $this->web_user->uid, 'The initial value of node last_comment_uid is the node uid.');
|
||||
$this->assertEqual($node->comment_count, 0, 'The initial value of node comment_count is zero.');
|
||||
|
||||
// Post comment #1 as web_user2.
|
||||
$this->drupalLogin($this->web_user2);
|
||||
@@ -604,9 +605,9 @@ class CommentInterfaceTest extends CommentHelperCase {
|
||||
// Checks the new values of node comment statistics with comment #1.
|
||||
// The node needs to be reloaded with a node_load_multiple cache reset.
|
||||
$node = node_load($this->node->nid, NULL, TRUE);
|
||||
$this->assertEqual($node->last_comment_name, NULL, t('The value of node last_comment_name is NULL.'));
|
||||
$this->assertEqual($node->last_comment_uid, $this->web_user2->uid, t('The value of node last_comment_uid is the comment #1 uid.'));
|
||||
$this->assertEqual($node->comment_count, 1, t('The value of node comment_count is 1.'));
|
||||
$this->assertEqual($node->last_comment_name, NULL, 'The value of node last_comment_name is NULL.');
|
||||
$this->assertEqual($node->last_comment_uid, $this->web_user2->uid, 'The value of node last_comment_uid is the comment #1 uid.');
|
||||
$this->assertEqual($node->comment_count, 1, 'The value of node comment_count is 1.');
|
||||
|
||||
// Prepare for anonymous comment submission (comment approval enabled).
|
||||
variable_set('user_register', USER_REGISTER_VISITORS);
|
||||
@@ -629,9 +630,9 @@ class CommentInterfaceTest extends CommentHelperCase {
|
||||
// ensure they haven't changed since the comment has not been moderated.
|
||||
// The node needs to be reloaded with a node_load_multiple cache reset.
|
||||
$node = node_load($this->node->nid, NULL, TRUE);
|
||||
$this->assertEqual($node->last_comment_name, NULL, t('The value of node last_comment_name is still NULL.'));
|
||||
$this->assertEqual($node->last_comment_uid, $this->web_user2->uid, t('The value of node last_comment_uid is still the comment #1 uid.'));
|
||||
$this->assertEqual($node->comment_count, 1, t('The value of node comment_count is still 1.'));
|
||||
$this->assertEqual($node->last_comment_name, NULL, 'The value of node last_comment_name is still NULL.');
|
||||
$this->assertEqual($node->last_comment_uid, $this->web_user2->uid, 'The value of node last_comment_uid is still the comment #1 uid.');
|
||||
$this->assertEqual($node->comment_count, 1, 'The value of node comment_count is still 1.');
|
||||
|
||||
// Prepare for anonymous comment submission (no approval required).
|
||||
$this->drupalLogin($this->admin_user);
|
||||
@@ -650,9 +651,9 @@ class CommentInterfaceTest extends CommentHelperCase {
|
||||
// Checks the new values of node comment statistics with comment #3.
|
||||
// The node needs to be reloaded with a node_load_multiple cache reset.
|
||||
$node = node_load($this->node->nid, NULL, TRUE);
|
||||
$this->assertEqual($node->last_comment_name, $comment_loaded->name, t('The value of node last_comment_name is the name of the anonymous user.'));
|
||||
$this->assertEqual($node->last_comment_uid, 0, t('The value of node last_comment_uid is zero.'));
|
||||
$this->assertEqual($node->comment_count, 2, t('The value of node comment_count is 2.'));
|
||||
$this->assertEqual($node->last_comment_name, $comment_loaded->name, 'The value of node last_comment_name is the name of the anonymous user.');
|
||||
$this->assertEqual($node->last_comment_uid, 0, 'The value of node last_comment_uid is zero.');
|
||||
$this->assertEqual($node->comment_count, 2, 'The value of node comment_count is 2.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -919,10 +920,10 @@ class CommentInterfaceTest extends CommentHelperCase {
|
||||
if ($path == "node/$nid") {
|
||||
$elements = $this->xpath('//form[@id=:id]', array(':id' => 'comment-form'));
|
||||
if ($info['form'] == COMMENT_FORM_BELOW) {
|
||||
$this->assertTrue(count($elements), t('Comment form found below.'));
|
||||
$this->assertTrue(count($elements), 'Comment form found below.');
|
||||
}
|
||||
else {
|
||||
$this->assertFalse(count($elements), t('Comment form not found below.'));
|
||||
$this->assertFalse(count($elements), 'Comment form not found below.');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -974,13 +975,13 @@ class CommentPreviewTest extends CommentHelperCase {
|
||||
$this->drupalPost('node/' . $this->node->nid, $edit, t('Preview'));
|
||||
|
||||
// Check that the preview is displaying the title and body.
|
||||
$this->assertTitle(t('Preview comment | Drupal'), t('Page title is "Preview comment".'));
|
||||
$this->assertText($edit['subject'], t('Subject displayed.'));
|
||||
$this->assertText($edit['comment_body[' . $langcode . '][0][value]'], t('Comment displayed.'));
|
||||
$this->assertTitle(t('Preview comment | Drupal'), 'Page title is "Preview comment".');
|
||||
$this->assertText($edit['subject'], 'Subject displayed.');
|
||||
$this->assertText($edit['comment_body[' . $langcode . '][0][value]'], 'Comment displayed.');
|
||||
|
||||
// Check that the title and body fields are displayed with the correct values.
|
||||
$this->assertFieldByName('subject', $edit['subject'], t('Subject field displayed.'));
|
||||
$this->assertFieldByName('comment_body[' . $langcode . '][0][value]', $edit['comment_body[' . $langcode . '][0][value]'], t('Comment field displayed.'));
|
||||
$this->assertFieldByName('subject', $edit['subject'], 'Subject field displayed.');
|
||||
$this->assertFieldByName('comment_body[' . $langcode . '][0][value]', $edit['comment_body[' . $langcode . '][0][value]'], 'Comment field displayed.');
|
||||
|
||||
// Check that the signature is displaying with the correct text format.
|
||||
$this->assertLink($test_signature);
|
||||
@@ -1013,28 +1014,28 @@ class CommentPreviewTest extends CommentHelperCase {
|
||||
$this->drupalPost('comment/' . $comment->id . '/edit', $edit, t('Preview'));
|
||||
|
||||
// Check that the preview is displaying the subject, comment, author and date correctly.
|
||||
$this->assertTitle(t('Preview comment | Drupal'), t('Page title is "Preview comment".'));
|
||||
$this->assertText($edit['subject'], t('Subject displayed.'));
|
||||
$this->assertText($edit['comment_body[' . $langcode . '][0][value]'], t('Comment displayed.'));
|
||||
$this->assertText($edit['name'], t('Author displayed.'));
|
||||
$this->assertText($expected_text_date, t('Date displayed.'));
|
||||
$this->assertTitle(t('Preview comment | Drupal'), 'Page title is "Preview comment".');
|
||||
$this->assertText($edit['subject'], 'Subject displayed.');
|
||||
$this->assertText($edit['comment_body[' . $langcode . '][0][value]'], 'Comment displayed.');
|
||||
$this->assertText($edit['name'], 'Author displayed.');
|
||||
$this->assertText($expected_text_date, 'Date displayed.');
|
||||
|
||||
// Check that the subject, comment, author and date fields are displayed with the correct values.
|
||||
$this->assertFieldByName('subject', $edit['subject'], t('Subject field displayed.'));
|
||||
$this->assertFieldByName('comment_body[' . $langcode . '][0][value]', $edit['comment_body[' . $langcode . '][0][value]'], t('Comment field displayed.'));
|
||||
$this->assertFieldByName('name', $edit['name'], t('Author field displayed.'));
|
||||
$this->assertFieldByName('date', $edit['date'], t('Date field displayed.'));
|
||||
$this->assertFieldByName('subject', $edit['subject'], 'Subject field displayed.');
|
||||
$this->assertFieldByName('comment_body[' . $langcode . '][0][value]', $edit['comment_body[' . $langcode . '][0][value]'], 'Comment field displayed.');
|
||||
$this->assertFieldByName('name', $edit['name'], 'Author field displayed.');
|
||||
$this->assertFieldByName('date', $edit['date'], 'Date field displayed.');
|
||||
|
||||
// Check that saving a comment produces a success message.
|
||||
$this->drupalPost('comment/' . $comment->id . '/edit', $edit, t('Save'));
|
||||
$this->assertText(t('Your comment has been posted.'), t('Comment posted.'));
|
||||
$this->assertText(t('Your comment has been posted.'), 'Comment posted.');
|
||||
|
||||
// Check that the comment fields are correct after loading the saved comment.
|
||||
$this->drupalGet('comment/' . $comment->id . '/edit');
|
||||
$this->assertFieldByName('subject', $edit['subject'], t('Subject field displayed.'));
|
||||
$this->assertFieldByName('comment_body[' . $langcode . '][0][value]', $edit['comment_body[' . $langcode . '][0][value]'], t('Comment field displayed.'));
|
||||
$this->assertFieldByName('name', $edit['name'], t('Author field displayed.'));
|
||||
$this->assertFieldByName('date', $expected_form_date, t('Date field displayed.'));
|
||||
$this->assertFieldByName('subject', $edit['subject'], 'Subject field displayed.');
|
||||
$this->assertFieldByName('comment_body[' . $langcode . '][0][value]', $edit['comment_body[' . $langcode . '][0][value]'], 'Comment field displayed.');
|
||||
$this->assertFieldByName('name', $edit['name'], 'Author field displayed.');
|
||||
$this->assertFieldByName('date', $expected_form_date, 'Date field displayed.');
|
||||
|
||||
// Submit the form using the displayed values.
|
||||
$displayed = array();
|
||||
@@ -1046,10 +1047,10 @@ class CommentPreviewTest extends CommentHelperCase {
|
||||
|
||||
// Check that the saved comment is still correct.
|
||||
$comment_loaded = comment_load($comment->id);
|
||||
$this->assertEqual($comment_loaded->subject, $edit['subject'], t('Subject loaded.'));
|
||||
$this->assertEqual($comment_loaded->comment_body[$langcode][0]['value'], $edit['comment_body[' . $langcode . '][0][value]'], t('Comment body loaded.'));
|
||||
$this->assertEqual($comment_loaded->name, $edit['name'], t('Name loaded.'));
|
||||
$this->assertEqual($comment_loaded->created, $raw_date, t('Date loaded.'));
|
||||
$this->assertEqual($comment_loaded->subject, $edit['subject'], 'Subject loaded.');
|
||||
$this->assertEqual($comment_loaded->comment_body[$langcode][0]['value'], $edit['comment_body[' . $langcode . '][0][value]'], 'Comment body loaded.');
|
||||
$this->assertEqual($comment_loaded->name, $edit['name'], 'Name loaded.');
|
||||
$this->assertEqual($comment_loaded->created, $raw_date, 'Date loaded.');
|
||||
|
||||
}
|
||||
|
||||
@@ -1085,7 +1086,7 @@ class CommentAnonymous extends CommentHelperCase {
|
||||
|
||||
// Post anonymous comment without contact info.
|
||||
$anonymous_comment1 = $this->postComment($this->node, $this->randomName(), $this->randomName());
|
||||
$this->assertTrue($this->commentExists($anonymous_comment1), t('Anonymous comment without contact info found.'));
|
||||
$this->assertTrue($this->commentExists($anonymous_comment1), 'Anonymous comment without contact info found.');
|
||||
|
||||
// Allow contact info.
|
||||
$this->drupalLogin($this->admin_user);
|
||||
@@ -1094,15 +1095,15 @@ class CommentAnonymous extends CommentHelperCase {
|
||||
// Attempt to edit anonymous comment.
|
||||
$this->drupalGet('comment/' . $anonymous_comment1->id . '/edit');
|
||||
$edited_comment = $this->postComment(NULL, $this->randomName(), $this->randomName());
|
||||
$this->assertTrue($this->commentExists($edited_comment, FALSE), t('Modified reply found.'));
|
||||
$this->assertTrue($this->commentExists($edited_comment, FALSE), 'Modified reply found.');
|
||||
$this->drupalLogout();
|
||||
|
||||
// Post anonymous comment with contact info (optional).
|
||||
$this->drupalGet('comment/reply/' . $this->node->nid);
|
||||
$this->assertTrue($this->commentContactInfoAvailable(), t('Contact information available.'));
|
||||
$this->assertTrue($this->commentContactInfoAvailable(), 'Contact information available.');
|
||||
|
||||
$anonymous_comment2 = $this->postComment($this->node, $this->randomName(), $this->randomName());
|
||||
$this->assertTrue($this->commentExists($anonymous_comment2), t('Anonymous comment with contact info (optional) found.'));
|
||||
$this->assertTrue($this->commentExists($anonymous_comment2), 'Anonymous comment with contact info (optional) found.');
|
||||
|
||||
// Ensure anonymous users cannot post in the name of registered users.
|
||||
$langcode = LANGUAGE_NONE;
|
||||
@@ -1122,41 +1123,42 @@ class CommentAnonymous extends CommentHelperCase {
|
||||
|
||||
// Try to post comment with contact info (required).
|
||||
$this->drupalGet('comment/reply/' . $this->node->nid);
|
||||
$this->assertTrue($this->commentContactInfoAvailable(), t('Contact information available.'));
|
||||
$this->assertTrue($this->commentContactInfoAvailable(), 'Contact information available.');
|
||||
|
||||
$anonymous_comment3 = $this->postComment($this->node, $this->randomName(), $this->randomName(), TRUE);
|
||||
$this->assertText(t('E-mail field is required.'), t('E-mail required.')); // Name should have 'Anonymous' for value by default.
|
||||
$this->assertFalse($this->commentExists($anonymous_comment3), t('Anonymous comment with contact info (required) not found.'));
|
||||
// Name should have 'Anonymous' for value by default.
|
||||
$this->assertText(t('E-mail field is required.'), 'E-mail required.');
|
||||
$this->assertFalse($this->commentExists($anonymous_comment3), 'Anonymous comment with contact info (required) not found.');
|
||||
|
||||
// Post comment with contact info (required).
|
||||
$author_name = $this->randomName();
|
||||
$author_mail = $this->randomName() . '@example.com';
|
||||
$anonymous_comment3 = $this->postComment($this->node, $this->randomName(), $this->randomName(), array('name' => $author_name, 'mail' => $author_mail));
|
||||
$this->assertTrue($this->commentExists($anonymous_comment3), t('Anonymous comment with contact info (required) found.'));
|
||||
$this->assertTrue($this->commentExists($anonymous_comment3), 'Anonymous comment with contact info (required) found.');
|
||||
|
||||
// Make sure the user data appears correctly when editing the comment.
|
||||
$this->drupalLogin($this->admin_user);
|
||||
$this->drupalGet('comment/' . $anonymous_comment3->id . '/edit');
|
||||
$this->assertRaw($author_name, t("The anonymous user's name is correct when editing the comment."));
|
||||
$this->assertRaw($author_mail, t("The anonymous user's e-mail address is correct when editing the comment."));
|
||||
$this->assertRaw($author_name, "The anonymous user's name is correct when editing the comment.");
|
||||
$this->assertRaw($author_mail, "The anonymous user's e-mail address is correct when editing the comment.");
|
||||
|
||||
// Unpublish comment.
|
||||
$this->performCommentOperation($anonymous_comment3, 'unpublish');
|
||||
|
||||
$this->drupalGet('admin/content/comment/approval');
|
||||
$this->assertRaw('comments[' . $anonymous_comment3->id . ']', t('Comment was unpublished.'));
|
||||
$this->assertRaw('comments[' . $anonymous_comment3->id . ']', 'Comment was unpublished.');
|
||||
|
||||
// Publish comment.
|
||||
$this->performCommentOperation($anonymous_comment3, 'publish', TRUE);
|
||||
|
||||
$this->drupalGet('admin/content/comment');
|
||||
$this->assertRaw('comments[' . $anonymous_comment3->id . ']', t('Comment was published.'));
|
||||
$this->assertRaw('comments[' . $anonymous_comment3->id . ']', 'Comment was published.');
|
||||
|
||||
// Delete comment.
|
||||
$this->performCommentOperation($anonymous_comment3, 'delete');
|
||||
|
||||
$this->drupalGet('admin/content/comment');
|
||||
$this->assertNoRaw('comments[' . $anonymous_comment3->id . ']', t('Comment was deleted.'));
|
||||
$this->assertNoRaw('comments[' . $anonymous_comment3->id . ']', 'Comment was deleted.');
|
||||
$this->drupalLogout();
|
||||
|
||||
// Reset.
|
||||
@@ -1170,14 +1172,14 @@ class CommentAnonymous extends CommentHelperCase {
|
||||
// NOTE: if authenticated user has permission to post comments, then a
|
||||
// "Login or register to post comments" type link may be shown.
|
||||
$this->drupalGet('node/' . $this->node->nid);
|
||||
$this->assertNoPattern('@<h2[^>]*>Comments</h2>@', t('Comments were not displayed.'));
|
||||
$this->assertNoLink('Add new comment', t('Link to add comment was found.'));
|
||||
$this->assertNoPattern('@<h2[^>]*>Comments</h2>@', 'Comments were not displayed.');
|
||||
$this->assertNoLink('Add new comment', 'Link to add comment was found.');
|
||||
|
||||
// Attempt to view node-comment form while disallowed.
|
||||
$this->drupalGet('comment/reply/' . $this->node->nid);
|
||||
$this->assertText('You are not authorized to post comments', t('Error attempting to post comment.'));
|
||||
$this->assertNoFieldByName('subject', '', t('Subject field not found.'));
|
||||
$this->assertNoFieldByName("comment_body[$langcode][0][value]", '', t('Comment field not found.'));
|
||||
$this->assertText('You are not authorized to post comments', 'Error attempting to post comment.');
|
||||
$this->assertNoFieldByName('subject', '', 'Subject field not found.');
|
||||
$this->assertNoFieldByName("comment_body[$langcode][0][value]", '', 'Comment field not found.');
|
||||
|
||||
user_role_change_permissions(DRUPAL_ANONYMOUS_RID, array(
|
||||
'access comments' => TRUE,
|
||||
@@ -1185,9 +1187,9 @@ class CommentAnonymous extends CommentHelperCase {
|
||||
'skip comment approval' => FALSE,
|
||||
));
|
||||
$this->drupalGet('node/' . $this->node->nid);
|
||||
$this->assertPattern('@<h2[^>]*>Comments</h2>@', t('Comments were displayed.'));
|
||||
$this->assertLink('Log in', 1, t('Link to log in was found.'));
|
||||
$this->assertLink('register', 1, t('Link to register was found.'));
|
||||
$this->assertPattern('@<h2[^>]*>Comments</h2>@', 'Comments were displayed.');
|
||||
$this->assertLink('Log in', 1, 'Link to log in was found.');
|
||||
$this->assertLink('register', 1, 'Link to register was found.');
|
||||
|
||||
user_role_change_permissions(DRUPAL_ANONYMOUS_RID, array(
|
||||
'access comments' => FALSE,
|
||||
@@ -1195,13 +1197,13 @@ class CommentAnonymous extends CommentHelperCase {
|
||||
'skip comment approval' => TRUE,
|
||||
));
|
||||
$this->drupalGet('node/' . $this->node->nid);
|
||||
$this->assertNoPattern('@<h2[^>]*>Comments</h2>@', t('Comments were not displayed.'));
|
||||
$this->assertFieldByName('subject', '', t('Subject field found.'));
|
||||
$this->assertFieldByName("comment_body[$langcode][0][value]", '', t('Comment field found.'));
|
||||
$this->assertNoPattern('@<h2[^>]*>Comments</h2>@', 'Comments were not displayed.');
|
||||
$this->assertFieldByName('subject', '', 'Subject field found.');
|
||||
$this->assertFieldByName("comment_body[$langcode][0][value]", '', 'Comment field found.');
|
||||
|
||||
$this->drupalGet('comment/reply/' . $this->node->nid . '/' . $anonymous_comment3->id);
|
||||
$this->assertText('You are not authorized to view comments', t('Error attempting to post reply.'));
|
||||
$this->assertNoText($author_name, t('Comment not displayed.'));
|
||||
$this->assertText('You are not authorized to view comments', 'Error attempting to post reply.');
|
||||
$this->assertNoText($author_name, 'Comment not displayed.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1245,22 +1247,22 @@ class CommentPagerTest extends CommentHelperCase {
|
||||
// Check the first page of the node, and confirm the correct comments are
|
||||
// shown.
|
||||
$this->drupalGet('node/' . $node->nid);
|
||||
$this->assertRaw(t('next'), t('Paging links found.'));
|
||||
$this->assertTrue($this->commentExists($comments[0]), t('Comment 1 appears on page 1.'));
|
||||
$this->assertFalse($this->commentExists($comments[1]), t('Comment 2 does not appear on page 1.'));
|
||||
$this->assertFalse($this->commentExists($comments[2]), t('Comment 3 does not appear on page 1.'));
|
||||
$this->assertRaw(t('next'), 'Paging links found.');
|
||||
$this->assertTrue($this->commentExists($comments[0]), 'Comment 1 appears on page 1.');
|
||||
$this->assertFalse($this->commentExists($comments[1]), 'Comment 2 does not appear on page 1.');
|
||||
$this->assertFalse($this->commentExists($comments[2]), 'Comment 3 does not appear on page 1.');
|
||||
|
||||
// Check the second page.
|
||||
$this->drupalGet('node/' . $node->nid, array('query' => array('page' => 1)));
|
||||
$this->assertTrue($this->commentExists($comments[1]), t('Comment 2 appears on page 2.'));
|
||||
$this->assertFalse($this->commentExists($comments[0]), t('Comment 1 does not appear on page 2.'));
|
||||
$this->assertFalse($this->commentExists($comments[2]), t('Comment 3 does not appear on page 2.'));
|
||||
$this->assertTrue($this->commentExists($comments[1]), 'Comment 2 appears on page 2.');
|
||||
$this->assertFalse($this->commentExists($comments[0]), 'Comment 1 does not appear on page 2.');
|
||||
$this->assertFalse($this->commentExists($comments[2]), 'Comment 3 does not appear on page 2.');
|
||||
|
||||
// Check the third page.
|
||||
$this->drupalGet('node/' . $node->nid, array('query' => array('page' => 2)));
|
||||
$this->assertTrue($this->commentExists($comments[2]), t('Comment 3 appears on page 3.'));
|
||||
$this->assertFalse($this->commentExists($comments[0]), t('Comment 1 does not appear on page 3.'));
|
||||
$this->assertFalse($this->commentExists($comments[1]), t('Comment 2 does not appear on page 3.'));
|
||||
$this->assertTrue($this->commentExists($comments[2]), 'Comment 3 appears on page 3.');
|
||||
$this->assertFalse($this->commentExists($comments[0]), 'Comment 1 does not appear on page 3.');
|
||||
$this->assertFalse($this->commentExists($comments[1]), 'Comment 2 does not appear on page 3.');
|
||||
|
||||
// Post a reply to the oldest comment and test again.
|
||||
$replies = array();
|
||||
@@ -1272,21 +1274,21 @@ class CommentPagerTest extends CommentHelperCase {
|
||||
// We are still in flat view - the replies should not be on the first page,
|
||||
// even though they are replies to the oldest comment.
|
||||
$this->drupalGet('node/' . $node->nid, array('query' => array('page' => 0)));
|
||||
$this->assertFalse($this->commentExists($reply, TRUE), t('In flat mode, reply does not appear on page 1.'));
|
||||
$this->assertFalse($this->commentExists($reply, TRUE), 'In flat mode, reply does not appear on page 1.');
|
||||
|
||||
// If we switch to threaded mode, the replies on the oldest comment
|
||||
// should be bumped to the first page and comment 6 should be bumped
|
||||
// to the second page.
|
||||
$this->setCommentSettings('comment_default_mode', COMMENT_MODE_THREADED, t('Switched to threaded mode.'));
|
||||
$this->drupalGet('node/' . $node->nid, array('query' => array('page' => 0)));
|
||||
$this->assertTrue($this->commentExists($reply, TRUE), t('In threaded mode, reply appears on page 1.'));
|
||||
$this->assertFalse($this->commentExists($comments[1]), t('In threaded mode, comment 2 has been bumped off of page 1.'));
|
||||
$this->assertTrue($this->commentExists($reply, TRUE), 'In threaded mode, reply appears on page 1.');
|
||||
$this->assertFalse($this->commentExists($comments[1]), 'In threaded mode, comment 2 has been bumped off of page 1.');
|
||||
|
||||
// If (# replies > # comments per page) in threaded expanded view,
|
||||
// the overage should be bumped.
|
||||
$reply2 = $this->postComment(NULL, $this->randomName(), $this->randomName(), TRUE);
|
||||
$this->drupalGet('node/' . $node->nid, array('query' => array('page' => 0)));
|
||||
$this->assertFalse($this->commentExists($reply2, TRUE), t('In threaded mode where # replies > # comments per page, the newest reply does not appear on page 1.'));
|
||||
$this->assertFalse($this->commentExists($reply2, TRUE), 'In threaded mode where # replies > # comments per page, the newest reply does not appear on page 1.');
|
||||
|
||||
$this->drupalLogout();
|
||||
}
|
||||
@@ -1388,7 +1390,7 @@ class CommentPagerTest extends CommentHelperCase {
|
||||
$result_order[] = substr($anchor['id'], 8);
|
||||
}
|
||||
|
||||
return $this->assertIdentical($expected_cids, $result_order, t('Comment order: expected @expected, returned @returned.', array('@expected' => implode(',', $expected_cids), '@returned' => implode(',', $result_order))));
|
||||
return $this->assertIdentical($expected_cids, $result_order, format_string('Comment order: expected @expected, returned @returned.', array('@expected' => implode(',', $expected_cids), '@returned' => implode(',', $result_order))));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1448,7 +1450,7 @@ class CommentPagerTest extends CommentHelperCase {
|
||||
foreach ($expected_pages as $new_replies => $expected_page) {
|
||||
$returned = comment_new_page_count($node->comment_count, $new_replies, $node);
|
||||
$returned_page = is_array($returned) ? $returned['page'] : 0;
|
||||
$this->assertIdentical($expected_page, $returned_page, t('Flat mode, @new replies: expected page @expected, returned page @returned.', array('@new' => $new_replies, '@expected' => $expected_page, '@returned' => $returned_page)));
|
||||
$this->assertIdentical($expected_page, $returned_page, format_string('Flat mode, @new replies: expected page @expected, returned page @returned.', array('@new' => $new_replies, '@expected' => $expected_page, '@returned' => $returned_page)));
|
||||
}
|
||||
|
||||
$this->setCommentSettings('comment_default_mode', COMMENT_MODE_THREADED, t('Switched to threaded mode.'));
|
||||
@@ -1466,7 +1468,7 @@ class CommentPagerTest extends CommentHelperCase {
|
||||
foreach ($expected_pages as $new_replies => $expected_page) {
|
||||
$returned = comment_new_page_count($node->comment_count, $new_replies, $node);
|
||||
$returned_page = is_array($returned) ? $returned['page'] : 0;
|
||||
$this->assertEqual($expected_page, $returned_page, t('Threaded mode, @new replies: expected page @expected, returned page @returned.', array('@new' => $new_replies, '@expected' => $expected_page, '@returned' => $returned_page)));
|
||||
$this->assertEqual($expected_page, $returned_page, format_string('Threaded mode, @new replies: expected page @expected, returned page @returned.', array('@new' => $new_replies, '@expected' => $expected_page, '@returned' => $returned_page)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1516,12 +1518,12 @@ class CommentNodeAccessTest extends CommentHelperCase {
|
||||
$comment_subject = $this->randomName();
|
||||
$comment = $this->postComment($this->node, $comment_text, $comment_subject);
|
||||
$comment_loaded = comment_load($comment->id);
|
||||
$this->assertTrue($this->commentExists($comment), t('Comment found.'));
|
||||
$this->assertTrue($this->commentExists($comment), 'Comment found.');
|
||||
|
||||
// Check comment display.
|
||||
$this->drupalGet('node/' . $this->node->nid . '/' . $comment->id);
|
||||
$this->assertText($comment_subject, t('Individual comment subject found.'));
|
||||
$this->assertText($comment_text, t('Individual comment body found.'));
|
||||
$this->assertText($comment_subject, 'Individual comment subject found.');
|
||||
$this->assertText($comment_text, 'Individual comment body found.');
|
||||
|
||||
// Reply to comment, creating second comment.
|
||||
$this->drupalGet('comment/reply/' . $this->node->nid . '/' . $comment->id);
|
||||
@@ -1529,7 +1531,7 @@ class CommentNodeAccessTest extends CommentHelperCase {
|
||||
$reply_subject = $this->randomName();
|
||||
$reply = $this->postComment(NULL, $reply_text, $reply_subject, TRUE);
|
||||
$reply_loaded = comment_load($reply->id);
|
||||
$this->assertTrue($this->commentExists($reply, TRUE), t('Reply found.'));
|
||||
$this->assertTrue($this->commentExists($reply, TRUE), 'Reply found.');
|
||||
|
||||
// Go to the node page and verify comment and reply are visible.
|
||||
$this->drupalGet('node/' . $this->node->nid);
|
||||
@@ -1572,7 +1574,7 @@ class CommentApprovalTest extends CommentHelperCase {
|
||||
$subject = $this->randomName();
|
||||
$body = $this->randomName();
|
||||
$this->postComment($this->node, $body, $subject, TRUE); // Set $contact to true so that it won't check for id and message.
|
||||
$this->assertText(t('Your comment has been queued for review by site administrators and will be published after approval.'), t('Comment requires approval.'));
|
||||
$this->assertText(t('Your comment has been queued for review by site administrators and will be published after approval.'), 'Comment requires approval.');
|
||||
|
||||
// Get unapproved comment id.
|
||||
$this->drupalLogin($this->admin_user);
|
||||
@@ -1580,7 +1582,7 @@ class CommentApprovalTest extends CommentHelperCase {
|
||||
$anonymous_comment4 = (object) array('id' => $anonymous_comment4, 'subject' => $subject, 'comment' => $body);
|
||||
$this->drupalLogout();
|
||||
|
||||
$this->assertFalse($this->commentExists($anonymous_comment4), t('Anonymous comment was not published.'));
|
||||
$this->assertFalse($this->commentExists($anonymous_comment4), 'Anonymous comment was not published.');
|
||||
|
||||
// Approve comment.
|
||||
$this->drupalLogin($this->admin_user);
|
||||
@@ -1588,7 +1590,7 @@ class CommentApprovalTest extends CommentHelperCase {
|
||||
$this->drupalLogout();
|
||||
|
||||
$this->drupalGet('node/' . $this->node->nid);
|
||||
$this->assertTrue($this->commentExists($anonymous_comment4), t('Anonymous comment visible.'));
|
||||
$this->assertTrue($this->commentExists($anonymous_comment4), 'Anonymous comment visible.');
|
||||
|
||||
// Post 2 anonymous comments without contact info.
|
||||
$comments[] = $this->postComment($this->node, $this->randomName(), $this->randomName(), TRUE);
|
||||
@@ -1597,13 +1599,13 @@ class CommentApprovalTest extends CommentHelperCase {
|
||||
// Publish multiple comments in one operation.
|
||||
$this->drupalLogin($this->admin_user);
|
||||
$this->drupalGet('admin/content/comment/approval');
|
||||
$this->assertText(t('Unapproved comments (@count)', array('@count' => 2)), t('Two unapproved comments waiting for approval.'));
|
||||
$this->assertText(t('Unapproved comments (@count)', array('@count' => 2)), 'Two unapproved comments waiting for approval.');
|
||||
$edit = array(
|
||||
"comments[{$comments[0]->id}]" => 1,
|
||||
"comments[{$comments[1]->id}]" => 1,
|
||||
);
|
||||
$this->drupalPost(NULL, $edit, t('Update'));
|
||||
$this->assertText(t('Unapproved comments (@count)', array('@count' => 0)), t('All comments were approved.'));
|
||||
$this->assertText(t('Unapproved comments (@count)', array('@count' => 0)), 'All comments were approved.');
|
||||
|
||||
// Delete multiple comments in one operation.
|
||||
$edit = array(
|
||||
@@ -1613,9 +1615,9 @@ class CommentApprovalTest extends CommentHelperCase {
|
||||
"comments[{$anonymous_comment4->id}]" => 1,
|
||||
);
|
||||
$this->drupalPost(NULL, $edit, t('Update'));
|
||||
$this->assertText(t('Are you sure you want to delete these comments and all their children?'), t('Confirmation required.'));
|
||||
$this->assertText(t('Are you sure you want to delete these comments and all their children?'), 'Confirmation required.');
|
||||
$this->drupalPost(NULL, $edit, t('Delete comments'));
|
||||
$this->assertText(t('No comments available.'), t('All comments were deleted.'));
|
||||
$this->assertText(t('No comments available.'), 'All comments were deleted.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1636,7 +1638,7 @@ class CommentApprovalTest extends CommentHelperCase {
|
||||
$subject = $this->randomName();
|
||||
$body = $this->randomName();
|
||||
$this->postComment($this->node, $body, $subject, TRUE); // Set $contact to true so that it won't check for id and message.
|
||||
$this->assertText(t('Your comment has been queued for review by site administrators and will be published after approval.'), t('Comment requires approval.'));
|
||||
$this->assertText(t('Your comment has been queued for review by site administrators and will be published after approval.'), 'Comment requires approval.');
|
||||
|
||||
// Get unapproved comment id.
|
||||
$this->drupalLogin($this->admin_user);
|
||||
@@ -1644,20 +1646,20 @@ class CommentApprovalTest extends CommentHelperCase {
|
||||
$anonymous_comment4 = (object) array('id' => $anonymous_comment4, 'subject' => $subject, 'comment' => $body);
|
||||
$this->drupalLogout();
|
||||
|
||||
$this->assertFalse($this->commentExists($anonymous_comment4), t('Anonymous comment was not published.'));
|
||||
$this->assertFalse($this->commentExists($anonymous_comment4), 'Anonymous comment was not published.');
|
||||
|
||||
// Approve comment.
|
||||
$this->drupalLogin($this->admin_user);
|
||||
$this->drupalGet('comment/1/approve');
|
||||
$this->assertResponse(403, t('Forged comment approval was denied.'));
|
||||
$this->assertResponse(403, 'Forged comment approval was denied.');
|
||||
$this->drupalGet('comment/1/approve', array('query' => array('token' => 'forged')));
|
||||
$this->assertResponse(403, t('Forged comment approval was denied.'));
|
||||
$this->assertResponse(403, 'Forged comment approval was denied.');
|
||||
$this->drupalGet('node/' . $this->node->nid);
|
||||
$this->clickLink(t('approve'));
|
||||
$this->drupalLogout();
|
||||
|
||||
$this->drupalGet('node/' . $this->node->nid);
|
||||
$this->assertTrue($this->commentExists($anonymous_comment4), t('Anonymous comment visible.'));
|
||||
$this->assertTrue($this->commentExists($anonymous_comment4), 'Anonymous comment visible.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1684,7 +1686,7 @@ class CommentBlockFunctionalTest extends CommentHelperCase {
|
||||
'blocks[comment_recent][region]' => 'sidebar_first',
|
||||
);
|
||||
$this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
|
||||
$this->assertText(t('The block settings have been updated.'), t('Block saved to first sidebar region.'));
|
||||
$this->assertText(t('The block settings have been updated.'), 'Block saved to first sidebar region.');
|
||||
|
||||
// Set block title and variables.
|
||||
$block = array(
|
||||
@@ -1692,7 +1694,7 @@ class CommentBlockFunctionalTest extends CommentHelperCase {
|
||||
'comment_block_count' => 2,
|
||||
);
|
||||
$this->drupalPost('admin/structure/block/manage/comment/recent/configure', $block, t('Save block'));
|
||||
$this->assertText(t('The block configuration has been saved.'), t('Block saved.'));
|
||||
$this->assertText(t('The block configuration has been saved.'), 'Block saved.');
|
||||
|
||||
// Add some test comments, one without a subject.
|
||||
$comment1 = $this->postComment($this->node, $this->randomName(), $this->randomName());
|
||||
@@ -1704,20 +1706,20 @@ class CommentBlockFunctionalTest extends CommentHelperCase {
|
||||
$this->drupalLogout();
|
||||
user_role_revoke_permissions(DRUPAL_ANONYMOUS_RID, array('access comments'));
|
||||
$this->drupalGet('');
|
||||
$this->assertNoText($block['title'], t('Block was not found.'));
|
||||
$this->assertNoText($block['title'], 'Block was not found.');
|
||||
user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access comments'));
|
||||
|
||||
// Test that a user with the 'access comments' permission can see the
|
||||
// block.
|
||||
$this->drupalLogin($this->web_user);
|
||||
$this->drupalGet('');
|
||||
$this->assertText($block['title'], t('Block was found.'));
|
||||
$this->assertText($block['title'], 'Block was found.');
|
||||
|
||||
// Test the only the 2 latest comments are shown and in the proper order.
|
||||
$this->assertNoText($comment1->subject, t('Comment not found in block.'));
|
||||
$this->assertText($comment2->subject, t('Comment found in block.'));
|
||||
$this->assertText($comment3->comment, t('Comment found in block.'));
|
||||
$this->assertTrue(strpos($this->drupalGetContent(), $comment3->comment) < strpos($this->drupalGetContent(), $comment2->subject), t('Comments were ordered correctly in block.'));
|
||||
$this->assertNoText($comment1->subject, 'Comment not found in block.');
|
||||
$this->assertText($comment2->subject, 'Comment found in block.');
|
||||
$this->assertText($comment3->comment, 'Comment found in block.');
|
||||
$this->assertTrue(strpos($this->drupalGetContent(), $comment3->comment) < strpos($this->drupalGetContent(), $comment2->subject), 'Comments were ordered correctly in block.');
|
||||
|
||||
// Set the number of recent comments to show to 10.
|
||||
$this->drupalLogout();
|
||||
@@ -1726,30 +1728,30 @@ class CommentBlockFunctionalTest extends CommentHelperCase {
|
||||
'comment_block_count' => 10,
|
||||
);
|
||||
$this->drupalPost('admin/structure/block/manage/comment/recent/configure', $block, t('Save block'));
|
||||
$this->assertText(t('The block configuration has been saved.'), t('Block saved.'));
|
||||
$this->assertText(t('The block configuration has been saved.'), 'Block saved.');
|
||||
|
||||
// Post an additional comment.
|
||||
$comment4 = $this->postComment($this->node, $this->randomName(), $this->randomName());
|
||||
|
||||
// Test that all four comments are shown.
|
||||
$this->assertText($comment1->subject, t('Comment found in block.'));
|
||||
$this->assertText($comment2->subject, t('Comment found in block.'));
|
||||
$this->assertText($comment3->comment, t('Comment found in block.'));
|
||||
$this->assertText($comment4->subject, t('Comment found in block.'));
|
||||
$this->assertText($comment1->subject, 'Comment found in block.');
|
||||
$this->assertText($comment2->subject, 'Comment found in block.');
|
||||
$this->assertText($comment3->comment, 'Comment found in block.');
|
||||
$this->assertText($comment4->subject, 'Comment found in block.');
|
||||
|
||||
// Test that links to comments work when comments are across pages.
|
||||
$this->setCommentsPerPage(1);
|
||||
$this->drupalGet('');
|
||||
$this->clickLink($comment1->subject);
|
||||
$this->assertText($comment1->subject, t('Comment link goes to correct page.'));
|
||||
$this->assertText($comment1->subject, 'Comment link goes to correct page.');
|
||||
$this->drupalGet('');
|
||||
$this->clickLink($comment2->subject);
|
||||
$this->assertText($comment2->subject, t('Comment link goes to correct page.'));
|
||||
$this->assertText($comment2->subject, 'Comment link goes to correct page.');
|
||||
$this->clickLink($comment4->subject);
|
||||
$this->assertText($comment4->subject, t('Comment link goes to correct page.'));
|
||||
$this->assertText($comment4->subject, 'Comment link goes to correct page.');
|
||||
// Check that when viewing a comment page from a link to the comment, that
|
||||
// rel="canonical" is added to the head of the document.
|
||||
$this->assertRaw('<link rel="canonical"', t('Canonical URL was found in the HTML head'));
|
||||
$this->assertRaw('<link rel="canonical"', 'Canonical URL was found in the HTML head');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1774,13 +1776,13 @@ class CommentRSSUnitTest extends CommentHelperCase {
|
||||
$comment = $this->postComment($this->node, $this->randomName(), $this->randomName());
|
||||
$this->drupalGet('rss.xml');
|
||||
$raw = '<comments>' . url('node/' . $this->node->nid, array('fragment' => 'comments', 'absolute' => TRUE)) . '</comments>';
|
||||
$this->assertRaw($raw, t('Comments as part of RSS feed.'));
|
||||
$this->assertRaw($raw, 'Comments as part of RSS feed.');
|
||||
|
||||
// Hide comments from RSS feed and check presence.
|
||||
$this->node->comment = COMMENT_NODE_HIDDEN;
|
||||
node_save($this->node);
|
||||
$this->drupalGet('rss.xml');
|
||||
$this->assertNoRaw($raw, t('Hidden comments is not a part of RSS feed.'));
|
||||
$this->assertNoRaw($raw, 'Hidden comments is not a part of RSS feed.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1814,14 +1816,14 @@ class CommentContentRebuild extends CommentHelperCase {
|
||||
$comment_text = $this->randomName();
|
||||
$comment = $this->postComment($this->node, $comment_text, $subject_text, TRUE);
|
||||
$comment_loaded = comment_load($comment->id);
|
||||
$this->assertTrue($this->commentExists($comment), t('Comment found.'));
|
||||
$this->assertTrue($this->commentExists($comment), 'Comment found.');
|
||||
|
||||
// Add the property to the content array and then see if it still exists on build.
|
||||
$comment_loaded->content['test_property'] = array('#value' => $this->randomString());
|
||||
$built_content = comment_view($comment_loaded, $this->node);
|
||||
|
||||
// This means that the content was rebuilt as the added test property no longer exists.
|
||||
$this->assertFalse(isset($built_content['test_property']), t('Comment content was emptied before being built.'));
|
||||
$this->assertFalse(isset($built_content['test_property']), 'Comment content was emptied before being built.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1887,11 +1889,11 @@ class CommentTokenReplaceTestCase extends CommentHelperCase {
|
||||
$tests['[comment:author:name]'] = check_plain($this->admin_user->name);
|
||||
|
||||
// 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('comment' => $comment), array('language' => $language));
|
||||
$this->assertEqual($output, $expected, t('Sanitized comment token %token replaced.', array('%token' => $input)));
|
||||
$this->assertEqual($output, $expected, format_string('Sanitized comment token %token replaced.', array('%token' => $input)));
|
||||
}
|
||||
|
||||
// Generate and test unsanitized tokens.
|
||||
@@ -1907,7 +1909,7 @@ class CommentTokenReplaceTestCase extends CommentHelperCase {
|
||||
|
||||
foreach ($tests as $input => $expected) {
|
||||
$output = token_replace($input, array('comment' => $comment), array('language' => $language, 'sanitize' => FALSE));
|
||||
$this->assertEqual($output, $expected, t('Unsanitized comment token %token replaced.', array('%token' => $input)));
|
||||
$this->assertEqual($output, $expected, format_string('Unsanitized comment token %token replaced.', array('%token' => $input)));
|
||||
}
|
||||
|
||||
// Load node so comment_count gets computed.
|
||||
@@ -1920,7 +1922,7 @@ class CommentTokenReplaceTestCase extends CommentHelperCase {
|
||||
|
||||
foreach ($tests as $input => $expected) {
|
||||
$output = token_replace($input, array('node' => $node), array('language' => $language));
|
||||
$this->assertEqual($output, $expected, t('Node comment token %token replaced.', array('%token' => $input)));
|
||||
$this->assertEqual($output, $expected, format_string('Node comment token %token replaced.', array('%token' => $input)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1949,25 +1951,25 @@ class CommentActionsTestCase extends CommentHelperCase {
|
||||
|
||||
// Unpublish a comment (direct form: doesn't actually save the comment).
|
||||
comment_unpublish_action($comment);
|
||||
$this->assertEqual($comment->status, COMMENT_NOT_PUBLISHED, t('Comment was unpublished'));
|
||||
$this->assertWatchdogMessage('Unpublished comment %subject.', array('%subject' => $subject), t('Found watchdog message'));
|
||||
$this->assertEqual($comment->status, COMMENT_NOT_PUBLISHED, 'Comment was unpublished');
|
||||
$this->assertWatchdogMessage('Unpublished comment %subject.', array('%subject' => $subject), 'Found watchdog message');
|
||||
$this->clearWatchdog();
|
||||
|
||||
// Unpublish a comment (indirect form: modify the comment in the database).
|
||||
comment_unpublish_action(NULL, array('cid' => $comment->cid));
|
||||
$this->assertEqual(comment_load($comment->cid)->status, COMMENT_NOT_PUBLISHED, t('Comment was unpublished'));
|
||||
$this->assertWatchdogMessage('Unpublished comment %subject.', array('%subject' => $subject), t('Found watchdog message'));
|
||||
$this->assertEqual(comment_load($comment->cid)->status, COMMENT_NOT_PUBLISHED, 'Comment was unpublished');
|
||||
$this->assertWatchdogMessage('Unpublished comment %subject.', array('%subject' => $subject), 'Found watchdog message');
|
||||
|
||||
// Publish a comment (direct form: doesn't actually save the comment).
|
||||
comment_publish_action($comment);
|
||||
$this->assertEqual($comment->status, COMMENT_PUBLISHED, t('Comment was published'));
|
||||
$this->assertWatchdogMessage('Published comment %subject.', array('%subject' => $subject), t('Found watchdog message'));
|
||||
$this->assertEqual($comment->status, COMMENT_PUBLISHED, 'Comment was published');
|
||||
$this->assertWatchdogMessage('Published comment %subject.', array('%subject' => $subject), 'Found watchdog message');
|
||||
$this->clearWatchdog();
|
||||
|
||||
// Publish a comment (indirect form: modify the comment in the database).
|
||||
comment_publish_action(NULL, array('cid' => $comment->cid));
|
||||
$this->assertEqual(comment_load($comment->cid)->status, COMMENT_PUBLISHED, t('Comment was published'));
|
||||
$this->assertWatchdogMessage('Published comment %subject.', array('%subject' => $subject), t('Found watchdog message'));
|
||||
$this->assertEqual(comment_load($comment->cid)->status, COMMENT_PUBLISHED, 'Comment was published');
|
||||
$this->assertWatchdogMessage('Published comment %subject.', array('%subject' => $subject), 'Found watchdog message');
|
||||
$this->clearWatchdog();
|
||||
}
|
||||
|
||||
@@ -1983,7 +1985,7 @@ class CommentActionsTestCase extends CommentHelperCase {
|
||||
*/
|
||||
function assertWatchdogMessage($watchdog_message, $variables, $message) {
|
||||
$status = (bool) db_query_range("SELECT 1 FROM {watchdog} WHERE message = :message AND variables = :variables", 0, 1, array(':message' => $watchdog_message, ':variables' => serialize($variables)))->fetchField();
|
||||
return $this->assert($status, $message);
|
||||
return $this->assert($status, format_string('@message', array('@message' => $message)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2011,13 +2013,13 @@ class CommentFieldsTest extends CommentHelperCase {
|
||||
*/
|
||||
function testCommentDefaultFields() {
|
||||
// Do not make assumptions on default node types created by the test
|
||||
// install profile, and create our own.
|
||||
// installation profile, and create our own.
|
||||
$this->drupalCreateContentType(array('type' => 'test_node_type'));
|
||||
|
||||
// Check that the 'comment_body' field is present on all comment bundles.
|
||||
$instances = field_info_instances('comment');
|
||||
foreach (node_type_get_types() as $type_name => $info) {
|
||||
$this->assertTrue(isset($instances['comment_node_' . $type_name]['comment_body']), t('The comment_body field is present for comments on type @type', array('@type' => $type_name)));
|
||||
$this->assertTrue(isset($instances['comment_node_' . $type_name]['comment_body']), format_string('The comment_body field is present for comments on type @type', array('@type' => $type_name)));
|
||||
|
||||
// Delete the instance along the way.
|
||||
field_delete_instance($instances['comment_node_' . $type_name]['comment_body']);
|
||||
@@ -2025,7 +2027,7 @@ class CommentFieldsTest extends CommentHelperCase {
|
||||
|
||||
// Check that the 'comment_body' field is deleted.
|
||||
$field = field_info_field('comment_body');
|
||||
$this->assertTrue(empty($field), t('The comment_body field was deleted'));
|
||||
$this->assertTrue(empty($field), 'The comment_body field was deleted');
|
||||
|
||||
// Create a new content type.
|
||||
$type_name = 'test_node_type_2';
|
||||
@@ -2034,9 +2036,9 @@ class CommentFieldsTest extends CommentHelperCase {
|
||||
// Check that the 'comment_body' field exists and has an instance on the
|
||||
// new comment bundle.
|
||||
$field = field_info_field('comment_body');
|
||||
$this->assertTrue($field, t('The comment_body field exists'));
|
||||
$this->assertTrue($field, 'The comment_body field exists');
|
||||
$instances = field_info_instances('comment');
|
||||
$this->assertTrue(isset($instances['comment_node_' . $type_name]['comment_body']), t('The comment_body field is present for comments on type @type', array('@type' => $type_name)));
|
||||
$this->assertTrue(isset($instances['comment_node_' . $type_name]['comment_body']), format_string('The comment_body field is present for comments on type @type', array('@type' => $type_name)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2052,7 +2054,7 @@ class CommentFieldsTest extends CommentHelperCase {
|
||||
$edit['modules[Core][comment][enable]'] = FALSE;
|
||||
$this->drupalPost('admin/modules', $edit, t('Save configuration'));
|
||||
$this->resetAll();
|
||||
$this->assertFalse(module_exists('comment'), t('Comment module disabled.'));
|
||||
$this->assertFalse(module_exists('comment'), 'Comment module disabled.');
|
||||
|
||||
// Enable core content type modules (blog, book, and poll).
|
||||
$edit = array();
|
||||
@@ -2067,7 +2069,7 @@ class CommentFieldsTest extends CommentHelperCase {
|
||||
$edit['modules[Core][comment][enable]'] = 'comment';
|
||||
$this->drupalPost('admin/modules', $edit, t('Save configuration'));
|
||||
$this->resetAll();
|
||||
$this->assertTrue(module_exists('comment'), t('Comment module enabled.'));
|
||||
$this->assertTrue(module_exists('comment'), 'Comment module enabled.');
|
||||
|
||||
// Create nodes of each type.
|
||||
$blog_node = $this->drupalCreateNode(array('type' => 'blog'));
|
||||
|
@@ -55,6 +55,8 @@
|
||||
* @see template_preprocess_comment()
|
||||
* @see template_process()
|
||||
* @see theme_comment()
|
||||
*
|
||||
* @ingroup themeable
|
||||
*/
|
||||
?>
|
||||
<div class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>>
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
files[] = contact.test
|
||||
configure = admin/structure/contact
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
files[] = contextual.test
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -7,8 +7,8 @@ files[] = dashboard.test
|
||||
dependencies[] = block
|
||||
configure = admin/dashboard/customize
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
files[] = dblog.test
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -96,7 +96,7 @@ function dblog_init() {
|
||||
/**
|
||||
* Implements hook_cron().
|
||||
*
|
||||
* Remove expired log messages and flood control events.
|
||||
* Remove expired log messages.
|
||||
*/
|
||||
function dblog_cron() {
|
||||
// Cleanup the watchdog table.
|
||||
|
@@ -256,7 +256,7 @@ class DBLogTestCase extends DrupalWebTestCase {
|
||||
// View dblog page-not-found report page.
|
||||
$this->drupalGet('admin/reports/page-not-found');
|
||||
$this->assertResponse(200);
|
||||
// Check that full-length url displayed.
|
||||
// Check that full-length URL displayed.
|
||||
$this->assertText($not_found_url, t('DBLog event was recorded: [page not found]'));
|
||||
}
|
||||
|
||||
|
@@ -690,11 +690,10 @@ function hook_field_is_empty($item, $field) {
|
||||
* which widget to use. Widget types are defined by implementing
|
||||
* hook_field_widget_info().
|
||||
*
|
||||
* Widgets are
|
||||
* @link http://api.drupal.org/api/drupal/developer--topics--forms_api_reference.html Form API @endlink
|
||||
* elements with additional processing capabilities. Widget hooks are typically
|
||||
* called by the Field Attach API during the creation of the field form
|
||||
* structure with field_attach_form().
|
||||
* Widgets are @link forms_api_reference.html Form API @endlink elements with
|
||||
* additional processing capabilities. Widget hooks are typically called by the
|
||||
* Field Attach API during the creation of the field form structure with
|
||||
* field_attach_form().
|
||||
*
|
||||
* @see field
|
||||
* @see field_types
|
||||
@@ -729,6 +728,9 @@ function hook_field_is_empty($item, $field) {
|
||||
* - FIELD_BEHAVIOR_DEFAULT: (default) If the widget accepts default
|
||||
* values.
|
||||
* - FIELD_BEHAVIOR_NONE: if the widget does not support default values.
|
||||
* - weight: (optional) An integer to determine the weight of this widget
|
||||
* relative to other widgets in the Field UI when selecting a widget for a
|
||||
* given field instance.
|
||||
*
|
||||
* @see hook_field_widget_info_alter()
|
||||
* @see hook_field_widget_form()
|
||||
@@ -738,7 +740,7 @@ function hook_field_is_empty($item, $field) {
|
||||
* @see hook_field_widget_settings_form()
|
||||
*/
|
||||
function hook_field_widget_info() {
|
||||
return array(
|
||||
return array(
|
||||
'text_textfield' => array(
|
||||
'label' => t('Text field'),
|
||||
'field types' => array('text'),
|
||||
@@ -765,6 +767,8 @@ function hook_field_widget_info() {
|
||||
'multiple values' => FIELD_BEHAVIOR_DEFAULT,
|
||||
'default value' => FIELD_BEHAVIOR_DEFAULT,
|
||||
),
|
||||
// As an advanced widget, force it to sink to the bottom of the choices.
|
||||
'weight' => 2,
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -1072,8 +1076,8 @@ function hook_field_formatter_info() {
|
||||
* Perform alterations on Field API formatter types.
|
||||
*
|
||||
* @param $info
|
||||
* Array of informations on formatter types exposed by
|
||||
* hook_field_field_formatter_info() implementations.
|
||||
* An array of information on formatter types exposed by
|
||||
* hook_field_formatter_info() implementations.
|
||||
*/
|
||||
function hook_field_formatter_info_alter(&$info) {
|
||||
// Add a setting to a formatter type.
|
||||
|
@@ -6,7 +6,38 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create a separate form element for each field.
|
||||
* Creates a form element for a field and can populate it with a default value.
|
||||
*
|
||||
* If the form element is not associated with an entity (i.e., $entity is NULL)
|
||||
* field_get_default_value will be called to supply the default value for the
|
||||
* field. Also allows other modules to alter the form element by implementing
|
||||
* their own hooks.
|
||||
*
|
||||
* @param $entity_type
|
||||
* The type of entity (for example 'node' or 'user') that the field belongs
|
||||
* to.
|
||||
* @param $entity
|
||||
* The entity object that the field belongs to. This may be NULL if creating a
|
||||
* form element with a default value.
|
||||
* @param $field
|
||||
* An array representing the field whose editing element is being created.
|
||||
* @param $instance
|
||||
* An array representing the structure for $field in its current context.
|
||||
* @param $langcode
|
||||
* The language associated with the field.
|
||||
* @param $items
|
||||
* An array of the field values. When creating a new entity this may be NULL
|
||||
* or an empty array to use default values.
|
||||
* @param $form
|
||||
* An array representing the form that the editing element will be attached
|
||||
* to.
|
||||
* @param $form_state
|
||||
* An array containing the current state of the form.
|
||||
* @param $get_delta
|
||||
* Used to get only a specific delta value of a multiple value field.
|
||||
*
|
||||
* @return
|
||||
* The form element array created for this field.
|
||||
*/
|
||||
function field_default_form($entity_type, $entity, $field, $instance, $langcode, $items, &$form, &$form_state, $get_delta = NULL) {
|
||||
// This could be called with no entity, as when a UI module creates a
|
||||
@@ -278,7 +309,7 @@ function theme_field_multiple_value_form($variables) {
|
||||
|
||||
$header = array(
|
||||
array(
|
||||
'data' => '<label>' . t('!title: !required', array('!title' => $element['#title'], '!required' => $required)) . "</label>",
|
||||
'data' => '<label>' . t('!title !required', array('!title' => $element['#title'], '!required' => $required)) . "</label>",
|
||||
'colspan' => 2,
|
||||
'class' => array('field-label'),
|
||||
),
|
||||
|
@@ -10,8 +10,8 @@ dependencies[] = field_sql_storage
|
||||
required = TRUE
|
||||
stylesheets[all][] = theme/field.css
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -54,8 +54,8 @@ function field_info_cache_clear() {
|
||||
* the field type.
|
||||
* - 'widget types': Array of hook_field_widget_info() results, keyed by
|
||||
* widget_type. Each element has the following components: label, field
|
||||
* types, settings, and behaviors from hook_field_widget_info(), as well
|
||||
* as module, giving the module that exposes the widget type.
|
||||
* types, settings, weight, and behaviors from hook_field_widget_info(),
|
||||
* as well as module, giving the module that exposes the widget type.
|
||||
* - 'formatter types': Array of hook_field_formatter_info() results, keyed by
|
||||
* formatter_type. Each element has the following components: label, field
|
||||
* types, and behaviors from hook_field_formatter_info(), as well as
|
||||
@@ -124,6 +124,7 @@ function _field_info_collate_types($reset = FALSE) {
|
||||
}
|
||||
}
|
||||
drupal_alter('field_widget_info', $info['widget types']);
|
||||
uasort($info['widget types'], 'drupal_sort_weight');
|
||||
|
||||
// Populate formatter types.
|
||||
foreach (module_implements('field_formatter_info') as $module) {
|
||||
@@ -702,6 +703,10 @@ function field_info_instances($entity_type = NULL, $bundle_name = NULL) {
|
||||
* The field name for the instance.
|
||||
* @param $bundle_name
|
||||
* The bundle name for the instance.
|
||||
*
|
||||
* @return
|
||||
* An associative array of instance data for the specific field and bundle;
|
||||
* NULL if the instance does not exist.
|
||||
*/
|
||||
function field_info_instance($entity_type, $field_name, $bundle_name) {
|
||||
$info = _field_info_collate_fields();
|
||||
|
@@ -172,7 +172,7 @@ function field_schema() {
|
||||
* This function can be used for databases whose schema is at field module
|
||||
* version 7000 or higher.
|
||||
*
|
||||
* @ingroup update-api-6.x-to-7.x
|
||||
* @ingroup update_api
|
||||
*/
|
||||
function _update_7000_field_create_field(&$field) {
|
||||
// Merge in default values.`
|
||||
@@ -253,7 +253,7 @@ function _update_7000_field_create_field(&$field) {
|
||||
* @param $field_name
|
||||
* The field name to delete.
|
||||
*
|
||||
* @ingroup update-api-6.x-to-7.x
|
||||
* @ingroup update_api
|
||||
*/
|
||||
function _update_7000_field_delete_field($field_name) {
|
||||
$table_name = 'field_data_' . $field_name;
|
||||
@@ -284,7 +284,7 @@ function _update_7000_field_delete_field($field_name) {
|
||||
*
|
||||
* This function is valid for a database schema version 7000.
|
||||
*
|
||||
* @ingroup update-api-6.x-to-7.x
|
||||
* @ingroup update_api
|
||||
*/
|
||||
function _update_7000_field_delete_instance($field_name, $entity_type, $bundle) {
|
||||
// Delete field instance configuration data.
|
||||
@@ -322,6 +322,8 @@ function _update_7000_field_delete_instance($field_name, $entity_type, $bundle)
|
||||
* @return
|
||||
* An array of fields matching $conditions, keyed by the property specified
|
||||
* by the $key parameter.
|
||||
*
|
||||
* @ingroup update_api
|
||||
*/
|
||||
function _update_7000_field_read_fields(array $conditions = array(), $key = 'id') {
|
||||
$fields = array();
|
||||
@@ -356,7 +358,7 @@ function _update_7000_field_read_fields(array $conditions = array(), $key = 'id'
|
||||
* This function can be used for databases whose schema is at field module
|
||||
* version 7000 or higher.
|
||||
*
|
||||
* @ingroup update-api-6.x-to-7.x
|
||||
* @ingroup update_api
|
||||
*/
|
||||
function _update_7000_field_create_instance($field, &$instance) {
|
||||
// Merge in defaults.
|
||||
|
@@ -376,7 +376,7 @@ function field_system_info_alter(&$info, $file, $type) {
|
||||
}
|
||||
if ($non_deleted) {
|
||||
if (module_exists('field_ui')) {
|
||||
$explanation = t('Field type(s) in use - see !link', array('!link' => l(t('Field list'), 'admin/reports/fields')));
|
||||
$explanation = t('Field type(s) in use - see <a href="@fields-page">Field list</a>', array('@fields-page' => url('admin/reports/fields')));
|
||||
}
|
||||
else {
|
||||
$explanation = t('Fields type(s) in use');
|
||||
|
@@ -7,8 +7,8 @@ dependencies[] = field
|
||||
files[] = field_sql_storage.test
|
||||
required = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -30,7 +30,7 @@ function field_sql_storage_schema() {
|
||||
* This function can be used for databases whose schema is at field module
|
||||
* version 7000 or higher.
|
||||
*
|
||||
* @ingroup update-api-6.x-to-7.x
|
||||
* @ingroup update_api
|
||||
*/
|
||||
function _update_7000_field_sql_storage_write($entity_type, $bundle, $entity_id, $revision_id, $field_name, $data) {
|
||||
$table_name = "field_data_{$field_name}";
|
||||
|
@@ -7,8 +7,8 @@ dependencies[] = field
|
||||
dependencies[] = options
|
||||
files[] = tests/list.test
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ package = Testing
|
||||
version = VERSION
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
dependencies[] = field
|
||||
files[] = number.test
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
dependencies[] = field
|
||||
files[] = options.test
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -7,8 +7,8 @@ dependencies[] = field
|
||||
files[] = text.test
|
||||
required = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -1119,8 +1119,11 @@ class FieldInfoTestCase extends FieldTestCase {
|
||||
'test_setting' => 999)));
|
||||
field_create_instance($instance);
|
||||
|
||||
$info = entity_get_info('test_entity');
|
||||
$instances = field_info_instances('test_entity', $instance['bundle']);
|
||||
$this->assertEqual(count($instances), 1, t('One instance shows up in info when attached to a bundle.'));
|
||||
$this->assertEqual(count($instances), 1, format_string('One instance shows up in info when attached to a bundle on a @label.', array(
|
||||
'@label' => $info['label']
|
||||
)));
|
||||
$this->assertTrue($instance < $instances[$instance['field_name']], t('Instance appears in info correctly'));
|
||||
|
||||
// Test a valid entity type but an invalid bundle.
|
||||
|
@@ -23,7 +23,7 @@ function field_test_entity_info() {
|
||||
|
||||
return array(
|
||||
'test_entity' => array(
|
||||
'name' => t('Test Entity'),
|
||||
'label' => t('Test Entity'),
|
||||
'fieldable' => TRUE,
|
||||
'field cache' => FALSE,
|
||||
'base table' => 'test_entity',
|
||||
@@ -38,7 +38,7 @@ function field_test_entity_info() {
|
||||
),
|
||||
// This entity type doesn't get form handling for now...
|
||||
'test_cacheable_entity' => array(
|
||||
'name' => t('Test Entity, cacheable'),
|
||||
'label' => t('Test Entity, cacheable'),
|
||||
'fieldable' => TRUE,
|
||||
'field cache' => TRUE,
|
||||
'entity keys' => array(
|
||||
@@ -50,7 +50,7 @@ function field_test_entity_info() {
|
||||
'view modes' => $test_entity_modes,
|
||||
),
|
||||
'test_entity_bundle_key' => array(
|
||||
'name' => t('Test Entity with a bundle key.'),
|
||||
'label' => t('Test Entity with a bundle key.'),
|
||||
'base table' => 'test_entity_bundle_key',
|
||||
'fieldable' => TRUE,
|
||||
'field cache' => FALSE,
|
||||
@@ -63,7 +63,7 @@ function field_test_entity_info() {
|
||||
),
|
||||
// In this case, the bundle key is not stored in the database.
|
||||
'test_entity_bundle' => array(
|
||||
'name' => t('Test Entity with a specified bundle.'),
|
||||
'label' => t('Test Entity with a specified bundle.'),
|
||||
'base table' => 'test_entity_bundle',
|
||||
'fieldable' => TRUE,
|
||||
'controller class' => 'TestEntityBundleController',
|
||||
@@ -77,7 +77,7 @@ function field_test_entity_info() {
|
||||
),
|
||||
// @see EntityPropertiesTestCase::testEntityLabel()
|
||||
'test_entity_no_label' => array(
|
||||
'name' => t('Test entity without label'),
|
||||
'label' => t('Test entity without label'),
|
||||
'fieldable' => TRUE,
|
||||
'field cache' => FALSE,
|
||||
'base table' => 'test_entity',
|
||||
@@ -90,7 +90,7 @@ function field_test_entity_info() {
|
||||
'view modes' => $test_entity_modes,
|
||||
),
|
||||
'test_entity_label' => array(
|
||||
'name' => t('Test entity label'),
|
||||
'label' => t('Test entity label'),
|
||||
'fieldable' => TRUE,
|
||||
'field cache' => FALSE,
|
||||
'base table' => 'test_entity',
|
||||
@@ -104,7 +104,7 @@ function field_test_entity_info() {
|
||||
'view modes' => $test_entity_modes,
|
||||
),
|
||||
'test_entity_label_callback' => array(
|
||||
'name' => t('Test entity label callback'),
|
||||
'label' => t('Test entity label callback'),
|
||||
'fieldable' => TRUE,
|
||||
'field cache' => FALSE,
|
||||
'base table' => 'test_entity',
|
||||
|
@@ -6,8 +6,8 @@ files[] = field_test.entity.inc
|
||||
version = VERSION
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -40,6 +40,8 @@
|
||||
*
|
||||
* @see template_preprocess_field()
|
||||
* @see theme_field()
|
||||
*
|
||||
* @ingroup themeable
|
||||
*/
|
||||
?>
|
||||
<!--
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
dependencies[] = field
|
||||
files[] = field_ui.test
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -51,12 +51,6 @@ function hook_file_download_access($file_item, $entity_type, $entity) {
|
||||
* The type of $entity; for example, 'node' or 'user'.
|
||||
* @param $entity
|
||||
* The $entity to which $file is referenced.
|
||||
*
|
||||
* @return
|
||||
* An array of grants, keyed by module name, each with a Boolean grant value.
|
||||
* Return an empty array to assert FALSE. You may choose to return your own
|
||||
* module's value in addition to other grants or to overwrite the values set
|
||||
* by other modules.
|
||||
*/
|
||||
function hook_file_download_access_alter(&$grants, $file_item, $entity_type, $entity) {
|
||||
// For our example module, we always enforce the rules set by node module.
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
dependencies[] = field
|
||||
files[] = tests/file.test
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -73,7 +73,14 @@ Drupal.file = Drupal.file || {
|
||||
var acceptableMatch = new RegExp('\\.(' + extensionPattern + ')$', 'gi');
|
||||
if (!acceptableMatch.test(this.value)) {
|
||||
var error = Drupal.t("The selected file %filename cannot be uploaded. Only files with the following extensions are allowed: %extensions.", {
|
||||
'%filename': this.value,
|
||||
// According to the specifications of HTML5, a file upload control
|
||||
// should not reveal the real local path to the file that a user
|
||||
// has selected. Some web browsers implement this restriction by
|
||||
// replacing the local path with "C:\fakepath\", which can cause
|
||||
// confusion by leaving the user thinking perhaps Drupal could not
|
||||
// find the file because it messed up the file path. To avoid this
|
||||
// confusion, therefore, we strip out the bogus fakepath string.
|
||||
'%filename': this.value.replace('C:\\fakepath\\', ''),
|
||||
'%extensions': extensionPattern.replace(/\|/g, ', ')
|
||||
});
|
||||
$(this).closest('div.form-managed-file').prepend('<div class="messages error file-upload-js-error">' + error + '</div>');
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -7,8 +7,8 @@ files[] = filter.test
|
||||
required = TRUE
|
||||
configure = admin/config/content/formats
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -9,8 +9,8 @@ files[] = forum.test
|
||||
configure = admin/structure/forum
|
||||
stylesheets[all][] = forum.css
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -330,10 +330,12 @@ function forum_node_presave($node) {
|
||||
$langcode = key($node->taxonomy_forums);
|
||||
if (!empty($node->taxonomy_forums[$langcode])) {
|
||||
$node->forum_tid = $node->taxonomy_forums[$langcode][0]['tid'];
|
||||
$old_tid = db_query_range("SELECT f.tid FROM {forum} f INNER JOIN {node} n ON f.vid = n.vid WHERE n.nid = :nid ORDER BY f.vid DESC", 0, 1, array(':nid' => $node->nid))->fetchField();
|
||||
if ($old_tid && isset($node->forum_tid) && ($node->forum_tid != $old_tid) && !empty($node->shadow)) {
|
||||
// A shadow copy needs to be created. Retain new term and add old term.
|
||||
$node->taxonomy_forums[$langcode][] = array('tid' => $old_tid);
|
||||
if (isset($node->nid)) {
|
||||
$old_tid = db_query_range("SELECT f.tid FROM {forum} f INNER JOIN {node} n ON f.vid = n.vid WHERE n.nid = :nid ORDER BY f.vid DESC", 0, 1, array(':nid' => $node->nid))->fetchField();
|
||||
if ($old_tid && isset($node->forum_tid) && ($node->forum_tid != $old_tid) && !empty($node->shadow)) {
|
||||
// A shadow copy needs to be created. Retain new term and add old term.
|
||||
$node->taxonomy_forums[$langcode][] = array('tid' => $old_tid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1328,7 +1330,7 @@ function _forum_get_topic_order($sortby) {
|
||||
* The ID of the node to update.
|
||||
*/
|
||||
function _forum_update_forum_index($nid) {
|
||||
$count = db_query('SELECT COUNT(cid) FROM {comment} WHERE nid = :nid AND status = :status', array(
|
||||
$count = db_query('SELECT COUNT(cid) FROM {comment} c INNER JOIN {forum_index} i ON c.nid = i.nid WHERE c.nid = :nid AND c.status = :status', array(
|
||||
':nid' => $nid,
|
||||
':status' => COMMENT_PUBLISHED,
|
||||
))->fetchField();
|
||||
|
@@ -197,6 +197,14 @@ class ForumTestCase extends DrupalWebTestCase {
|
||||
$this->drupalGet('forum/' . $this->forum['tid']);
|
||||
$this->drupalPost("node/$node->nid/edit", array(), t('Save'));
|
||||
$this->assertResponse(200);
|
||||
|
||||
// Make sure constructing a forum node programmatically produces no notices.
|
||||
$node = new stdClass;
|
||||
$node->type = 'forum';
|
||||
$node->title = 'Test forum notices';
|
||||
$node->uid = 1;
|
||||
$node->taxonomy_forums[LANGUAGE_NONE][0]['tid'] = $this->root_forum['tid'];
|
||||
node_save($node);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
files[] = help.test
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -600,9 +600,12 @@ function theme_image_formatter($variables) {
|
||||
$item = $variables['item'];
|
||||
$image = array(
|
||||
'path' => $item['uri'],
|
||||
'alt' => $item['alt'],
|
||||
);
|
||||
|
||||
if (array_key_exists('alt', $item)) {
|
||||
$image['alt'] = $item['alt'];
|
||||
}
|
||||
|
||||
if (isset($item['attributes'])) {
|
||||
$image['attributes'] = $item['attributes'];
|
||||
}
|
||||
@@ -613,7 +616,7 @@ function theme_image_formatter($variables) {
|
||||
}
|
||||
|
||||
// Do not output an empty 'title' attribute.
|
||||
if (drupal_strlen($item['title']) > 0) {
|
||||
if (isset($item['title']) && drupal_strlen($item['title']) > 0) {
|
||||
$image['title'] = $item['title'];
|
||||
}
|
||||
|
||||
@@ -625,9 +628,11 @@ function theme_image_formatter($variables) {
|
||||
$output = theme('image', $image);
|
||||
}
|
||||
|
||||
if (!empty($variables['path']['path'])) {
|
||||
// The link path and link options are both optional, but for the options to be
|
||||
// processed, the link path must at least be an empty string.
|
||||
if (isset($variables['path']['path'])) {
|
||||
$path = $variables['path']['path'];
|
||||
$options = $variables['path']['options'];
|
||||
$options = isset($variables['path']['options']) ? $variables['path']['options'] : array();
|
||||
// When displaying an image inside a link, the html option must be TRUE.
|
||||
$options['html'] = TRUE;
|
||||
$output = l($output, $path, $options);
|
||||
|
@@ -7,8 +7,8 @@ dependencies[] = file
|
||||
files[] = image.test
|
||||
configure = admin/config/media/image-styles
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -34,7 +34,7 @@ define('IMAGE_STORAGE_MODULE', IMAGE_STORAGE_OVERRIDE | IMAGE_STORAGE_DEFAULT);
|
||||
require_once DRUPAL_ROOT . '/modules/image/image.field.inc';
|
||||
|
||||
/**
|
||||
* Implement of hook_help().
|
||||
* Implements hook_help().
|
||||
*/
|
||||
function image_help($path, $arg) {
|
||||
switch ($path) {
|
||||
@@ -1054,7 +1054,7 @@ function image_effect_definitions() {
|
||||
$effects = &drupal_static(__FUNCTION__);
|
||||
|
||||
if (!isset($effects)) {
|
||||
if ($cache = cache_get("image_effects:$langcode") && !empty($cache->data)) {
|
||||
if ($cache = cache_get("image_effects:$langcode")) {
|
||||
$effects = $cache->data;
|
||||
}
|
||||
else {
|
||||
@@ -1262,7 +1262,7 @@ function theme_image_style($variables) {
|
||||
$variables['width'] = $dimensions['width'];
|
||||
$variables['height'] = $dimensions['height'];
|
||||
|
||||
// Determine the url for the styled image.
|
||||
// Determine the URL for the styled image.
|
||||
$variables['path'] = image_style_url($variables['style_name'], $variables['path']);
|
||||
return theme('image', $variables);
|
||||
}
|
||||
|
@@ -183,7 +183,7 @@ class ImageStylesPathAndUrlTestCase extends DrupalWebTestCase {
|
||||
|
||||
// Create a working copy of the file.
|
||||
$files = $this->drupalGetTestFiles('image');
|
||||
$file = reset($files);
|
||||
$file = array_shift($files);
|
||||
$image_info = image_get_info($file->uri);
|
||||
$original_uri = file_unmanaged_copy($file->uri, $scheme . '://', FILE_EXISTS_RENAME);
|
||||
// Let the image_module_test module know about this file, so it can claim
|
||||
@@ -212,18 +212,30 @@ class ImageStylesPathAndUrlTestCase extends DrupalWebTestCase {
|
||||
$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.'));
|
||||
// Verify access is denied to private image styles.
|
||||
$this->drupalLogout();
|
||||
|
||||
// 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.'));
|
||||
|
||||
// Repeat this with a different file that we do not have access to and
|
||||
// make sure that access is denied.
|
||||
$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.'));
|
||||
$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.') );
|
||||
// Verify that images are not appended to the response. Currently this test only uses PNG images.
|
||||
if (strpos($generate_url, '.png') === FALSE ) {
|
||||
$this->fail( t('Confirming that private image styles are not appended require PNG file.') );
|
||||
$this->fail('Confirming that private image styles are not appended require PNG file.');
|
||||
}
|
||||
else {
|
||||
// Check for PNG-Signature (cf. http://www.libpng.org/pub/png/book/chapter08.html#png.ch08.div.2) in the
|
||||
// response body.
|
||||
$this->assertNoRaw( chr(137) . chr(80) . chr(78) . chr(71) . chr(13) . chr(10) . chr(26) . chr(10), t('No PNG signature found in the response body.') );
|
||||
$this->assertNoRaw( chr(137) . chr(80) . chr(78) . chr(71) . chr(13) . chr(10) . chr(26) . chr(10), 'No PNG signature found in the response body.');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -243,7 +255,7 @@ class ImageEffectsUnitTest extends ImageToolkitTestCase {
|
||||
}
|
||||
|
||||
function setUp() {
|
||||
parent::setUp('image_test');
|
||||
parent::setUp('image_module_test');
|
||||
module_load_include('inc', 'image', 'image.effects');
|
||||
}
|
||||
|
||||
@@ -330,6 +342,25 @@ class ImageEffectsUnitTest extends ImageToolkitTestCase {
|
||||
$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'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test image effect caching.
|
||||
*/
|
||||
function testImageEffectsCaching() {
|
||||
$image_effect_definitions_called = &drupal_static('image_module_test_image_effect_info_alter');
|
||||
|
||||
// First call should grab a fresh copy of the data.
|
||||
$effects = image_effect_definitions();
|
||||
$this->assertTrue($image_effect_definitions_called === 1, 'image_effect_definitions() generated data.');
|
||||
|
||||
// Second call should come from cache.
|
||||
drupal_static_reset('image_effect_definitions');
|
||||
drupal_static_reset('image_module_test_image_effect_info_alter');
|
||||
$cached_effects = image_effect_definitions();
|
||||
$this->assertTrue(is_null($image_effect_definitions_called), 'image_effect_definitions() returned data from cache.');
|
||||
|
||||
$this->assertTrue($effects == $cached_effects, 'Cached effects are the same as generated effects.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -717,7 +748,7 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase {
|
||||
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; name="' . $test_image->filename . '"', t('Content-Type header was sent.'));
|
||||
$this->assertEqual($this->drupalGetHeader('Content-Type'), 'image/png', t('Content-Type header was sent.'));
|
||||
$this->assertEqual($this->drupalGetHeader('Content-Disposition'), 'inline; filename="' . $test_image->filename . '"', t('Content-Disposition header was sent.'));
|
||||
$this->assertEqual($this->drupalGetHeader('Cache-Control'), 'private', t('Cache-Control header was sent.'));
|
||||
|
||||
@@ -1566,3 +1597,64 @@ class ImageFieldDefaultImagesTestCase extends ImageFieldTestCase {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests image theme functions.
|
||||
*/
|
||||
class ImageThemeFunctionWebTestCase extends DrupalWebTestCase {
|
||||
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => 'Image theme functions',
|
||||
'description' => 'Test that the image theme functions work correctly.',
|
||||
'group' => 'Image',
|
||||
);
|
||||
}
|
||||
|
||||
function setUp() {
|
||||
parent::setUp(array('image'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests usage of the image field formatters.
|
||||
*/
|
||||
function testImageFormatterTheme() {
|
||||
// Create an image.
|
||||
$files = $this->drupalGetTestFiles('image');
|
||||
$file = reset($files);
|
||||
$original_uri = file_unmanaged_copy($file->uri, 'public://', FILE_EXISTS_RENAME);
|
||||
|
||||
// Create a style.
|
||||
image_style_save(array('name' => 'test'));
|
||||
$url = image_style_url('test', $original_uri);
|
||||
|
||||
// Test using theme_image_formatter() without an image title, alt text, or
|
||||
// link options.
|
||||
$path = $this->randomName();
|
||||
$element = array(
|
||||
'#theme' => 'image_formatter',
|
||||
'#image_style' => 'test',
|
||||
'#item' => array(
|
||||
'uri' => $original_uri,
|
||||
),
|
||||
'#path' => array(
|
||||
'path' => $path,
|
||||
),
|
||||
);
|
||||
$rendered_element = render($element);
|
||||
$expected_result = '<a href="' . url($path) . '"><img typeof="foaf:Image" src="' . $url . '" alt="" /></a>';
|
||||
$this->assertEqual($expected_result, $rendered_element, 'theme_image_formatter() correctly renders without title, alt, or path options.');
|
||||
|
||||
// Link the image to a fragment on the page, and not a full URL.
|
||||
$fragment = $this->randomName();
|
||||
$element['#path']['path'] = '';
|
||||
$element['#path']['options'] = array(
|
||||
'external' => TRUE,
|
||||
'fragment' => $fragment,
|
||||
);
|
||||
$rendered_element = render($element);
|
||||
$expected_result = '<a href="#' . $fragment . '"><img typeof="foaf:Image" src="' . $url . '" alt="" /></a>';
|
||||
$this->assertEqual($expected_result, $rendered_element, 'theme_image_formatter() correctly renders a link fragment.');
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
files[] = image_module_test.module
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -9,7 +9,6 @@ function image_module_test_file_download($uri) {
|
||||
if (variable_get('image_module_test_file_download', FALSE) == $uri) {
|
||||
return array('X-Image-Owned-By' => 'image_module_test');
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -39,3 +38,13 @@ function image_module_test_image_effect_info() {
|
||||
function image_module_test_null_effect(array &$image, array $data) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_image_effect_info_alter().
|
||||
*
|
||||
* Used to keep a count of cache misses in image_effect_definitions().
|
||||
*/
|
||||
function image_module_test_image_effect_info_alter(&$effects) {
|
||||
$image_effects_definition_called = &drupal_static(__FUNCTION__, 0);
|
||||
$image_effects_definition_called++;
|
||||
}
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
files[] = locale.test
|
||||
configure = admin/config/regional/language
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -201,6 +201,19 @@ function locale_update_7004() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Increase {locales_languages}.formula column's length.
|
||||
*/
|
||||
function locale_update_7005() {
|
||||
db_change_field('languages', 'formula', 'formula', array(
|
||||
'type' => 'varchar',
|
||||
'length' => 255,
|
||||
'not null' => TRUE,
|
||||
'default' => '',
|
||||
'description' => 'Plural formula in PHP code to evaluate to get plural indexes.',
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @} End of "addtogroup updates-7.x-extra".
|
||||
*/
|
||||
@@ -303,7 +316,7 @@ function locale_schema() {
|
||||
),
|
||||
'formula' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 128,
|
||||
'length' => 255,
|
||||
'not null' => TRUE,
|
||||
'default' => '',
|
||||
'description' => 'Plural formula in PHP code to evaluate to get plural indexes.',
|
||||
|
@@ -1033,7 +1033,7 @@ function locale_url_outbound_alter(&$path, &$options, $original_path) {
|
||||
include_once DRUPAL_ROOT . '/includes/language.inc';
|
||||
|
||||
foreach (language_types_configurable() as $type) {
|
||||
// Get url rewriter callbacks only from enabled language providers.
|
||||
// Get URL rewriter callbacks only from enabled language providers.
|
||||
$negotiation = variable_get("language_negotiation_$type", array());
|
||||
|
||||
foreach ($negotiation as $id => $provider) {
|
||||
|
@@ -1958,7 +1958,7 @@ class LocalePathFunctionalTest extends DrupalWebTestCase {
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => 'Path language settings',
|
||||
'description' => 'Checks you can configure a language for individual url aliases.',
|
||||
'description' => 'Checks you can configure a language for individual URL aliases.',
|
||||
'group' => 'Locale',
|
||||
);
|
||||
}
|
||||
@@ -2268,7 +2268,7 @@ class LocaleUILanguageNegotiationTest extends DrupalWebTestCase {
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => 'UI language negotiation',
|
||||
'description' => 'Test UI language switching by url path prefix and domain.',
|
||||
'description' => 'Test UI language switching by URL path prefix and domain.',
|
||||
'group' => 'Locale',
|
||||
);
|
||||
}
|
||||
@@ -2396,7 +2396,7 @@ class LocaleUILanguageNegotiationTest extends DrupalWebTestCase {
|
||||
$this->assertResponse(404, "Unknown language path prefix should return 404");
|
||||
|
||||
// Setup for domain negotiation, first configure the language to have domain
|
||||
// URL. We use https and a port to make sure that only the domain name is used.
|
||||
// URL. We use HTTPS and a port to make sure that only the domain name is used.
|
||||
$edit = array('prefix' => '', 'domain' => "https://$language_domain:99");
|
||||
$this->drupalPost("admin/config/regional/language/edit/$language", $edit, t('Save language'));
|
||||
// Set the site to use domain language negotiation.
|
||||
@@ -2513,7 +2513,7 @@ class LocaleUILanguageNegotiationTest extends DrupalWebTestCase {
|
||||
$languages = language_list();
|
||||
|
||||
foreach (array('it', 'fr') as $langcode) {
|
||||
// Build the link we're going to test based on the clean url setting.
|
||||
// Build the link we're going to test based on the clean URL setting.
|
||||
$link = (!empty($GLOBALS['conf']['clean_url'])) ? $langcode . '.example.com/admin' : $langcode . '.example.com/?q=admin';
|
||||
|
||||
// Test URL in another language.
|
||||
@@ -2524,14 +2524,14 @@ class LocaleUILanguageNegotiationTest extends DrupalWebTestCase {
|
||||
$correct_link = $url_scheme . $link;
|
||||
$this->assertTrue($url == $correct_link, t('The url() function returns the right url (@url) in accordance with the chosen language', array('@url' => $url . " == " . $correct_link)));
|
||||
|
||||
// Test https via options.
|
||||
// Test HTTPS via options.
|
||||
variable_set('https', TRUE);
|
||||
$url = url('admin', array('https' => TRUE, 'language' => $languages[$langcode]));
|
||||
$correct_link = 'https://' . $link;
|
||||
$this->assertTrue($url == $correct_link, t('The url() function returns the right https url (via options) (@url) in accordance with the chosen language', array('@url' => $url . " == " . $correct_link)));
|
||||
variable_set('https', FALSE);
|
||||
|
||||
// Test https via current url scheme.
|
||||
// Test HTTPS via current URL scheme.
|
||||
$temp_https = $is_https;
|
||||
$is_https = TRUE;
|
||||
$url = url('admin', array('language' => $languages[$langcode]));
|
||||
|
@@ -5,8 +5,8 @@ package = Testing
|
||||
version = VERSION
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -99,7 +99,14 @@ function _menu_overview_tree_form($tree) {
|
||||
$mlid = 'mlid:' . $item['mlid'];
|
||||
$form[$mlid]['#item'] = $item;
|
||||
$form[$mlid]['#attributes'] = $item['hidden'] ? array('class' => array('menu-disabled')) : array('class' => array('menu-enabled'));
|
||||
$form[$mlid]['title']['#markup'] = l($item['title'], $item['href'], $item['localized_options']) . ($item['hidden'] ? ' (' . t('disabled') . ')' : '');
|
||||
$form[$mlid]['title']['#markup'] = l($item['title'], $item['href'], $item['localized_options']);
|
||||
if ($item['hidden']) {
|
||||
$form[$mlid]['title']['#markup'] .= ' (' . t('disabled') . ')';
|
||||
}
|
||||
elseif ($item['link_path'] == 'user' && $item['module'] == 'system') {
|
||||
$form[$mlid]['title']['#markup'] .= ' (' . t('logged in users only') . ')';
|
||||
}
|
||||
|
||||
$form[$mlid]['hidden'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Enable @title menu link', array('@title' => $item['title'])),
|
||||
@@ -463,7 +470,6 @@ function menu_edit_menu($form, &$form_state, $type, $menu = array()) {
|
||||
'#machine_name' => array(
|
||||
'exists' => 'menu_edit_menu_name_exists',
|
||||
'source' => array('title'),
|
||||
'label' => t('URL path'),
|
||||
'replace_pattern' => '[^a-z0-9-]+',
|
||||
'replace' => '-',
|
||||
),
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
files[] = menu.test
|
||||
configure = admin/structure/menu
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -498,9 +498,18 @@ function hook_node_revision_delete($node) {
|
||||
/**
|
||||
* Respond to creation of a new node.
|
||||
*
|
||||
* This hook is invoked from node_save() after the node is inserted into the
|
||||
* node table in the database, after the type-specific hook_insert() is invoked,
|
||||
* and after field_attach_insert() is called.
|
||||
* This hook is invoked from node_save() after the database query that will
|
||||
* insert the node into the node table is scheduled for execution, after the
|
||||
* type-specific hook_insert() is invoked, and after field_attach_insert() is
|
||||
* called.
|
||||
*
|
||||
* Note that when this hook is invoked, the changes have not yet been written to
|
||||
* the database, because a database transaction is still in progress. The
|
||||
* transaction is not finalized until the save operation is entirely completed
|
||||
* and node_save() goes out of scope. You should not rely on data in the
|
||||
* database at this time as it is not updated yet. You should also note that any
|
||||
* write/update database queries executed from this hook are also not committed
|
||||
* immediately. Check node_save() and db_transaction() for more info.
|
||||
*
|
||||
* @param $node
|
||||
* The node that is being created.
|
||||
@@ -517,40 +526,43 @@ function hook_node_insert($node) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Act on nodes being loaded from the database.
|
||||
* Act on arbitrary nodes being loaded from the database.
|
||||
*
|
||||
* This hook is invoked during node loading, which is handled by entity_load(),
|
||||
* via classes NodeController and DrupalDefaultEntityController. After the node
|
||||
* information is read from the database or the entity cache, hook_load() is
|
||||
* invoked on the node's content type module, then field_attach_node_revision()
|
||||
* or field_attach_load() is called, then hook_entity_load() is invoked on all
|
||||
* implementing modules, and finally hook_node_load() is invoked on all
|
||||
* implementing modules.
|
||||
*
|
||||
* This hook should only be used to add information that is not in the node or
|
||||
* This hook should be used to add information that is not in the node or
|
||||
* node revisions table, not to replace information that is in these tables
|
||||
* (which could interfere with the entity cache). For performance reasons,
|
||||
* information for all available nodes should be loaded in a single query where
|
||||
* possible.
|
||||
*
|
||||
* The $types parameter allows for your module to have an early return (for
|
||||
* efficiency) if your module only supports certain node types. However, if your
|
||||
* module defines a content type, you can use hook_load() to respond to loading
|
||||
* of just that content type.
|
||||
* This hook is invoked during node loading, which is handled by entity_load(),
|
||||
* via classes NodeController and DrupalDefaultEntityController. After the node
|
||||
* information is read from the database or the entity cache, hook_load() is
|
||||
* invoked on the node's content type module, then field_attach_load_revision()
|
||||
* or field_attach_load() is called, then hook_entity_load() is invoked on all
|
||||
* implementing modules, and finally hook_node_load() is invoked on all
|
||||
* implementing modules.
|
||||
*
|
||||
* @param $nodes
|
||||
* An array of the nodes being loaded, keyed by nid.
|
||||
* @param $types
|
||||
* An array containing the types of the nodes.
|
||||
* An array containing the node types present in $nodes. Allows for an early
|
||||
* return for modules that only support certain node types. However, if your
|
||||
* module defines a content type, you can use hook_load() to respond to
|
||||
* loading of just that content type.
|
||||
*
|
||||
* For a detailed usage example, see nodeapi_example.module.
|
||||
*
|
||||
* @ingroup node_api_hooks
|
||||
*/
|
||||
function hook_node_load($nodes, $types) {
|
||||
$result = db_query('SELECT nid, foo FROM {mytable} WHERE nid IN(:nids)', array(':nids' => array_keys($nodes)));
|
||||
foreach ($result as $record) {
|
||||
$nodes[$record->nid]->foo = $record->foo;
|
||||
// Decide whether any of $types are relevant to our purposes.
|
||||
if (count(array_intersect($types_we_want_to_process, $types))) {
|
||||
// Gather our extra data for each of these nodes.
|
||||
$result = db_query('SELECT nid, foo FROM {mytable} WHERE nid IN(:nids)', array(':nids' => array_keys($nodes)));
|
||||
// Add our extra data to the node objects.
|
||||
foreach ($result as $record) {
|
||||
$nodes[$record->nid]->foo = $record->foo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -684,9 +696,18 @@ function hook_node_presave($node) {
|
||||
/**
|
||||
* Respond to updates to a node.
|
||||
*
|
||||
* This hook is invoked from node_save() after the node is updated in the node
|
||||
* table in the database, after the type-specific hook_update() is invoked, and
|
||||
* after field_attach_update() is called.
|
||||
* This hook is invoked from node_save() after the database query that will
|
||||
* update node in the node table is scheduled for execution, after the
|
||||
* type-specific hook_update() is invoked, and after field_attach_update() is
|
||||
* called.
|
||||
*
|
||||
* Note that when this hook is invoked, the changes have not yet been written to
|
||||
* the database, because a database transaction is still in progress. The
|
||||
* transaction is not finalized until the save operation is entirely completed
|
||||
* and node_save() goes out of scope. You should not rely on data in the
|
||||
* database at this time as it is not updated yet. You should also note that any
|
||||
* write/update database queries executed from this hook are also not committed
|
||||
* immediately. Check node_save() and db_transaction() for more info.
|
||||
*
|
||||
* @param $node
|
||||
* The node that is being updated.
|
||||
|
@@ -9,8 +9,8 @@ required = TRUE
|
||||
configure = admin/structure/types
|
||||
stylesheets[all][] = node.css
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -474,7 +474,7 @@ function node_update_dependencies() {
|
||||
*
|
||||
* This function is valid for a database schema version 7000.
|
||||
*
|
||||
* @ingroup update-api-6.x-to-7.x
|
||||
* @ingroup update_api
|
||||
*/
|
||||
function _update_7000_node_get_types() {
|
||||
$node_types = db_query('SELECT * FROM {node_type}')->fetchAllAssoc('type', PDO::FETCH_OBJ);
|
||||
|
@@ -243,7 +243,7 @@ function node_field_display_node_alter(&$display, $context) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Entity uri callback.
|
||||
* Entity URI callback.
|
||||
*/
|
||||
function node_uri($node) {
|
||||
return array(
|
||||
@@ -1345,6 +1345,14 @@ function node_build_content($node, $view_mode = 'full', $langcode = NULL) {
|
||||
// Remove previously built content, if exists.
|
||||
$node->content = array();
|
||||
|
||||
// Allow modules to change the view mode.
|
||||
$context = array(
|
||||
'entity_type' => 'node',
|
||||
'entity' => $node,
|
||||
'langcode' => $langcode,
|
||||
);
|
||||
drupal_alter('entity_view_mode', $view_mode, $context);
|
||||
|
||||
// The 'view' hook can be implemented to overwrite the default function
|
||||
// to display nodes.
|
||||
if (node_hook($node, 'view')) {
|
||||
@@ -1385,6 +1393,10 @@ function node_build_content($node, $view_mode = 'full', $langcode = NULL) {
|
||||
// Allow modules to make their own additions to the node.
|
||||
module_invoke_all('node_view', $node, $view_mode, $langcode);
|
||||
module_invoke_all('entity_view', $node, 'node', $view_mode, $langcode);
|
||||
|
||||
// Make sure the current view mode is stored if no module has already
|
||||
// populated the related key.
|
||||
$node->content += array('#view_mode' => $view_mode);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1984,6 +1996,9 @@ function node_menu() {
|
||||
'page callback' => 'node_feed',
|
||||
'access arguments' => array('access content'),
|
||||
'type' => MENU_CALLBACK,
|
||||
// Pass a FALSE and array argument to ensure that additional path components
|
||||
// are not passed to node_feed().
|
||||
'page arguments' => array(FALSE, array()),
|
||||
);
|
||||
// @todo Remove this loop when we have a 'description callback' property.
|
||||
// Reset internal static cache of _node_types_build(), forces to rebuild the
|
||||
@@ -2578,10 +2593,10 @@ function node_view_multiple($nodes, $view_mode = 'teaser', $weight = 0, $langcod
|
||||
function node_page_default() {
|
||||
$select = db_select('node', 'n')
|
||||
->fields('n', array('nid', 'sticky', 'created'))
|
||||
->condition('promote', 1)
|
||||
->condition('status', 1)
|
||||
->orderBy('sticky', 'DESC')
|
||||
->orderBy('created', 'DESC')
|
||||
->condition('n.promote', 1)
|
||||
->condition('n.status', 1)
|
||||
->orderBy('n.sticky', 'DESC')
|
||||
->orderBy('n.created', 'DESC')
|
||||
->extend('PagerDefault')
|
||||
->limit(variable_get('default_nodes_main', 10))
|
||||
->addTag('node_access');
|
||||
@@ -2764,7 +2779,7 @@ function node_search_validate($form, &$form_state) {
|
||||
|
||||
// Insert extra restrictions into the search keywords string.
|
||||
if (isset($form_state['values']['type']) && is_array($form_state['values']['type'])) {
|
||||
// Retrieve selected types - Forms API sets the value of unselected
|
||||
// Retrieve selected types - Form API sets the value of unselected
|
||||
// checkboxes to 0.
|
||||
$form_state['values']['type'] = array_filter($form_state['values']['type']);
|
||||
if (count($form_state['values']['type'])) {
|
||||
@@ -3891,24 +3906,25 @@ function node_unpublish_by_keyword_action($node, $context) {
|
||||
*/
|
||||
function node_requirements($phase) {
|
||||
$requirements = array();
|
||||
// Ensure translations don't break at install time
|
||||
$t = get_t();
|
||||
// Only show rebuild button if there are either 0, or 2 or more, rows
|
||||
// in the {node_access} table, or if there are modules that
|
||||
// implement hook_node_grants().
|
||||
$grant_count = db_query('SELECT COUNT(*) FROM {node_access}')->fetchField();
|
||||
if ($grant_count != 1 || count(module_implements('node_grants')) > 0) {
|
||||
$value = format_plural($grant_count, 'One permission in use', '@count permissions in use', array('@count' => $grant_count));
|
||||
} else {
|
||||
$value = $t('Disabled');
|
||||
}
|
||||
$description = $t('If the site is experiencing problems with permissions to content, you may have to rebuild the permissions cache. Rebuilding will remove all privileges to content and replace them with permissions based on the current modules and settings. Rebuilding may take some time if there is a lot of content or complex permission settings. After rebuilding has completed, content will automatically use the new permissions.');
|
||||
if ($phase === 'runtime') {
|
||||
// Only show rebuild button if there are either 0, or 2 or more, rows
|
||||
// in the {node_access} table, or if there are modules that
|
||||
// implement hook_node_grants().
|
||||
$grant_count = db_query('SELECT COUNT(*) FROM {node_access}')->fetchField();
|
||||
if ($grant_count != 1 || count(module_implements('node_grants')) > 0) {
|
||||
$value = format_plural($grant_count, 'One permission in use', '@count permissions in use', array('@count' => $grant_count));
|
||||
}
|
||||
else {
|
||||
$value = t('Disabled');
|
||||
}
|
||||
$description = t('If the site is experiencing problems with permissions to content, you may have to rebuild the permissions cache. Rebuilding will remove all privileges to content and replace them with permissions based on the current modules and settings. Rebuilding may take some time if there is a lot of content or complex permission settings. After rebuilding has completed, content will automatically use the new permissions.');
|
||||
|
||||
$requirements['node_access'] = array(
|
||||
'title' => $t('Node Access Permissions'),
|
||||
'value' => $value,
|
||||
'description' => $description . ' ' . l(t('Rebuild permissions'), 'admin/reports/status/rebuild'),
|
||||
);
|
||||
$requirements['node_access'] = array(
|
||||
'title' => t('Node Access Permissions'),
|
||||
'value' => $value,
|
||||
'description' => $description . ' ' . l(t('Rebuild permissions'), 'admin/reports/status/rebuild'),
|
||||
);
|
||||
}
|
||||
return $requirements;
|
||||
}
|
||||
|
||||
|
@@ -695,7 +695,7 @@ class NodeBlockTestCase extends DrupalWebTestCase {
|
||||
$this->drupalLogin($admin_user);
|
||||
}
|
||||
|
||||
function testSearchFormBlock() {
|
||||
function testSyndicateBlock() {
|
||||
// Set block title to confirm that the interface is available.
|
||||
$this->drupalPost('admin/structure/block/manage/node/syndicate/configure', array('title' => $this->randomName(8)), t('Save block'));
|
||||
$this->assertText(t('The block configuration has been saved.'), t('Block configuration set.'));
|
||||
@@ -832,7 +832,11 @@ class NodeRSSContentTestCase extends DrupalWebTestCase {
|
||||
// viewing node.
|
||||
$this->drupalGet("node/$node->nid");
|
||||
$this->assertNoText($rss_only_content, t('Node content designed for RSS doesn\'t appear when viewing node.'));
|
||||
|
||||
|
||||
// Check that the node feed page does not try to interpret additional path
|
||||
// components as arguments for node_feed() and returns default content.
|
||||
$this->drupalGet('rss.xml/' . $this->randomName() . '/' . $this->randomName());
|
||||
$this->assertText($rss_only_content, t('Ignore page arguments when delivering rss.xml.'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2030,9 +2034,9 @@ class NodeQueryAlter extends DrupalWebTestCase {
|
||||
|
||||
// Create user with simple node access permission. The 'node test view'
|
||||
// permission is implemented and granted by the node_access_test module.
|
||||
$this->accessUser = $this->drupalCreateUser(array('access content', 'node test view'));
|
||||
$this->noAccessUser = $this->drupalCreateUser(array('access content'));
|
||||
$this->noAccessUser2 = $this->drupalCreateUser(array('access content'));
|
||||
$this->accessUser = $this->drupalCreateUser(array('access content overview', 'access content', 'node test view'));
|
||||
$this->noAccessUser = $this->drupalCreateUser(array('access content overview', 'access content'));
|
||||
$this->noAccessUser2 = $this->drupalCreateUser(array('access content overview', 'access content'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2045,11 +2049,19 @@ class NodeQueryAlter extends DrupalWebTestCase {
|
||||
$this->assertText('Yes, 4 nodes', "4 nodes were found for access user");
|
||||
$this->assertNoText('Exception', "No database exception");
|
||||
|
||||
// Test the content overview page.
|
||||
$this->drupalGet('admin/content');
|
||||
$table_rows = $this->xpath('//tbody/tr');
|
||||
$this->assertEqual(4, count($table_rows), "4 nodes were found for access user");
|
||||
|
||||
// Verify that a user with no access permission cannot see nodes.
|
||||
$this->drupalLogin($this->noAccessUser);
|
||||
$this->drupalGet('node_access_test_page');
|
||||
$this->assertText('No nodes', "No nodes were found for no access user");
|
||||
$this->assertNoText('Exception', "No database exception");
|
||||
|
||||
$this->drupalGet('admin/content');
|
||||
$this->assertText(t('No content available.'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2474,24 +2486,24 @@ class NodeAccessPagerTestCase extends DrupalWebTestCase {
|
||||
// View the node page. With the default 50 comments per page there should
|
||||
// be two pages (0, 1) but no third (2) page.
|
||||
$this->drupalGet('node/' . $node->nid);
|
||||
$this->assertText($node->title, t('Node title found.'));
|
||||
$this->assertText(t('Comments'), t('Has a comments section.'));
|
||||
$this->assertRaw('page=1', t('Secound page exists.'));
|
||||
$this->assertNoRaw('page=2', t('No third page exists.'));
|
||||
$this->assertText($node->title);
|
||||
$this->assertText(t('Comments'));
|
||||
$this->assertRaw('page=1');
|
||||
$this->assertNoRaw('page=2');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the forum node pager for nodes with multiple grants per realm.
|
||||
*/
|
||||
public function testForumPager() {
|
||||
// Lookup the forums vocabulary vid.
|
||||
// Look up the forums vocabulary ID.
|
||||
$vid = variable_get('forum_nav_vocabulary', 0);
|
||||
$this->assertTrue($vid, t('Forum navigation vocabulary found.'));
|
||||
$this->assertTrue($vid, 'Forum navigation vocabulary ID is set.');
|
||||
|
||||
// Lookup the general discussion term.
|
||||
// Look up the general discussion term.
|
||||
$tree = taxonomy_get_tree($vid, 0, 1);
|
||||
$tid = reset($tree)->tid;
|
||||
$this->assertTrue($tid, t('General discussion term found.'));
|
||||
$this->assertTrue($tid, 'General discussion term is found in the forum vocabulary.');
|
||||
|
||||
// Create 30 nodes.
|
||||
for ($i = 0; $i < 30; $i++) {
|
||||
@@ -2510,8 +2522,8 @@ class NodeAccessPagerTestCase extends DrupalWebTestCase {
|
||||
// page there should be two pages for 30 nodes, no more.
|
||||
$this->drupalLogin($this->web_user);
|
||||
$this->drupalGet('forum/' . $tid);
|
||||
$this->assertRaw('page=1', t('Secound page exists.'));
|
||||
$this->assertNoRaw('page=2', t('No third page exists.'));
|
||||
$this->assertRaw('page=1');
|
||||
$this->assertNoRaw('page=2');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2589,3 +2601,52 @@ class NodeAccessFieldTestCase extends NodeWebTestCase {
|
||||
$this->assertRaw($default, 'The updated default value is displayed when creating a new node.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests changing view modes for nodes.
|
||||
*/
|
||||
class NodeEntityViewModeAlterTest extends NodeWebTestCase {
|
||||
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => 'Node entity view mode',
|
||||
'description' => 'Test changing view mode.',
|
||||
'group' => 'Node'
|
||||
);
|
||||
}
|
||||
|
||||
function setUp() {
|
||||
parent::setUp(array('node_test'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a "Basic page" node and verify its consistency in the database.
|
||||
*/
|
||||
function testNodeViewModeChange() {
|
||||
$web_user = $this->drupalCreateUser(array('create page content', 'edit own page content'));
|
||||
$this->drupalLogin($web_user);
|
||||
|
||||
// Create a node.
|
||||
$edit = array();
|
||||
$langcode = LANGUAGE_NONE;
|
||||
$edit["title"] = $this->randomName(8);
|
||||
$edit["body[$langcode][0][value]"] = t('Data that should appear only in the body for the node.');
|
||||
$edit["body[$langcode][0][summary]"] = t('Extra data that should appear only in the teaser for the node.');
|
||||
$this->drupalPost('node/add/page', $edit, t('Save'));
|
||||
|
||||
$node = $this->drupalGetNodeByTitle($edit["title"]);
|
||||
|
||||
// Set the flag to alter the view mode and view the node.
|
||||
variable_set('node_test_change_view_mode', 'teaser');
|
||||
$this->drupalGet('node/' . $node->nid);
|
||||
|
||||
// Check that teaser mode is viewed.
|
||||
$this->assertText('Extra data that should appear only in the teaser for the node.', 'Teaser text present');
|
||||
// Make sure body text is not present.
|
||||
$this->assertNoText('Data that should appear only in the body for the node.', 'Body text not present');
|
||||
|
||||
// Test that the correct build mode has been set.
|
||||
$build = node_view($node);
|
||||
$this->assertEqual($build['#view_mode'], 'teaser', 'The view mode has correctly been set to teaser.');
|
||||
}
|
||||
}
|
||||
|
@@ -14,7 +14,7 @@
|
||||
* - $date: Formatted creation date. Preprocess functions can reformat it by
|
||||
* calling format_date() with the desired parameters on the $created variable.
|
||||
* - $name: Themed username of node author output from theme_username().
|
||||
* - $node_url: Direct url of the current node.
|
||||
* - $node_url: Direct URL of the current node.
|
||||
* - $display_submitted: Whether submission information should be displayed.
|
||||
* - $submitted: Submission information created from $name and $date during
|
||||
* template_preprocess_node().
|
||||
@@ -22,7 +22,7 @@
|
||||
* CSS. It can be manipulated through the variable $classes_array from
|
||||
* preprocess functions. The default values can be one or more of the
|
||||
* following:
|
||||
* - node: The current template type, i.e., "theming hook".
|
||||
* - node: The current template type; for example, "theming hook".
|
||||
* - node-[type]: The current node type. For example, if the node is a
|
||||
* "Blog entry" it would result in "node-blog". Note that the machine
|
||||
* name will often be in a short form of the human readable label.
|
||||
@@ -42,7 +42,7 @@
|
||||
*
|
||||
* Other variables:
|
||||
* - $node: Full node object. Contains data that may not be safe.
|
||||
* - $type: Node type, i.e. story, page, blog, etc.
|
||||
* - $type: Node type; for example, story, page, blog, etc.
|
||||
* - $comment_count: Number of comments attached to the node.
|
||||
* - $uid: User ID of the node author.
|
||||
* - $created: Time the node was published formatted in Unix timestamp.
|
||||
@@ -53,7 +53,7 @@
|
||||
* - $id: Position of the node. Increments each time it's output.
|
||||
*
|
||||
* Node status variables:
|
||||
* - $view_mode: View mode, e.g. 'full', 'teaser'...
|
||||
* - $view_mode: View mode; for example, "full", "teaser".
|
||||
* - $teaser: Flag for the teaser state (shortcut for $view_mode == 'teaser').
|
||||
* - $page: Flag for the full page state.
|
||||
* - $promote: Flag for front page promotion state.
|
||||
@@ -67,15 +67,17 @@
|
||||
* - $is_admin: Flags true when the current user is an administrator.
|
||||
*
|
||||
* Field variables: for each field instance attached to the node a corresponding
|
||||
* variable is defined, e.g. $node->body becomes $body. When needing to access
|
||||
* a field's raw values, developers/themers are strongly encouraged to use these
|
||||
* variables. Otherwise they will have to explicitly specify the desired field
|
||||
* language, e.g. $node->body['en'], thus overriding any language negotiation
|
||||
* rule that was previously applied.
|
||||
* variable is defined; for example, $node->body becomes $body. When needing to
|
||||
* access a field's raw values, developers/themers are strongly encouraged to
|
||||
* use these variables. Otherwise they will have to explicitly specify the
|
||||
* desired field language; for example, $node->body['en'], thus overriding any
|
||||
* language negotiation rule that was previously applied.
|
||||
*
|
||||
* @see template_preprocess()
|
||||
* @see template_preprocess_node()
|
||||
* @see template_process()
|
||||
*
|
||||
* @ingroup themeable
|
||||
*/
|
||||
?>
|
||||
<div id="node-<?php print $node->nid; ?>" class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>>
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -149,3 +149,13 @@ function node_test_node_update($node) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_entity_view_mode_alter().
|
||||
*/
|
||||
function node_test_entity_view_mode_alter(&$view_mode, $context) {
|
||||
// Only alter the view mode if we are on the test callback.
|
||||
if ($change_view_mode = variable_get('node_test_change_view_mode', '')) {
|
||||
$view_mode = $change_view_mode;
|
||||
}
|
||||
}
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -858,7 +858,7 @@ function _openid_invalid_openid_transition($identity, $response) {
|
||||
$fallback_account = user_external_load($fallback_identity);
|
||||
}
|
||||
|
||||
// Try to replace https with http. OpenID providers often redirect
|
||||
// Try to replace HTTPS with HTTP. OpenID providers often redirect
|
||||
// from http to https, but Drupal didn't follow the redirect.
|
||||
if (!$fallback_account && strpos($fallback_identity, 'https://') !== FALSE) {
|
||||
$fallback_identity = str_replace('https://', 'http://', $fallback_identity);
|
||||
|
@@ -5,8 +5,8 @@ package = Core
|
||||
core = 7.x
|
||||
files[] = openid.test
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -428,7 +428,7 @@ function openid_discovery($claimed_id) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_openid_discovery_method_info().
|
||||
* Implements hook_openid_discovery_method_info().
|
||||
*
|
||||
* Define standard discovery methods.
|
||||
*/
|
||||
@@ -566,7 +566,7 @@ function _openid_xrds_discovery($claimed_id) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_openid_normalization_method_info().
|
||||
* Implements hook_openid_normalization_method_info().
|
||||
*
|
||||
* Define standard normalization methods.
|
||||
*/
|
||||
@@ -1010,7 +1010,7 @@ function openid_verify_assertion_return_url($service, $response) {
|
||||
/**
|
||||
* Remove expired nonces from the database.
|
||||
*
|
||||
* Implementation of hook_cron().
|
||||
* Implements hook_cron().
|
||||
*/
|
||||
function openid_cron() {
|
||||
db_delete('openid_nonce')
|
||||
|
@@ -56,6 +56,7 @@ function openid_user_identities($account) {
|
||||
'#theme' => 'table',
|
||||
'#header' => $header,
|
||||
'#rows' => $rows,
|
||||
'#empty' => t('No OpenID identities available for this account.'),
|
||||
);
|
||||
$build['openid_user_add'] = drupal_get_form('openid_user_add');
|
||||
return $build;
|
||||
|
@@ -19,7 +19,7 @@ abstract class OpenIDWebTestCase extends DrupalWebTestCase {
|
||||
$this->drupalPost('', $edit, t('Log in'));
|
||||
|
||||
// Check we are on the OpenID redirect form.
|
||||
$this->assertTitle(t('OpenID redirect'), t('OpenID redirect page was displayed.'));
|
||||
$this->assertTitle(t('OpenID redirect'), 'OpenID redirect page was displayed.');
|
||||
|
||||
// Submit form to the OpenID Provider Endpoint.
|
||||
$this->drupalPost(NULL, array(), t('Send'));
|
||||
@@ -78,13 +78,13 @@ class OpenIDFunctionalTestCase extends OpenIDWebTestCase {
|
||||
// the URL of the OpenID Provider Endpoint.
|
||||
|
||||
// Identifier is the URL of an XRDS document.
|
||||
// The URL scheme is stripped in order to test that the supplied identifier
|
||||
// is normalized in openid_begin().
|
||||
// On HTTP test environments, the URL scheme is stripped in order to test
|
||||
// that the supplied identifier is normalized in openid_begin().
|
||||
$identity = url('openid-test/yadis/xrds', array('absolute' => TRUE));
|
||||
$this->addIdentity(preg_replace('@^https?://@', '', $identity), 2, 'http://example.com/xrds', $identity);
|
||||
$this->addIdentity(preg_replace('@^http://@', '', $identity), 2, 'http://example.com/xrds', $identity);
|
||||
|
||||
$identity = url('openid-test/yadis/xrds/delegate', array('absolute' => TRUE));
|
||||
$this->addIdentity(preg_replace('@^https?://@', '', $identity), 2, 'http://example.com/xrds-delegate', $identity);
|
||||
$this->addIdentity(preg_replace('@^http://@', '', $identity), 2, 'http://example.com/xrds-delegate', $identity);
|
||||
|
||||
// Identifier is the URL of an XRDS document containing an OP Identifier
|
||||
// Element. The Relying Party sends the special value
|
||||
@@ -92,8 +92,8 @@ class OpenIDFunctionalTestCase extends OpenIDWebTestCase {
|
||||
// Identifier. The OpenID Provider responds with the actual identifier
|
||||
// including the fragment.
|
||||
$identity = url('openid-test/yadis/xrds/dummy-user', array('absolute' => TRUE, 'fragment' => $this->randomName()));
|
||||
// Tell openid_test.module to respond with this identifier. We test if
|
||||
// openid_complete() processes it right.
|
||||
// Tell openid_test.module to respond with this identifier. If the fragment
|
||||
// part is present in the identifier, it should be retained.
|
||||
variable_set('openid_test_response', array('openid.claimed_id' => $identity));
|
||||
$this->addIdentity(url('openid-test/yadis/xrds/server', array('absolute' => TRUE)), 2, 'http://specs.openid.net/auth/2.0/identifier_select', $identity);
|
||||
variable_set('openid_test_response', array());
|
||||
@@ -162,7 +162,7 @@ class OpenIDFunctionalTestCase extends OpenIDWebTestCase {
|
||||
|
||||
// Test logging in via the login block on the front page.
|
||||
$this->submitLoginForm($identity);
|
||||
$this->assertLink(t('Log out'), 0, t('User was logged in.'));
|
||||
$this->assertLink(t('Log out'), 0, 'User was logged in.');
|
||||
|
||||
$this->drupalLogout();
|
||||
|
||||
@@ -171,12 +171,12 @@ class OpenIDFunctionalTestCase extends OpenIDWebTestCase {
|
||||
$this->drupalPost('user/login', $edit, t('Log in'));
|
||||
|
||||
// Check we are on the OpenID redirect form.
|
||||
$this->assertTitle(t('OpenID redirect'), t('OpenID redirect page was displayed.'));
|
||||
$this->assertTitle(t('OpenID redirect'), 'OpenID redirect page was displayed.');
|
||||
|
||||
// Submit form to the OpenID Provider Endpoint.
|
||||
$this->drupalPost(NULL, array(), t('Send'));
|
||||
|
||||
$this->assertLink(t('Log out'), 0, t('User was logged in.'));
|
||||
$this->assertLink(t('Log out'), 0, 'User was logged in.');
|
||||
|
||||
// Verify user was redirected away from user/login to an accessible page.
|
||||
$this->assertResponse(200);
|
||||
@@ -211,12 +211,12 @@ class OpenIDFunctionalTestCase extends OpenIDWebTestCase {
|
||||
$this->drupalPost('user/login', $edit, t('Log in'));
|
||||
|
||||
// Check we are on the OpenID redirect form.
|
||||
$this->assertTitle(t('OpenID redirect'), t('OpenID redirect page was displayed.'));
|
||||
$this->assertTitle(t('OpenID redirect'), 'OpenID redirect page was displayed.');
|
||||
|
||||
// Submit form to the OpenID Provider Endpoint.
|
||||
$this->drupalPost(NULL, array(), t('Send'));
|
||||
|
||||
$this->assertLink(t('Log out'), 0, t('User was logged in.'));
|
||||
$this->assertLink(t('Log out'), 0, 'User was logged in.');
|
||||
|
||||
// Verify user was redirected away from user/login to an accessible page.
|
||||
$this->assertText(t('Operating in maintenance mode.'));
|
||||
@@ -232,14 +232,14 @@ class OpenIDFunctionalTestCase extends OpenIDWebTestCase {
|
||||
// Add identity to user's profile.
|
||||
$identity = url('openid-test/yadis/xrds', array('absolute' => TRUE));
|
||||
$this->addIdentity($identity);
|
||||
$this->assertText($identity, t('Identity appears in list.'));
|
||||
$this->assertText($identity, 'Identity appears in list.');
|
||||
|
||||
// Delete the newly added identity.
|
||||
$this->clickLink(t('Delete'));
|
||||
$this->drupalPost(NULL, array(), t('Confirm'));
|
||||
|
||||
$this->assertText(t('OpenID deleted.'), t('Identity deleted'));
|
||||
$this->assertNoText($identity, t('Identity no longer appears in list.'));
|
||||
$this->assertText(t('OpenID deleted.'), 'Identity deleted');
|
||||
$this->assertNoText($identity, 'Identity no longer appears in list.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -263,11 +263,11 @@ class OpenIDFunctionalTestCase extends OpenIDWebTestCase {
|
||||
'accounts[' . $this->web_user->uid . ']' => TRUE,
|
||||
);
|
||||
$this->drupalPost('admin/people', $edit, t('Update'));
|
||||
$this->assertRaw('The update has been performed.', t('Account was blocked.'));
|
||||
$this->assertRaw('The update has been performed.', 'Account was blocked.');
|
||||
$this->drupalLogout();
|
||||
|
||||
$this->submitLoginForm($identity);
|
||||
$this->assertRaw(t('The username %name has not been activated or is blocked.', array('%name' => $this->web_user->name)), t('User login was blocked.'));
|
||||
$this->assertRaw(t('The username %name has not been activated or is blocked.', array('%name' => $this->web_user->name)), 'User login was blocked.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -291,14 +291,14 @@ class OpenIDFunctionalTestCase extends OpenIDWebTestCase {
|
||||
$this->drupalPost('user/' . $this->web_user->uid . '/openid', $edit, t('Add an OpenID'));
|
||||
|
||||
if ($claimed_id === FALSE) {
|
||||
$this->assertRaw(t('Sorry, that is not a valid OpenID. Ensure you have spelled your ID correctly.'), t('Invalid identity was rejected.'));
|
||||
$this->assertRaw(t('Sorry, that is not a valid OpenID. Ensure you have spelled your ID correctly.'), 'Invalid identity was rejected.');
|
||||
return;
|
||||
}
|
||||
|
||||
// OpenID 1 used a HTTP redirect, OpenID 2 uses a HTML form that is submitted automatically using JavaScript.
|
||||
if ($version == 2) {
|
||||
// Check we are on the OpenID redirect form.
|
||||
$this->assertTitle(t('OpenID redirect'), t('OpenID redirect page was displayed.'));
|
||||
$this->assertTitle(t('OpenID redirect'), 'OpenID redirect page was displayed.');
|
||||
|
||||
// Submit form to the OpenID Provider Endpoint.
|
||||
$this->drupalPost(NULL, array(), t('Send'));
|
||||
@@ -307,7 +307,7 @@ class OpenIDFunctionalTestCase extends OpenIDWebTestCase {
|
||||
if (!isset($claimed_id)) {
|
||||
$claimed_id = $identity;
|
||||
}
|
||||
$this->assertRaw(t('Successfully added %identity', array('%identity' => $claimed_id)), t('Identity %identity was added.', array('%identity' => $identity)));
|
||||
$this->assertRaw(t('Successfully added %identity', array('%identity' => $claimed_id)), format_string('Identity %identity was added.', array('%identity' => $identity)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -380,8 +380,8 @@ class OpenIDFunctionalTestCase extends OpenIDWebTestCase {
|
||||
variable_set('openid_test_response', $response);
|
||||
$this->submitLoginForm($identity);
|
||||
$this->assertNoRaw('OpenID login failed.');
|
||||
$this->assertFieldByName('name', '', t('No username was supplied by provider.'));
|
||||
$this->assertFieldByName('mail', '', t('No e-mail address was supplied by provider.'));
|
||||
$this->assertFieldByName('name', '', 'No username was supplied by provider.');
|
||||
$this->assertFieldByName('mail', '', 'No e-mail address was supplied by provider.');
|
||||
|
||||
// Check that unsigned SREG fields are ignored.
|
||||
$response = array(
|
||||
@@ -392,8 +392,8 @@ class OpenIDFunctionalTestCase extends OpenIDWebTestCase {
|
||||
variable_set('openid_test_response', $response);
|
||||
$this->submitLoginForm($identity);
|
||||
$this->assertNoRaw('OpenID login failed.');
|
||||
$this->assertFieldByName('name', 'john', t('Username was supplied by provider.'));
|
||||
$this->assertFieldByName('mail', '', t('E-mail address supplied by provider was ignored.'));
|
||||
$this->assertFieldByName('name', 'john', 'Username was supplied by provider.');
|
||||
$this->assertFieldByName('mail', '', 'E-mail address supplied by provider was ignored.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -426,14 +426,14 @@ class OpenIDRegistrationTestCase extends OpenIDWebTestCase {
|
||||
// Use a User-supplied Identity that is the URL of an XRDS document.
|
||||
$identity = url('openid-test/yadis/xrds', array('absolute' => TRUE));
|
||||
$this->submitLoginForm($identity);
|
||||
$this->assertRaw(t('Once you have verified your e-mail address, you may log in via OpenID.'), t('User was asked to verify e-mail address.'));
|
||||
$this->assertRaw(t('A welcome message with further instructions has been sent to your e-mail address.'), t('A welcome message was sent to the user.'));
|
||||
$this->assertRaw(t('Once you have verified your e-mail address, you may log in via OpenID.'), 'User was asked to verify e-mail address.');
|
||||
$this->assertRaw(t('A welcome message with further instructions has been sent to your e-mail address.'), 'A welcome message was sent to the user.');
|
||||
$reset_url = $this->getPasswordResetURLFromMail();
|
||||
|
||||
$user = user_load_by_name('john');
|
||||
$this->assertTrue($user, t('User was registered with right username.'));
|
||||
$this->assertEqual($user->mail, 'john@example.com', t('User was registered with right email address.'));
|
||||
$this->assertFalse($user->data, t('No additional user info was saved.'));
|
||||
$this->assertTrue($user, 'User was registered with right username.');
|
||||
$this->assertEqual($user->mail, 'john@example.com', 'User was registered with right email address.');
|
||||
$this->assertFalse($user->data, 'No additional user info was saved.');
|
||||
|
||||
$this->submitLoginForm($identity);
|
||||
$this->assertRaw(t('You must validate your email address for this account before logging in via OpenID.'));
|
||||
@@ -446,7 +446,7 @@ class OpenIDRegistrationTestCase extends OpenIDWebTestCase {
|
||||
|
||||
// Verify that the account was activated.
|
||||
$this->submitLoginForm($identity);
|
||||
$this->assertLink(t('Log out'), 0, t('User was logged in.'));
|
||||
$this->assertLink(t('Log out'), 0, 'User was logged in.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -461,17 +461,17 @@ class OpenIDRegistrationTestCase extends OpenIDWebTestCase {
|
||||
// Use a User-supplied Identity that is the URL of an XRDS document.
|
||||
$identity = url('openid-test/yadis/xrds', array('absolute' => TRUE));
|
||||
$this->submitLoginForm($identity);
|
||||
$this->assertLink(t('Log out'), 0, t('User was logged in.'));
|
||||
$this->assertLink(t('Log out'), 0, 'User was logged in.');
|
||||
|
||||
$user = user_load_by_name('john');
|
||||
$this->assertTrue($user, t('User was registered with right username.'));
|
||||
$this->assertEqual($user->mail, 'john@example.com', t('User was registered with right email address.'));
|
||||
$this->assertFalse($user->data, t('No additional user info was saved.'));
|
||||
$this->assertTrue($user, 'User was registered with right username.');
|
||||
$this->assertEqual($user->mail, 'john@example.com', 'User was registered with right email address.');
|
||||
$this->assertFalse($user->data, 'No additional user info was saved.');
|
||||
|
||||
$this->drupalLogout();
|
||||
|
||||
$this->submitLoginForm($identity);
|
||||
$this->assertLink(t('Log out'), 0, t('User was logged in.'));
|
||||
$this->assertLink(t('Log out'), 0, 'User was logged in.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -487,29 +487,29 @@ class OpenIDRegistrationTestCase extends OpenIDWebTestCase {
|
||||
$identity = url('openid-test/yadis/xrds', array('absolute' => TRUE));
|
||||
$this->submitLoginForm($identity);
|
||||
|
||||
$this->assertRaw(t('Account registration using the information provided by your OpenID provider failed due to the reasons listed below. Complete the registration by filling out the form below. If you already have an account, you can <a href="@login">log in</a> now and add your OpenID under "My account".', array('@login' => url('user/login'))), t('User was asked to complete the registration process manually.'));
|
||||
$this->assertRaw(t('The name %name is already taken.', array('%name' => $web_user->name)), t('Form validation error for username was displayed.'));
|
||||
$this->assertRaw(t('The e-mail address %mail is not valid.', array('%mail' => 'mail@invalid#')), t('Form validation error for e-mail address was displayed.'));
|
||||
$this->assertRaw(t('Account registration using the information provided by your OpenID provider failed due to the reasons listed below. Complete the registration by filling out the form below. If you already have an account, you can <a href="@login">log in</a> now and add your OpenID under "My account".', array('@login' => url('user/login'))), 'User was asked to complete the registration process manually.');
|
||||
$this->assertRaw(t('The name %name is already taken.', array('%name' => $web_user->name)), 'Form validation error for username was displayed.');
|
||||
$this->assertRaw(t('The e-mail address %mail is not valid.', array('%mail' => 'mail@invalid#')), 'Form validation error for e-mail address was displayed.');
|
||||
|
||||
// Enter username and e-mail address manually.
|
||||
$edit = array('name' => 'john', 'mail' => 'john@example.com');
|
||||
$this->drupalPost(NULL, $edit, t('Create new account'));
|
||||
$this->assertRaw(t('Once you have verified your e-mail address, you may log in via OpenID.'), t('User was asked to verify e-mail address.'));
|
||||
$this->assertRaw(t('Once you have verified your e-mail address, you may log in via OpenID.'), 'User was asked to verify e-mail address.');
|
||||
$reset_url = $this->getPasswordResetURLFromMail();
|
||||
|
||||
$user = user_load_by_name('john');
|
||||
$this->assertTrue($user, t('User was registered with right username.'));
|
||||
$this->assertFalse($user->data, t('No additional user info was saved.'));
|
||||
$this->assertTrue($user, 'User was registered with right username.');
|
||||
$this->assertFalse($user->data, 'No additional user info was saved.');
|
||||
|
||||
// Follow the one-time login that was sent in the welcome e-mail.
|
||||
$this->drupalGet($reset_url);
|
||||
$this->drupalPost(NULL, array(), t('Log in'));
|
||||
|
||||
// The user is taken to user/%uid/edit.
|
||||
$this->assertFieldByName('mail', 'john@example.com', t('User was registered with right e-mail address.'));
|
||||
$this->assertFieldByName('mail', 'john@example.com', 'User was registered with right e-mail address.');
|
||||
|
||||
$this->clickLink(t('OpenID identities'));
|
||||
$this->assertRaw($identity, t('OpenID identity was registered.'));
|
||||
$this->assertRaw($identity, 'OpenID identity was registered.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -523,29 +523,29 @@ class OpenIDRegistrationTestCase extends OpenIDWebTestCase {
|
||||
// Use a User-supplied Identity that is the URL of an XRDS document.
|
||||
$identity = url('openid-test/yadis/xrds', array('absolute' => TRUE));
|
||||
$this->submitLoginForm($identity);
|
||||
$this->assertRaw(t('Complete the registration by filling out the form below. If you already have an account, you can <a href="@login">log in</a> now and add your OpenID under "My account".', array('@login' => url('user/login'))), t('User was asked to complete the registration process manually.'));
|
||||
$this->assertNoRaw(t('You must enter a username.'), t('Form validation error for username was not displayed.'));
|
||||
$this->assertNoRaw(t('You must enter an e-mail address.'), t('Form validation error for e-mail address was not displayed.'));
|
||||
$this->assertRaw(t('Complete the registration by filling out the form below. If you already have an account, you can <a href="@login">log in</a> now and add your OpenID under "My account".', array('@login' => url('user/login'))), 'User was asked to complete the registration process manually.');
|
||||
$this->assertNoRaw(t('You must enter a username.'), 'Form validation error for username was not displayed.');
|
||||
$this->assertNoRaw(t('You must enter an e-mail address.'), 'Form validation error for e-mail address was not displayed.');
|
||||
|
||||
// Enter username and e-mail address manually.
|
||||
$edit = array('name' => 'john', 'mail' => 'john@example.com');
|
||||
$this->drupalPost(NULL, $edit, t('Create new account'));
|
||||
$this->assertRaw(t('Once you have verified your e-mail address, you may log in via OpenID.'), t('User was asked to verify e-mail address.'));
|
||||
$this->assertRaw(t('Once you have verified your e-mail address, you may log in via OpenID.'), 'User was asked to verify e-mail address.');
|
||||
$reset_url = $this->getPasswordResetURLFromMail();
|
||||
|
||||
$user = user_load_by_name('john');
|
||||
$this->assertTrue($user, t('User was registered with right username.'));
|
||||
$this->assertFalse($user->data, t('No additional user info was saved.'));
|
||||
$this->assertTrue($user, 'User was registered with right username.');
|
||||
$this->assertFalse($user->data, 'No additional user info was saved.');
|
||||
|
||||
// Follow the one-time login that was sent in the welcome e-mail.
|
||||
$this->drupalGet($reset_url);
|
||||
$this->drupalPost(NULL, array(), t('Log in'));
|
||||
|
||||
// The user is taken to user/%uid/edit.
|
||||
$this->assertFieldByName('mail', 'john@example.com', t('User was registered with right e-mail address.'));
|
||||
$this->assertFieldByName('mail', 'john@example.com', 'User was registered with right e-mail address.');
|
||||
|
||||
$this->clickLink(t('OpenID identities'));
|
||||
$this->assertRaw($identity, t('OpenID identity was registered.'));
|
||||
$this->assertRaw($identity, 'OpenID identity was registered.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -568,11 +568,11 @@ class OpenIDRegistrationTestCase extends OpenIDWebTestCase {
|
||||
// Use a User-supplied Identity that is the URL of an XRDS document.
|
||||
$identity = url('openid-test/yadis/xrds', array('absolute' => TRUE));
|
||||
$this->submitLoginForm($identity);
|
||||
$this->assertLink(t('Log out'), 0, t('User was logged in.'));
|
||||
$this->assertLink(t('Log out'), 0, 'User was logged in.');
|
||||
|
||||
$user = user_load_by_name('john');
|
||||
$this->assertTrue($user, t('User was registered with right username.'));
|
||||
$this->assertEqual($user->mail, 'john@example.com', t('User was registered with right email address.'));
|
||||
$this->assertTrue($user, 'User was registered with right username.');
|
||||
$this->assertEqual($user->mail, 'john@example.com', 'User was registered with right email address.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -624,7 +624,7 @@ class OpenIDInvalidIdentifierTransitionTestCase extends OpenIDFunctionalTestCase
|
||||
$this->assertResponse(200);
|
||||
|
||||
// Verify the message.
|
||||
$this->assertRaw(t('There is already an existing account associated with the OpenID identifier that you have provided.'), t('Message that OpenID identifier must be updated manually was displayed.'));
|
||||
$this->assertRaw(t('There is already an existing account associated with the OpenID identifier that you have provided.'), 'Message that OpenID identifier must be updated manually was displayed.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -655,7 +655,7 @@ class OpenIDInvalidIdentifierTransitionTestCase extends OpenIDFunctionalTestCase
|
||||
$this->assertResponse(200);
|
||||
|
||||
// Verify the message.
|
||||
$this->assertRaw(t('New OpenID identifier %identity was added as a replacement for invalid identifier %invalid_identity.', array('%invalid_identity' => $identity_stripped, '%identity' => $identity)), t('Message that OpenID identifier was added automatically was displayed.'));
|
||||
$this->assertRaw(t('New OpenID identifier %identity was added as a replacement for invalid identifier %invalid_identity.', array('%invalid_identity' => $identity_stripped, '%identity' => $identity)), 'Message that OpenID identifier was added automatically was displayed.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -680,25 +680,25 @@ class OpenIDTestCase extends DrupalWebTestCase {
|
||||
* Test _openid_dh_XXX_to_XXX() functions.
|
||||
*/
|
||||
function testConversion() {
|
||||
$this->assertEqual(_openid_dh_long_to_base64('12345678901234567890123456789012345678901234567890'), 'CHJ/Y2mq+DyhUCZ0evjH8ZbOPwrS', t('_openid_dh_long_to_base64() returned expected result.'));
|
||||
$this->assertEqual(_openid_dh_base64_to_long('BsH/g8Nrpn2dtBSdu/sr1y8hxwyx'), '09876543210987654321098765432109876543210987654321', t('_openid_dh_base64_to_long() returned expected result.'));
|
||||
$this->assertEqual(_openid_dh_long_to_base64('12345678901234567890123456789012345678901234567890'), 'CHJ/Y2mq+DyhUCZ0evjH8ZbOPwrS', '_openid_dh_long_to_base64() returned expected result.');
|
||||
$this->assertEqual(_openid_dh_base64_to_long('BsH/g8Nrpn2dtBSdu/sr1y8hxwyx'), '09876543210987654321098765432109876543210987654321', '_openid_dh_base64_to_long() returned expected result.');
|
||||
|
||||
$this->assertEqual(_openid_dh_long_to_binary('12345678901234567890123456789012345678901234567890'), "\x08r\x7fci\xaa\xf8<\xa1P&tz\xf8\xc7\xf1\x96\xce?\x0a\xd2", t('_openid_dh_long_to_binary() returned expected result.'));
|
||||
$this->assertEqual(_openid_dh_binary_to_long("\x06\xc1\xff\x83\xc3k\xa6}\x9d\xb4\x14\x9d\xbb\xfb+\xd7/!\xc7\x0c\xb1"), '09876543210987654321098765432109876543210987654321', t('_openid_dh_binary_to_long() returned expected result.'));
|
||||
$this->assertEqual(_openid_dh_long_to_binary('12345678901234567890123456789012345678901234567890'), "\x08r\x7fci\xaa\xf8<\xa1P&tz\xf8\xc7\xf1\x96\xce?\x0a\xd2", '_openid_dh_long_to_binary() returned expected result.');
|
||||
$this->assertEqual(_openid_dh_binary_to_long("\x06\xc1\xff\x83\xc3k\xa6}\x9d\xb4\x14\x9d\xbb\xfb+\xd7/!\xc7\x0c\xb1"), '09876543210987654321098765432109876543210987654321', '_openid_dh_binary_to_long() returned expected result.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test _openid_dh_xorsecret().
|
||||
*/
|
||||
function testOpenidDhXorsecret() {
|
||||
$this->assertEqual(_openid_dh_xorsecret('123456790123456790123456790', "abc123ABC\x00\xFF"), "\xa4'\x06\xbe\xf1.\x00y\xff\xc2\xc1", t('_openid_dh_xorsecret() returned expected result.'));
|
||||
$this->assertEqual(_openid_dh_xorsecret('123456790123456790123456790', "abc123ABC\x00\xFF"), "\xa4'\x06\xbe\xf1.\x00y\xff\xc2\xc1", '_openid_dh_xorsecret() returned expected result.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test _openid_get_bytes().
|
||||
*/
|
||||
function testOpenidGetBytes() {
|
||||
$this->assertEqual(strlen(_openid_get_bytes(20)), 20, t('_openid_get_bytes() returned expected result.'));
|
||||
$this->assertEqual(strlen(_openid_get_bytes(20)), 20, '_openid_get_bytes() returned expected result.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -718,7 +718,7 @@ class OpenIDTestCase extends DrupalWebTestCase {
|
||||
);
|
||||
$association = new stdClass();
|
||||
$association->mac_key = "1234567890abcdefghij\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9";
|
||||
$this->assertEqual(_openid_signature($association, $response, array('foo', 'bar')), 'QnKZQzSFstT+GNiJDFOptdcZjrc=', t('Expected signature calculated.'));
|
||||
$this->assertEqual(_openid_signature($association, $response, array('foo', 'bar')), 'QnKZQzSFstT+GNiJDFOptdcZjrc=', 'Expected signature calculated.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -729,26 +729,26 @@ class OpenIDTestCase extends DrupalWebTestCase {
|
||||
// section 7.2. If the user-supplied string starts with xri:// it should be
|
||||
// stripped and the resulting string should be treated as an XRI when it
|
||||
// starts with "=", "@", "+", "$", "!" or "(".
|
||||
$this->assertTrue(_openid_is_xri('xri://=foo'), t('_openid_is_xri() returned expected result for an xri identifier with xri scheme.'));
|
||||
$this->assertTrue(_openid_is_xri('xri://@foo'), t('_openid_is_xri() returned expected result for an xri identifier with xri scheme.'));
|
||||
$this->assertTrue(_openid_is_xri('xri://+foo'), t('_openid_is_xri() returned expected result for an xri identifier with xri scheme.'));
|
||||
$this->assertTrue(_openid_is_xri('xri://$foo'), t('_openid_is_xri() returned expected result for an xri identifier with xri scheme.'));
|
||||
$this->assertTrue(_openid_is_xri('xri://!foo'), t('_openid_is_xri() returned expected result for an xri identifier with xri scheme..'));
|
||||
$this->assertTrue(_openid_is_xri('xri://(foo'), t('_openid_is_xri() returned expected result for an xri identifier with xri scheme..'));
|
||||
$this->assertTrue(_openid_is_xri('xri://=foo'), '_openid_is_xri() returned expected result for an xri identifier with xri scheme.');
|
||||
$this->assertTrue(_openid_is_xri('xri://@foo'), '_openid_is_xri() returned expected result for an xri identifier with xri scheme.');
|
||||
$this->assertTrue(_openid_is_xri('xri://+foo'), '_openid_is_xri() returned expected result for an xri identifier with xri scheme.');
|
||||
$this->assertTrue(_openid_is_xri('xri://$foo'), '_openid_is_xri() returned expected result for an xri identifier with xri scheme.');
|
||||
$this->assertTrue(_openid_is_xri('xri://!foo'), '_openid_is_xri() returned expected result for an xri identifier with xri scheme..');
|
||||
$this->assertTrue(_openid_is_xri('xri://(foo'), '_openid_is_xri() returned expected result for an xri identifier with xri scheme..');
|
||||
|
||||
$this->assertTrue(_openid_is_xri('=foo'), t('_openid_is_xri() returned expected result for an xri identifier.'));
|
||||
$this->assertTrue(_openid_is_xri('@foo'), t('_openid_is_xri() returned expected result for an xri identifier.'));
|
||||
$this->assertTrue(_openid_is_xri('+foo'), t('_openid_is_xri() returned expected result for an xri identifier.'));
|
||||
$this->assertTrue(_openid_is_xri('$foo'), t('_openid_is_xri() returned expected result for an xri identifier.'));
|
||||
$this->assertTrue(_openid_is_xri('!foo'), t('_openid_is_xri() returned expected result for an xri identifier.'));
|
||||
$this->assertTrue(_openid_is_xri('(foo'), t('_openid_is_xri() returned expected result for an xri identifier.'));
|
||||
$this->assertTrue(_openid_is_xri('=foo'), '_openid_is_xri() returned expected result for an xri identifier.');
|
||||
$this->assertTrue(_openid_is_xri('@foo'), '_openid_is_xri() returned expected result for an xri identifier.');
|
||||
$this->assertTrue(_openid_is_xri('+foo'), '_openid_is_xri() returned expected result for an xri identifier.');
|
||||
$this->assertTrue(_openid_is_xri('$foo'), '_openid_is_xri() returned expected result for an xri identifier.');
|
||||
$this->assertTrue(_openid_is_xri('!foo'), '_openid_is_xri() returned expected result for an xri identifier.');
|
||||
$this->assertTrue(_openid_is_xri('(foo'), '_openid_is_xri() returned expected result for an xri identifier.');
|
||||
|
||||
$this->assertFalse(_openid_is_xri('foo'), t('_openid_is_xri() returned expected result for an http URL.'));
|
||||
$this->assertFalse(_openid_is_xri('xri://foo'), t('_openid_is_xri() returned expected result for an http URL.'));
|
||||
$this->assertFalse(_openid_is_xri('http://foo/'), t('_openid_is_xri() returned expected result for an http URL.'));
|
||||
$this->assertFalse(_openid_is_xri('http://example.com/'), t('_openid_is_xri() returned expected result for an http URL.'));
|
||||
$this->assertFalse(_openid_is_xri('user@example.com/'), t('_openid_is_xri() returned expected result for an http URL.'));
|
||||
$this->assertFalse(_openid_is_xri('http://user@example.com/'), t('_openid_is_xri() returned expected result for an http URL.'));
|
||||
$this->assertFalse(_openid_is_xri('foo'), '_openid_is_xri() returned expected result for an http URL.');
|
||||
$this->assertFalse(_openid_is_xri('xri://foo'), '_openid_is_xri() returned expected result for an http URL.');
|
||||
$this->assertFalse(_openid_is_xri('http://foo/'), '_openid_is_xri() returned expected result for an http URL.');
|
||||
$this->assertFalse(_openid_is_xri('http://example.com/'), '_openid_is_xri() returned expected result for an http URL.');
|
||||
$this->assertFalse(_openid_is_xri('user@example.com/'), '_openid_is_xri() returned expected result for an http URL.');
|
||||
$this->assertFalse(_openid_is_xri('http://user@example.com/'), '_openid_is_xri() returned expected result for an http URL.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -758,16 +758,16 @@ class OpenIDTestCase extends DrupalWebTestCase {
|
||||
// Test that the normalization is according to OpenID Authentication 2.0,
|
||||
// section 7.2 and 11.5.2.
|
||||
|
||||
$this->assertEqual(openid_normalize('$foo'), '$foo', t('openid_normalize() correctly normalized an XRI.'));
|
||||
$this->assertEqual(openid_normalize('xri://$foo'), '$foo', t('openid_normalize() correctly normalized an XRI with an xri:// scheme.'));
|
||||
$this->assertEqual(openid_normalize('$foo'), '$foo', 'openid_normalize() correctly normalized an XRI.');
|
||||
$this->assertEqual(openid_normalize('xri://$foo'), '$foo', 'openid_normalize() correctly normalized an XRI with an xri:// scheme.');
|
||||
|
||||
$this->assertEqual(openid_normalize('example.com/'), 'http://example.com/', t('openid_normalize() correctly normalized a URL with a missing scheme.'));
|
||||
$this->assertEqual(openid_normalize('example.com'), 'http://example.com/', t('openid_normalize() correctly normalized a URL with a missing scheme and empty path.'));
|
||||
$this->assertEqual(openid_normalize('http://example.com'), 'http://example.com/', t('openid_normalize() correctly normalized a URL with an empty path.'));
|
||||
$this->assertEqual(openid_normalize('example.com/'), 'http://example.com/', 'openid_normalize() correctly normalized a URL with a missing scheme.');
|
||||
$this->assertEqual(openid_normalize('example.com'), 'http://example.com/', 'openid_normalize() correctly normalized a URL with a missing scheme and empty path.');
|
||||
$this->assertEqual(openid_normalize('http://example.com'), 'http://example.com/', 'openid_normalize() correctly normalized a URL with an empty path.');
|
||||
|
||||
$this->assertEqual(openid_normalize('http://example.com/path'), 'http://example.com/path', t('openid_normalize() correctly normalized a URL with a path.'));
|
||||
$this->assertEqual(openid_normalize('http://example.com/path'), 'http://example.com/path', 'openid_normalize() correctly normalized a URL with a path.');
|
||||
|
||||
$this->assertEqual(openid_normalize('http://example.com/path#fragment'), 'http://example.com/path', t('openid_normalize() correctly normalized a URL with a fragment.'));
|
||||
$this->assertEqual(openid_normalize('http://example.com/path#fragment'), 'http://example.com/path', 'openid_normalize() correctly normalized a URL with a fragment.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -786,24 +786,24 @@ class OpenIDTestCase extends DrupalWebTestCase {
|
||||
);
|
||||
|
||||
$values = openid_extract_namespace($response, 'http://example.com/ns/dummy', NULL, FALSE);
|
||||
$this->assertEqual($values, array(), t('Nothing found for unused namespace.'));
|
||||
$this->assertEqual($values, array(), 'Nothing found for unused namespace.');
|
||||
|
||||
$values = openid_extract_namespace($response, 'http://example.com/ns/dummy', 'sreg', FALSE);
|
||||
$this->assertEqual($values, array('nickname' => 'john'), t('Value found for fallback prefix.'));
|
||||
$this->assertEqual($values, array('nickname' => 'john'), 'Value found for fallback prefix.');
|
||||
|
||||
$values = openid_extract_namespace($response, OPENID_NS_SREG, 'sreg', FALSE);
|
||||
$this->assertEqual($values, array('nickname' => 'george', 'email' => 'george@example.com'), t('Namespace takes precedence over fallback prefix.'));
|
||||
$this->assertEqual($values, array('nickname' => 'george', 'email' => 'george@example.com'), 'Namespace takes precedence over fallback prefix.');
|
||||
|
||||
// ext1.email is signed, but ext1.nickname is not.
|
||||
$values = openid_extract_namespace($response, OPENID_NS_SREG, 'sreg', TRUE);
|
||||
$this->assertEqual($values, array('email' => 'george@example.com'), t('Unsigned namespaced fields ignored.'));
|
||||
$this->assertEqual($values, array('email' => 'george@example.com'), 'Unsigned namespaced fields ignored.');
|
||||
|
||||
$values = openid_extract_namespace($response, 'http://example.com/ns/ext2', 'sreg', FALSE);
|
||||
$this->assertEqual($values, array('foo' => '123', 'bar' => '456'), t('Unsigned fields found.'));
|
||||
$this->assertEqual($values, array('foo' => '123', 'bar' => '456'), 'Unsigned fields found.');
|
||||
|
||||
// ext2.foo and ext2.bar are ignored, because ns.ext2 is not signed. The
|
||||
// fallback prefix is not used, because the namespace is specified.
|
||||
$values = openid_extract_namespace($response, 'http://example.com/ns/ext2', 'sreg', TRUE);
|
||||
$this->assertEqual($values, array(), t('Unsigned fields ignored.'));
|
||||
$this->assertEqual($values, array(), 'Unsigned fields ignored.');
|
||||
}
|
||||
}
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
dependencies[] = openid
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -1,4 +1,9 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
* RTL styling for Overlay child pages.
|
||||
*/
|
||||
|
||||
html {
|
||||
direction: rtl;
|
||||
}
|
||||
|
@@ -1,4 +1,9 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Basic styling for the Overlay child pages.
|
||||
*/
|
||||
|
||||
html.js {
|
||||
background: transparent !important;
|
||||
overflow-y: scroll;
|
||||
|
@@ -1,3 +1,7 @@
|
||||
/**
|
||||
* @file
|
||||
* Attaches the behaviors for the Overlay child pages.
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
|
||||
|
@@ -1,4 +1,9 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Basic styling for the Overlay module.
|
||||
*/
|
||||
|
||||
html.overlay-open,
|
||||
html.overlay-open body {
|
||||
height: 100%;
|
||||
|
@@ -1,3 +1,8 @@
|
||||
/**
|
||||
* @file
|
||||
* Attaches the behaviors for the Overlay parent pages.
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
|
||||
/**
|
||||
@@ -339,7 +344,7 @@ Drupal.overlay.setFocusBefore = function ($element, document) {
|
||||
* Check if the given link is in the administrative section of the site.
|
||||
*
|
||||
* @param url
|
||||
* The url to be tested.
|
||||
* The URL to be tested.
|
||||
*
|
||||
* @return boolean
|
||||
* TRUE if the URL represents an administrative link, FALSE otherwise.
|
||||
@@ -374,7 +379,7 @@ Drupal.overlay.isAdminLink = function (url) {
|
||||
* Determine whether a link is external to the site.
|
||||
*
|
||||
* @param url
|
||||
* The url to be tested.
|
||||
* The URL to be tested.
|
||||
*
|
||||
* @return boolean
|
||||
* TRUE if the URL is external to the site, FALSE otherwise.
|
||||
@@ -560,7 +565,7 @@ Drupal.overlay.eventhandlerOverrideLink = function (event) {
|
||||
|
||||
var target = $target[0];
|
||||
var href = target.href;
|
||||
// Only handle links that have an href attribute and use the http(s) protocol.
|
||||
// Only handle links that have an href attribute and use the HTTP(S) protocol.
|
||||
if (href != undefined && href != '' && target.protocol.match(/^https?\:/)) {
|
||||
var anchor = href.replace(target.ownerDocument.location.href, '');
|
||||
// Skip anchor links.
|
||||
@@ -607,7 +612,14 @@ Drupal.overlay.eventhandlerOverrideLink = function (event) {
|
||||
else {
|
||||
// Add the overlay-context state to the link, so "overlay-restore" links
|
||||
// can restore the context.
|
||||
$target.attr('href', $.param.fragment(href, { 'overlay-context': this.getPath(window.location) + window.location.search }));
|
||||
if ($target[0].hash) {
|
||||
// Leave links with an existing fragment alone. Adding an extra
|
||||
// parameter to a link like "node/1#section-1" breaks the link.
|
||||
}
|
||||
else {
|
||||
// For links with no existing fragment, add the overlay context.
|
||||
$target.attr('href', $.param.fragment(href, { 'overlay-context': this.getPath(window.location) + window.location.search }));
|
||||
}
|
||||
|
||||
// When the link has a destination query parameter and that destination
|
||||
// is an admin link we need to fragmentize it. This will make it reopen
|
||||
|
@@ -4,8 +4,8 @@ package = Core
|
||||
version = VERSION
|
||||
core = 7.x
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -2,14 +2,14 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Install, update and uninstall functions for the overlay module.
|
||||
* Install, update, and uninstall functions for the Overlay module.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_enable().
|
||||
*
|
||||
* If the module is being enabled through the admin UI, and not from an
|
||||
* install profile, reopen the modules page in an overlay.
|
||||
* installation profile, reopen the modules page in an overlay.
|
||||
*/
|
||||
function overlay_enable() {
|
||||
if (strpos(current_path(), 'admin/modules') === 0) {
|
||||
|
@@ -302,7 +302,10 @@ function overlay_page_alter(&$page) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Menu callback; dismisses the overlay accessibility message for this user.
|
||||
* Page callback: Dismisses the overlay accessibility message for this user.
|
||||
*
|
||||
* @return
|
||||
* A render array for a page containing a list of content.
|
||||
*/
|
||||
function overlay_user_dismiss_message() {
|
||||
global $user;
|
||||
@@ -327,10 +330,12 @@ function overlay_user_dismiss_message() {
|
||||
* If the current user can access the overlay and has not previously indicated
|
||||
* that this message should be dismissed, this function returns a message
|
||||
* containing a link to disable the overlay. Nothing is returned for anonymous
|
||||
* users, because the links control per-user settings. Therefore, because some
|
||||
* screen readers are unable to properly read overlay contents, site builders
|
||||
* are discouraged from granting the "access overlay" permission to the
|
||||
* anonymous role. See http://drupal.org/node/890284.
|
||||
* users, because the links control per-user settings. Because some screen
|
||||
* readers are unable to properly read overlay contents, site builders are
|
||||
* discouraged from granting the "access overlay" permission to the anonymous
|
||||
* role.
|
||||
*
|
||||
* @see http://drupal.org/node/890284
|
||||
*/
|
||||
function overlay_disable_message() {
|
||||
global $user;
|
||||
@@ -385,7 +390,13 @@ function overlay_disable_message() {
|
||||
/**
|
||||
* Returns the HTML for the message about how to disable the overlay.
|
||||
*
|
||||
* @see overlay_disable_message()
|
||||
* @param $variables
|
||||
* An associative array with an 'element' element, which itself is an
|
||||
* associative array containing:
|
||||
* - profile_link: The link to this user's account.
|
||||
* - dismiss_message_link: The link to dismiss the overlay.
|
||||
*
|
||||
* @ingroup themeable
|
||||
*/
|
||||
function theme_overlay_disable_message($variables) {
|
||||
$element = $variables['element'];
|
||||
@@ -473,8 +484,12 @@ function overlay_preprocess_maintenance_page(&$variables) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Preprocesses template variables for overlay.tpl.php
|
||||
* Implements template_preprocess_HOOK() for overlay.tpl.php
|
||||
*
|
||||
* If the current page request is inside the overlay, add appropriate classes
|
||||
* to the <body> element, and simplify the page title.
|
||||
*
|
||||
* @see template_process_overlay()
|
||||
* @see overlay.tpl.php
|
||||
*/
|
||||
function template_preprocess_overlay(&$variables) {
|
||||
@@ -485,20 +500,21 @@ function template_preprocess_overlay(&$variables) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes variables for overlay.tpl.php
|
||||
* Implements template_process_HOOK() for overlay.tpl.php
|
||||
*
|
||||
* Places the rendered HTML for the page body into a top level variable.
|
||||
*
|
||||
* @see template_preprocess_overlay()
|
||||
* @see overlay.tpl.php
|
||||
*/
|
||||
function template_process_overlay(&$variables) {
|
||||
// Place the rendered HTML for the page body into a top level variable.
|
||||
$variables['page'] = $variables['page']['#children'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_preprocess_page().
|
||||
*
|
||||
* Hide tabs inside the overlay.
|
||||
* If the current page request is inside the overlay, hide the tabs.
|
||||
*
|
||||
* @see overlay_get_mode()
|
||||
*/
|
||||
@@ -509,7 +525,7 @@ function overlay_preprocess_page(&$variables) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback to request that the overlay display an empty page.
|
||||
* Stores and returns whether an empty page override is needed.
|
||||
*
|
||||
* This is used to prevent a page request which closes the overlay (for
|
||||
* example, a form submission) from being fully re-rendered before the overlay
|
||||
@@ -550,7 +566,7 @@ function overlay_page_delivery_callback_alter(&$callback) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Delivery callback to display an empty page.
|
||||
* Prints an empty page.
|
||||
*
|
||||
* This function is used to print out a bare minimum empty page which still has
|
||||
* the scripts and styles necessary in order to trigger the overlay to close.
|
||||
@@ -562,7 +578,7 @@ function overlay_deliver_empty_page() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current overlay mode.
|
||||
* Gets the current overlay mode.
|
||||
*
|
||||
* @see overlay_set_mode()
|
||||
*/
|
||||
@@ -688,12 +704,13 @@ function overlay_overlay_child_initialize() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback to request that the overlay close as soon as the page is displayed.
|
||||
* Requests that the overlay overlay closes when the page is displayed.
|
||||
*
|
||||
* @param $redirect
|
||||
* (optional) The path that should open in the parent window after the
|
||||
* overlay closes. If not set, no redirect will be performed on the parent
|
||||
* window.
|
||||
*
|
||||
* @param $redirect_options
|
||||
* (optional) An associative array of options to use when generating the
|
||||
* redirect URL.
|
||||
@@ -757,7 +774,7 @@ function overlay_supplemental_regions() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function for returning a list of page regions related to the overlay.
|
||||
* Returns a list of page regions related to the overlay.
|
||||
*
|
||||
* @param $type
|
||||
* The type of regions to return. This can either be 'overlay_regions' or
|
||||
@@ -923,7 +940,7 @@ function overlay_store_rendered_content($id = NULL, $content = NULL) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Request that the parent window refresh a particular page region.
|
||||
* Requests that the parent window refreshes a particular page region.
|
||||
*
|
||||
* @param $region
|
||||
* The name of the page region to refresh. The parent window will trigger a
|
||||
@@ -938,7 +955,7 @@ function overlay_request_refresh($region) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Request that the entire parent window be reloaded when the overlay closes.
|
||||
* Requests that the entire parent window is reloaded when the overlay closes.
|
||||
*
|
||||
* @see overlay_trigger_refresh()
|
||||
*/
|
||||
@@ -947,7 +964,7 @@ function overlay_request_page_refresh() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the parent window needs to be refreshed on this page load.
|
||||
* Checks if the parent window needs to be refreshed on this page load.
|
||||
*
|
||||
* If the previous page load requested that any page regions be refreshed, or
|
||||
* if it requested that the entire page be refreshed when the overlay closes,
|
||||
|
@@ -17,6 +17,8 @@
|
||||
* @see template_preprocess()
|
||||
* @see template_preprocess_overlay()
|
||||
* @see template_process()
|
||||
*
|
||||
* @ingroup themeable
|
||||
*/
|
||||
?>
|
||||
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
files[] = path.test
|
||||
configure = admin/config/search/path
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -137,8 +137,6 @@ function path_form_node_form_alter(&$form, $form_state) {
|
||||
'#title' => t('URL alias'),
|
||||
'#default_value' => $path['alias'],
|
||||
'#maxlength' => 255,
|
||||
'#collapsible' => TRUE,
|
||||
'#collapsed' => TRUE,
|
||||
'#description' => t('Optionally specify an alternative URL by which this content can be accessed. For example, type "about" when writing an about page. Use a relative path and don\'t add a trailing slash or the URL alias won\'t work.'),
|
||||
);
|
||||
$form['path']['pid'] = array('#type' => 'value', '#value' => $path['pid']);
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
files[] = php.test
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -15,6 +15,8 @@
|
||||
* - $vote: The choice number of the current user's vote.
|
||||
*
|
||||
* @see template_preprocess_poll_results()
|
||||
*
|
||||
* @ingroup themeable
|
||||
*/
|
||||
?>
|
||||
<div class="poll">
|
||||
|
@@ -12,6 +12,8 @@
|
||||
* form_alter hooks.
|
||||
*
|
||||
* @see template_preprocess_poll_vote()
|
||||
*
|
||||
* @ingroup themeable
|
||||
*/
|
||||
?>
|
||||
<div class="poll">
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user