summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2008-04-25 18:26:02 +0000
committerDries Buytaert <dries@buytaert.net>2008-04-25 18:26:02 +0000
commita7f12c0326f4c6808fa84fc8b0f57536fdc0002e (patch)
tree6580e3d8210f44678ead0ea92c5de739a6fb3dac /modules
parentd7f3c18d17e4be51c18eb3adcbc1492659026757 (diff)
downloadbrdo-a7f12c0326f4c6808fa84fc8b0f57536fdc0002e.tar.gz
brdo-a7f12c0326f4c6808fa84fc8b0f57536fdc0002e.tar.bz2
- Patch #251263 by catch: fixing up many code style issues in the tests.
Diffstat (limited to 'modules')
-rw-r--r--modules/blog/blog.test2
-rw-r--r--modules/blogapi/blogapi.test2
-rw-r--r--modules/book/book.test8
-rw-r--r--modules/contact/contact.test2
-rw-r--r--modules/dblog/dblog.test8
-rw-r--r--modules/filter/filter.test6
-rw-r--r--modules/locale/locale.test2
-rw-r--r--modules/node/node.test43
-rw-r--r--modules/path/path.test46
-rw-r--r--modules/poll/poll.test4
-rw-r--r--modules/profile/profile.test46
11 files changed, 88 insertions, 81 deletions
diff --git a/modules/blog/blog.test b/modules/blog/blog.test
index a3a6c1441..292aa3bd9 100644
--- a/modules/blog/blog.test
+++ b/modules/blog/blog.test
@@ -145,7 +145,7 @@ class BlogTestCase extends DrupalWebTestCase {
$this->assertResponse(200);
$this->assertText(t('View recent blog entries'), t('View recent blog entries link was displayed'));
- // Confirm the recent blog entries link links to the user's blog page.
+ // Confirm the recent blog entries link goes to the user's blog page.
$this->clickLink('View recent blog entries');
$this->assertTitle(t("@name's blog | Drupal", array('@name' => $user->name)), t('View recent blog entries link target was correct'));
diff --git a/modules/blogapi/blogapi.test b/modules/blogapi/blogapi.test
index ea6accf0b..23595ca27 100644
--- a/modules/blogapi/blogapi.test
+++ b/modules/blogapi/blogapi.test
@@ -21,7 +21,7 @@ class BlogAPITestCase extends DrupalWebTestCase {
}
/**
- * Create, edit, and delete post; upload file; and set/get categories.
+ * Create, edit, and delete post; upload file; set/get categories.
*/
function testBlogAPI() {
// Create admin user and taxononmy for later use.
diff --git a/modules/book/book.test b/modules/book/book.test
index 7961bda8b..e9e70182d 100644
--- a/modules/book/book.test
+++ b/modules/book/book.test
@@ -23,7 +23,7 @@ class BookTestCase extends DrupalWebTestCase {
}
/**
- * Test book funcitonality through node interfaces.
+ * Test book functionality through node interfaces.
*/
function testBook() {
// Create users.
@@ -37,7 +37,7 @@ class BookTestCase extends DrupalWebTestCase {
$book = $this->book;
/*
- * Add page hiearchy to book.
+ * Add page hierarchy to book.
* Book
* |- Node 0
* |- Node 1
@@ -54,7 +54,7 @@ class BookTestCase extends DrupalWebTestCase {
$this->drupalLogout();
- // Check to make sure that book pages display properly.
+ // Check that book pages display.
$this->drupalLogin($web_user);
$this->checkBookNode($book, array($nodes[0], $nodes[3], $nodes[4]), false, false, $nodes[0]);
@@ -66,7 +66,7 @@ class BookTestCase extends DrupalWebTestCase {
}
/**
- * Checks the outline of sub-pages; previous, up, and next; and check printer friendly version.
+ * Check the outline of sub-pages; previous, up, and next; and printer friendly version.
*
* @param Node $node Node to check.
* @param array $nodes Nodes that should be in outline.
diff --git a/modules/contact/contact.test b/modules/contact/contact.test
index 2372ad95b..87523eccc 100644
--- a/modules/contact/contact.test
+++ b/modules/contact/contact.test
@@ -60,7 +60,7 @@ class ContactTestCase extends DrupalWebTestCase {
$this->addCategory($category = $this->randomName(16), implode(',', array($recipients[0], $recipients[1], $recipients[2])), '', FALSE);
$this->assertRaw(t('Category %category has been added.', array('%category' => $category)), t('Category successfully added.'));
- // Clear food table in preparation for flood test and allow other checks to complete.
+ // Clear flood table in preparation for flood test and allow other checks to complete.
$this->assertTrue(db_query('DELETE FROM {flood}'), t('Flood table emptied.'));
// Check to see that anonymous user cannot see contact page without permission.
diff --git a/modules/dblog/dblog.test b/modules/dblog/dblog.test
index 75faadd82..6c9db26ec 100644
--- a/modules/dblog/dblog.test
+++ b/modules/dblog/dblog.test
@@ -169,16 +169,16 @@ class DBLogTestCase extends DrupalWebTestCase {
$this->doNode('page');
$this->doNode('poll');
- // When a user is deleted, any content they created remains but the uid = 0. Their blog entry shows as "'s blog" on the home page.
- // Records in the watchdog table related to that user have the uid set to zero.
+ // When a user is deleted, any content they created remains but the
+ // uid = 0. Their blog entry shows as "'s blog" on the home page. Records
+ // in the watchdog table related to that user have the uid set to zero.
}
/**
* Generate and verify user events.
*
*/
- private function doUser()
- {
+ private function doUser() {
// Set user variables.
$name = $this->randomName();
$pass = user_password();
diff --git a/modules/filter/filter.test b/modules/filter/filter.test
index a18582ac4..698f6022e 100644
--- a/modules/filter/filter.test
+++ b/modules/filter/filter.test
@@ -128,19 +128,19 @@ class FilterTestCase extends DrupalWebTestCase {
$this->drupalLogin($admin_user);
// Clean up.
- // Allowed tags
+ // Allowed tags.
$edit = array();
$edit['allowed_html_1'] = '<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>';
$this->drupalPost('admin/settings/filters/'. $filtered .'/configure', $edit, t('Save configuration'));
$this->assertText(t('The configuration options have been saved.'), t('Changes reverted.'));
- // Full HTML
+ // Full HTML.
$edit = array();
$edit['roles[2]'] = FALSE;
$this->drupalPost('admin/settings/filters/'. $full, $edit, t('Save configuration'));
$this->assertText(t('The input format settings have been updated.'), t('Full HTML format successfully reverted.'));
- // Filter order
+ // Filter order.
$edit = array();
$edit['weights[filter/'. $second_filter .']'] = 2;
$edit['weights[filter/'. $first_filter .']'] = 1;
diff --git a/modules/locale/locale.test b/modules/locale/locale.test
index 26c75174e..8dfdbef0e 100644
--- a/modules/locale/locale.test
+++ b/modules/locale/locale.test
@@ -92,7 +92,7 @@ class LocaleTestCase extends DrupalWebTestCase {
$this->assertNoRaw($language_indicator, 'String is translated');
$this->drupalGet('logout');
- // Delete the language
+ // Delete the language.
$this->drupalLogin($admin_user);
$path = 'admin/settings/language/delete/'. $langcode;
// This a confirm form, we do not need any fields changed.
diff --git a/modules/node/node.test b/modules/node/node.test
index 48a23b219..eb84b2543 100644
--- a/modules/node/node.test
+++ b/modules/node/node.test
@@ -45,7 +45,7 @@ class NodeRevisionsTestCase extends DrupalWebTestCase {
}
/**
- * Simpletest test. Tests to make sure the correct revision text appears on "view revisions" page.
+ * Confirm the correct revision text appears on "view revisions" page.
*/
function testNodeRevisions() {
// Get $log, $text, $vid, $node.
@@ -58,7 +58,7 @@ class NodeRevisionsTestCase extends DrupalWebTestCase {
}
/**
- * Simpletest test. Tests to make sure the correct log message appears on "revisions overview" page.
+ * Confirm the correct log message appears on "revisions overview" page.
*/
function testLogMessage() {
// Get $log, $text, $vid, $node.
@@ -71,7 +71,7 @@ class NodeRevisionsTestCase extends DrupalWebTestCase {
}
/**
- * Simpletest test. Tests to make sure the that revisions revert properly.
+ * Confirm that revisions revert properly.
*/
function testRevisionRevert() {
// Get $log, $text, $vid, $node.
@@ -85,7 +85,7 @@ class NodeRevisionsTestCase extends DrupalWebTestCase {
}
/**
- * Simpletest test. Tests to make sure the revision deletes properly.
+ * Confirm revisions delete properly.
*/
function testRevisionDelete() {
// Get $log, $text, $vid, $node.
@@ -120,11 +120,8 @@ class NodeTeaserTestCase extends DrupalWebTestCase {
}
/**
- * Simpletest test. Tests an edge case where if the first sentence is a
- * question and subsequent sentences are not.
- * This failed in drupal 5.
- * Test and patch for drupal 6 (committed) from
- * http://drupal.org/node/180425
+ * Tests an edge case where if the first sentence is a question and
+ * subsequent sentences are not.
*/
function testFirstSentenceQuestion() {
$body = 'A question? A sentence. Another sentence.';
@@ -142,8 +139,7 @@ class NodeTeaserTestCase extends DrupalWebTestCase {
}
/**
- * Simpletest test. Runs a test adapted from
- * http://drupal.org/node/180425#comment-634230
+ * Test various teaser length edge cases.
*/
function testLength() {
// This body string tests a number of edge cases.
@@ -301,6 +297,10 @@ class PageEditTestCase extends DrupalWebTestCase {
}
class PagePreviewTestCase extends DrupalWebTestCase {
+
+ /**
+ * Implementation of getInfo().
+ */
function getInfo() {
return array(
'name' => 'Page preview test',
@@ -308,10 +308,13 @@ class PagePreviewTestCase extends DrupalWebTestCase {
'group' => t('Node'));
}
+ /**
+ * Test node previews.
+ */
function testPagePreview() {
- /* Prepare settings */
+ // Prepare settings.
variable_set('node_options_page', array('status', 'promote'));
- /* Prepare a user to do the stuff */
+ // Prepare a user to do the stuff.
$web_user = $this->drupalCreateUser(array('edit own page content', 'create page content'));
$this->drupalLogin($web_user);
@@ -334,7 +337,7 @@ class PagePreviewTestCase extends DrupalWebTestCase {
class PageCreationTestCase extends DrupalWebTestCase {
/**
- * Implementation of getInfo() for information
+ * Implementation of getInfo().
*/
function getInfo() {
return array(
@@ -345,10 +348,10 @@ class PageCreationTestCase extends DrupalWebTestCase {
}
function testPageCreation() {
- /* Prepare settings */
+ // Prepare settings.
variable_set('node_options_page', array('status', 'promote'));
- /* Prepare a user to do the stuff */
+ // Prepare a user to do the stuff.
$web_user = $this->drupalCreateUser(array('edit own page content', 'create page content'));
$this->drupalLogin($web_user);
@@ -367,7 +370,7 @@ class PageCreationTestCase extends DrupalWebTestCase {
class PageViewTestCase extends DrupalWebTestCase {
/**
- * Implementation of getInfo() for information
+ * Implementation of getInfo().
*/
function getInfo() {
return array(
@@ -380,16 +383,16 @@ class PageViewTestCase extends DrupalWebTestCase {
}
function testPageView() {
- /* Prepare a node to view */
+ // Prepare a node to view
global $user;
$node = $this->drupalCreateNode();
$this->assertNotNull(node_load($node->nid), 'Node created');
- /* Tries to edit with anonymous user */
+ // Tries to edit with anonymous user
$html = $this->drupalGet("node/$node->nid/edit");
$this->assertResponse(403);
- /* Prepare a user to request the node view */
+ // Prepare a user to request the node view
$test_user = $this->drupalCreateUser(array('access content'));
$this->drupalLogin($test_user);
diff --git a/modules/path/path.test b/modules/path/path.test
index f12322966..1cdd72692 100644
--- a/modules/path/path.test
+++ b/modules/path/path.test
@@ -27,47 +27,47 @@ class PathTestCase extends DrupalWebTestCase {
// create test node
$node1 = $this->createNode();
- // create alias
+ // Create alias.
$edit = array();
$edit['src'] = 'node/' . $node1->nid;
$edit['dst'] = $this->randomName(8);
$this->drupalPost('admin/build/path/add', $edit, t('Create new alias'));
- // confirm that the alias works
+ // Confirm that the alias works.
$this->drupalGet($edit['dst']);
$this->assertText($node1->title, 'Alias works.');
- // change alias
+ // Change alias.
$pid = $this->getPID($edit['dst']);
$previous = $edit['dst'];
$edit['dst'] = $this->randomName(8);
$this->drupalPost('admin/build/path/edit/' . $pid, $edit, t('Update alias'));
- // confirm that the alias works
+ // Confirm that the alias works.
$this->drupalGet($edit['dst']);
$this->assertText($node1->title, 'Changed alias works.');
- // make sure that previous alias no longer works
+ // Confirm that previous alias no longer works.
$this->drupalGet($previous);
$this->assertNoText($node1->title, 'Previous alias no longer works.');
$this->assertResponse(404);
- // create second test node
+ // Create second test node.
$node2 = $this->createNode();
- // set alias to second test node
+ // Set alias to second test node.
$edit['src'] = 'node/' . $node2->nid;
// leave $edit['dst'] the same
$this->drupalPost('admin/build/path/add', $edit, t('Create new alias'));
- // confirm that the alias didn't make a duplicate
+ // Confirm no duplicate was created.
$this->assertRaw(t('The alias %alias is already in use in this language.', array('%alias' => $edit['dst'])), 'Attempt to move alias was rejected.');
- // delete alias
+ // Delete alias.
$this->drupalPost('admin/build/path/delete/' . $pid, array(), t('Confirm'));
- // confirm that the alias no longer works
+ // Confirm that the alias no longer works.
$this->drupalGet($edit['dst']);
$this->assertNoText($node1->title, 'Alias was successfully deleted.');
}
@@ -76,46 +76,46 @@ class PathTestCase extends DrupalWebTestCase {
* Test alias functionality through the node interfaces.
*/
function testNodeAlias() {
- // create test node
+ // Create test node.
$node1 = $this->createNode();
- // create alias
+ // Create alias.
$edit = array();
$edit['path'] = $this->randomName(8);
$this->drupalPost('node/' . $node1->nid . '/edit', $edit, t('Save'));
- // confirm that the alias works
+ // Confirm that the alias works.
$this->drupalGet($edit['path']);
$this->assertText($node1->title, 'Alias works.');
- // change alias
+ // Change alias.
$previous = $edit['path'];
$edit['path'] = $this->randomName(8);
$this->drupalPost('node/' . $node1->nid . '/edit', $edit, t('Save'));
- // confirm that the alias works
+ // Confirm that the alias works.
$this->drupalGet($edit['path']);
$this->assertText($node1->title, 'Changed alias works.');
- // make sure that previous alias no longer works
+ // Make sure that previous alias no longer works.
$this->drupalGet($previous);
$this->assertNoText($node1->title, 'Previous alias no longer works.');
$this->assertResponse(404);
- // create second test node
+ // Create second test node.
$node2 = $this->createNode();
- // set alias to second test node
- // leave $edit['path'] the same
+ // Set alias to second test node.
+ // Leave $edit['path'] the same.
$this->drupalPost('node/' . $node2->nid . '/edit', $edit, t('Save'));
- // confirm that the alias didn't make a duplicate
+ // Confirm that the alias didn't make a duplicate.
$this->assertText(t('The path is already in use.'), 'Attempt to moved alias was rejected.');
- // delete alias
+ // Delete alias.
$this->drupalPost('node/' . $node1->nid . '/edit', array('path' => ''), t('Save'));
- // confirm that the alias no longer works
+ // Confirm that the alias no longer works.
$this->drupalGet($edit['path']);
$this->assertNoText($node1->title, 'Alias was successfully deleted.');
}
@@ -130,7 +130,7 @@ class PathTestCase extends DrupalWebTestCase {
$edit['body'] = '!SimpleTest test body! ' . $this->randomName(32) . ' ' . $this->randomName(32);
$this->drupalPost('node/add/page', $edit, t('Save'));
- // check to make sure the node was created
+ // Check to make sure the node was created.
$node = node_load(array('title' => $edit['title']));
$this->assertNotNull(($node === FALSE ? NULL : $node), 'Node found in database. %s');
diff --git a/modules/poll/poll.test b/modules/poll/poll.test
index aed2a92b1..88c63e430 100644
--- a/modules/poll/poll.test
+++ b/modules/poll/poll.test
@@ -44,7 +44,7 @@ class PollTestCase extends DrupalWebTestCase {
class PollCreateTestCase extends PollTestCase {
/**
- * Implementation of getInfo() for information
+ * Implementation of getInfo().
*/
function getInfo() {
return array('name' => t('Poll create'), 'description' => 'Adds "more choices", previews and creates a poll.', 'group' => t('Poll'));
@@ -61,7 +61,7 @@ class PollCreateTestCase extends PollTestCase {
class PollVoteTestCase extends PollTestCase {
/**
- * Implementation of getInfo() for information
+ * Implementation of getInfo().
*/
function getInfo() {
return array('name' => t('Poll vote'), 'description' => 'Vote on a poll', 'group' => t('Poll'));
diff --git a/modules/profile/profile.test b/modules/profile/profile.test
index 33fa02e59..168bc9a9b 100644
--- a/modules/profile/profile.test
+++ b/modules/profile/profile.test
@@ -2,6 +2,9 @@
// $Id$
class ProfileTestSingleTestCase extends DrupalWebTestCase {
+ /**
+ * Implementation of getInfo().
+ */
function getInfo() {
$modules = (module_list());
return array('name' => 'Test single field', 'description' => "Testing profile module with add/edit/delete new fields into profile page" , 'group' => t('Profile'));
@@ -13,7 +16,7 @@ class ProfileTestSingleTestCase extends DrupalWebTestCase {
db_query('DELETE FROM {role} WHERE rid = %d', $id);
db_query('DELETE FROM {permission} WHERE rid = %d', $id);
- // Update the users who have this role set:
+ // Update the users who have this role set.
$result = db_query('SELECT DISTINCT(ur1.uid) FROM {users_roles} ur1 LEFT JOIN {users_roles} ur2 ON ur2.uid = ur1.uid WHERE ur1.rid = %d AND ur2.rid != ur1.rid', $id);
$uid = array();
@@ -45,7 +48,7 @@ class ProfileTestSingleTestCase extends DrupalWebTestCase {
function testProfileSingle() {
$this->drupalModuleEnable('profile');
- // create test user
+ // Create test user.
$edit['name'] = 'Profile '. $this->randomName(5);
$edit['perm'] = 'access administration pages, administer site configuration, administer users';
$rid = $this->_rolesApi('add', $edit );
@@ -55,13 +58,12 @@ class ProfileTestSingleTestCase extends DrupalWebTestCase {
unset($edit);
$edit['roles'] = array($rid => $rid);
$user = user_save('', array('name' => $name, 'pass' => $pass, 'init' => $mail, 'mail' => $mail, 'roles' => $edit['roles'], 'status' => 1));
- //log in
+ // Log in.
$edit = array('name' => $name, 'pass' => $pass);
$this->drupalPost('user', $edit, t('Log in'));
- //wartosci
$my_category = 'Simpletest';
- //single line textfield
+ // Single line textfield.
$title = "single_" . $this->randomName(10);
$form_name = 'profile_' . $title;
$explanation = $this->randomName(50);
@@ -74,17 +76,17 @@ class ProfileTestSingleTestCase extends DrupalWebTestCase {
$fid = db_result(db_query('SELECT fid FROM {profile_fields} WHERE title = "%s"', $title));
$single_field = array('title' => $title, 'form_name' => $form_name, 'explanation' => $explanation);
- // checking simple fields
+ // Checking simple fields.
$this->drupalGet("user/". $user->uid. "/edit/$my_category");
- // checking field
+ // Checking field.
$this->assertField($form_name , t('Found form named @name', array('@name' => $form_name)));
- // checking name
+ // Checking name.
$this->assertText($title, "Checking title for ". $title);
- // checking explanation
+ // Checking explanation.
$this->assertText($explanation, "Checking explanation for ". $title);
- // ok, now let put some data
+ // Insert some data.
unset($edit);
$edit = array();
$checking = array();
@@ -92,27 +94,27 @@ class ProfileTestSingleTestCase extends DrupalWebTestCase {
$this->drupalPost("user/". $user->uid. "/edit/$my_category", $edit, t('Save') , 0);
$this->drupalGet("user/". $user->uid);
- // checking profile page
+ // Check profile page.
$this->assertText($edit[$form_name], "Checking ". $edit[$form_name]);
$this->assertText($title, "Checking $title");
- // update field
+ // Update field.
$new_title = $this->randomName(20);
$this->drupalPost("admin/user/profile/edit/$fid", array('title' => $new_title), t('Save field') , 0);
$this->drupalGet("admin/user/profile");
$this->assertText($new_title, "Checking updated field");
- // deleting field
+ // Delete field.
$this->drupalPost("admin/user/profile/delete/$fid", array(), t('Delete'), 0);
$this->drupalGet("admin/user/profile");
$this->assertNoText($new_title, "Checking deleted field $title");
- // delete test user and roles
+ // Delete test user and roles.
if ($user->uid > 0) {
db_query('DELETE FROM {users} WHERE uid =%d', $user->uid);
db_query('DELETE FROM {users_roles} WHERE uid = %d', $user->uid);
module_invoke_all('user', 'delete', '', $user);
}
- //delete roles
+ // Delete roles.
$edit['rid'] = $rid;
$this->_rolesApi('delete', $edit);
}
@@ -120,6 +122,9 @@ class ProfileTestSingleTestCase extends DrupalWebTestCase {
}
class ProfileTestTextareaTestCase extends DrupalWebTestCase {
+ /**
+ * Implementation of getInfo().
+ */
function getInfo() {
$modules = (module_list());
return array('name' => 'Test textarea field', 'description' => "Testing profile module with add/edit/delete new fields into profile page" , 'group' => t('Profile'));
@@ -131,7 +136,7 @@ class ProfileTestTextareaTestCase extends DrupalWebTestCase {
db_query('DELETE FROM {role} WHERE rid = %d', $id);
db_query('DELETE FROM {permission} WHERE rid = %d', $id);
- // Update the users who have this role set:
+ // Update the users who have this role set.
$result = db_query('SELECT DISTINCT(ur1.uid) FROM {users_roles} ur1 LEFT JOIN {users_roles} ur2 ON ur2.uid = ur1.uid WHERE ur1.rid = %d AND ur2.rid != ur1.rid', $id);
$uid = array();
@@ -163,7 +168,7 @@ class ProfileTestTextareaTestCase extends DrupalWebTestCase {
function testProfileSingle() {
$this->drupalModuleEnable('profile');
- // create test user
+ // Create test user.
$edit['name'] = 'Profile '. $this->randomName(5);
$edit['perm'] = 'access content, administer users, administer site configuration, access administration pages, access configuration pages, access user profiles';
$rid = $this->_rolesApi('add', $edit );
@@ -177,9 +182,8 @@ class ProfileTestTextareaTestCase extends DrupalWebTestCase {
$edit = array('name' => $name, 'pass' => $pass);
$this->drupalPost('user', $edit, t('Log in'), 0 );
- //wartosci
$my_category = 'Simpletest';
- //single line textfield
+ // Single line textfield.
$title = "single_" . $this->randomName(10);
$form_name = 'profile_' . $title;
$explanation = $this->randomName(50);
@@ -188,10 +192,10 @@ class ProfileTestTextareaTestCase extends DrupalWebTestCase {
$fid = db_result(db_query('SELECT fid FROM {profile_fields} WHERE title = "%s"', $title));
$single_field = array('title' => $title, 'form_name' => $form_name, 'explanation' => $explanation);
- // checking simple fields
+ // Checking simple fields.
$this->drupalGet("user/". $user->uid. "/edit/$my_category");
- // checking field
+ // Checking field.
$this->assertField($form_name, '');
// checking name
$this->assertText($title, "Checking title for ". $title);