diff options
author | Dries Buytaert <dries@buytaert.net> | 2008-05-30 07:30:53 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2008-05-30 07:30:53 +0000 |
commit | c6c26b5e230b5225ea8a355b6e7a7b31096f7cb3 (patch) | |
tree | 18f49ddd773f033ed75eba1fa70dc55de1952f55 /modules | |
parent | bc5f69a333af204f8e6c6494d85c96b2da1e1c51 (diff) | |
download | drupal-c6c26b5e230b5225ea8a355b6e7a7b31096f7cb3.tar.gz drupal-c6c26b5e230b5225ea8a355b6e7a7b31096f7cb3.zip |
- Patch #247423 by boombatower: code style fixes for the tests.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/aggregator/aggregator.test | 14 | ||||
-rw-r--r-- | modules/block/block.test | 14 | ||||
-rw-r--r-- | modules/blog/blog.test | 22 | ||||
-rw-r--r-- | modules/blogapi/blogapi.test | 4 | ||||
-rw-r--r-- | modules/comment/comment.test | 56 | ||||
-rw-r--r-- | modules/contact/contact.test | 12 | ||||
-rw-r--r-- | modules/dblog/dblog.test | 18 | ||||
-rw-r--r-- | modules/filter/filter.test | 16 | ||||
-rw-r--r-- | modules/forum/forum.test | 50 | ||||
-rw-r--r-- | modules/help/help.test | 8 | ||||
-rw-r--r-- | modules/locale/locale.test | 4 | ||||
-rw-r--r-- | modules/menu/menu.test | 20 | ||||
-rw-r--r-- | modules/php/php.test | 6 | ||||
-rw-r--r-- | modules/profile/profile.test | 8 | ||||
-rw-r--r-- | modules/search/search.test | 6 | ||||
-rw-r--r-- | modules/syslog/syslog.test | 2 | ||||
-rw-r--r-- | modules/taxonomy/taxonomy.test | 6 | ||||
-rw-r--r-- | modules/tracker/tracker.test | 8 | ||||
-rw-r--r-- | modules/translation/translation.test | 18 | ||||
-rw-r--r-- | modules/trigger/trigger.test | 4 | ||||
-rw-r--r-- | modules/upload/upload.test | 72 | ||||
-rw-r--r-- | modules/user/upload.test | 64 | ||||
-rw-r--r-- | modules/user/user.test | 6 |
23 files changed, 219 insertions, 219 deletions
diff --git a/modules/aggregator/aggregator.test b/modules/aggregator/aggregator.test index f504cde4887..eadaf8ec4d3 100644 --- a/modules/aggregator/aggregator.test +++ b/modules/aggregator/aggregator.test @@ -34,7 +34,7 @@ class AggregatorTestCase extends DrupalWebTestCase { * @param object $feed Feed object representing the feed. */ function deleteFeed($feed) { - $this->drupalPost('admin/content/aggregator/edit/feed/'. $feed->fid, array(), t('Delete')); + $this->drupalPost('admin/content/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.')); } @@ -45,7 +45,7 @@ class AggregatorTestCase extends DrupalWebTestCase { */ function getFeedEditArray() { $feed_name = $this->randomName(10, self::$prefix); - $feed_url = url(NULL, array('absolute' => TRUE)) .'rss.xml?feed='. $feed_name; + $feed_url = url(NULL, array('absolute' => TRUE)) . 'rss.xml?feed=' . $feed_name; $edit = array( 'title' => $feed_name, 'url' => $feed_url, @@ -69,7 +69,7 @@ class AggregatorTestCase extends DrupalWebTestCase { $feed_count = $feed_count > 10 ? 10 : $feed_count; // Refresh the feed (simulated link click). - $this->drupalGet('admin/content/aggregator/update/'. $feed->fid); + $this->drupalGet('admin/content/aggregator/update/' . $feed->fid); // Ensure we have the right number of items. $result = db_query('SELECT iid FROM {aggregator_item} WHERE fid = %d', $feed->fid); @@ -141,7 +141,7 @@ class AddFeedTestCase extends AggregatorTestCase { $this->assertTrue($this->uniqueFeed($feed->title, $feed->url), t('The feed is unique.')); // Check feed source. - $this->drupalGet('aggregator/sources/'. $feed->fid); + $this->drupalGet('aggregator/sources/' . $feed->fid); $this->assertResponse(200, t('Feed source exists.')); $this->assertText($feed->title, t('Page title')); @@ -171,7 +171,7 @@ class UpdateFeedTestCase extends AggregatorTestCase { // Get new feed data array and modify newly created feed. $edit = $this->getFeedEditArray(); $edit['refresh'] = 1800; // Change refresh value. - $this->drupalPost('admin/content/aggregator/edit/feed/'. $feed->fid, $edit, t('Save')); + $this->drupalPost('admin/content/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']))); // Check feed data. @@ -179,7 +179,7 @@ class UpdateFeedTestCase extends AggregatorTestCase { $this->assertTrue($this->uniqueFeed($edit['title'], $edit['url']), t('The feed is unique.')); // Check feed source. - $this->drupalGet('aggregator/sources/'. $feed->fid); + $this->drupalGet('aggregator/sources/' . $feed->fid); $this->assertResponse(200, t('Feed source exists.')); $this->assertText($edit['title'], t('Page title')); @@ -211,7 +211,7 @@ class RemoveFeedTestCase extends AggregatorTestCase { $this->deleteFeed($feed); // Check feed source. - $this->drupalGet('aggregator/sources/'. $feed->fid); + $this->drupalGet('aggregator/sources/' . $feed->fid); $this->assertResponse(404, t('Deleted feed source does not exists.')); // Check database for feed. diff --git a/modules/block/block.test b/modules/block/block.test index 85a95e60347..8f812e9c476 100644 --- a/modules/block/block.test +++ b/modules/block/block.test @@ -45,7 +45,7 @@ class BlockTestCase extends DrupalWebTestCase { // Set the created box to a specific region. // TODO: Implement full region checking. $edit = array(); - $edit['block_'. $bid .'[region]'] = 'left'; + $edit['block_' . $bid . '[region]'] = 'left'; $this->drupalPost('admin/build/block', $edit, t('Save blocks')); // Confirm that the box was moved to the proper region. @@ -55,7 +55,7 @@ class BlockTestCase extends DrupalWebTestCase { $this->assertText(t($box['title']), t('Box successfully being displayed on the page.')); // Delete the created box & verify that it's been deleted and no longer appearing on the page. - $this->drupalPost('admin/build/block/delete/'. $bid, array(), t('Delete')); + $this->drupalPost('admin/build/block/delete/' . $bid, array(), t('Delete')); $this->assertRaw(t('The block %title has been removed.', array('%title' => $box['info'])), t('Box successfully deleted.')); $this->assertNoText(t($box['title']), t('Box no longer appears on page.')); } @@ -71,7 +71,7 @@ class BlockTestCase extends DrupalWebTestCase { $block['title'] = $this->randomName(8); // Set block title to confirm that interface works and override any custom titles. - $this->drupalPost('admin/build/block/configure/'. $block['module'] .'/'. $block['delta'], array('title' => $block['title']), t('Save block')); + $this->drupalPost('admin/build/block/configure/' . $block['module'] . '/' . $block['delta'], array('title' => $block['title']), t('Save block')); $this->assertText(t('The block configuration has been saved.'), t('Block title set.')); $bid = db_result(db_query("SELECT bid FROM {blocks} WHERE module = '%s' AND delta = %d", array($block['module'], $block['delta']))); @@ -80,7 +80,7 @@ class BlockTestCase extends DrupalWebTestCase { // Set the created block to a specific region. $edit = array(); - $edit[$block['module'] .'_'. $block['delta'] .'[region]'] = 'left'; + $edit[$block['module'] . '_' . $block['delta'] . '[region]'] = 'left'; $this->drupalPost('admin/build/block', $edit, t('Save blocks')); // Confirm that the block was moved to the proper region. @@ -92,7 +92,7 @@ class BlockTestCase extends DrupalWebTestCase { // Set the block to the disabled region. $edit = array(); - $edit[$block['module'] .'_'. $block['delta'] .'[region]'] = '-1'; + $edit[$block['module'] . '_' . $block['delta'] . '[region]'] = '-1'; $this->drupalPost('admin/build/block', $edit, t('Save blocks')); // Confirm that the block was moved to the proper region. @@ -101,11 +101,11 @@ class BlockTestCase extends DrupalWebTestCase { // For convenience of developers, put the navigation block back. $edit = array(); - $edit[$block['module'] .'_'. $block['delta'] .'[region]'] = 'left'; + $edit[$block['module'] . '_' . $block['delta'] . '[region]'] = 'left'; $this->drupalPost('admin/build/block', $edit, t('Save blocks')); $this->assertText(t('The block settings have been updated.'), t('Block successfully move to disabled region.')); - $this->drupalPost('admin/build/block/configure/'. $block['module'] .'/'. $block['delta'], array('title' => 'Navigation'), t('Save block')); + $this->drupalPost('admin/build/block/configure/' . $block['module'] . '/' . $block['delta'], array('title' => 'Navigation'), t('Save block')); $this->assertText(t('The block configuration has been saved.'), t('Block title set.')); } } diff --git a/modules/blog/blog.test b/modules/blog/blog.test index c9019e9298e..f4cc5285ace 100644 --- a/modules/blog/blog.test +++ b/modules/blog/blog.test @@ -100,7 +100,7 @@ class BlogTestCase extends DrupalWebTestCase { if ($response2 == 200) { $this->assertTitle(t('Blog | Drupal'), t('Blog help node was displayed')); $this->assertText(t('Blog'), t('Blog help node was displayed')); - $this->assertText(t('Home '. $crumb .' Administer '. $crumb .' Help'), t('Breadcrumbs were displayed')); + $this->assertText(t('Home ' . $crumb . ' Administer ' . $crumb . ' Help'), t('Breadcrumbs were displayed')); } // Verify the blog block was displayed. @@ -109,17 +109,17 @@ class BlogTestCase extends DrupalWebTestCase { $this->assertText(t('Recent blog posts'), t('Blog block was displayed')); // View blog node. - $this->drupalGet('node/'. $node->nid); + $this->drupalGet('node/' . $node->nid); $this->assertResponse(200); $this->assertTitle($node->title. ' | Drupal', t('Blog node was displayed')); - $this->assertText(t('Home '. $crumb .' Blogs '. $crumb .' @name'. $quote .'s blog', array('@name' => $node_user->name)), t('Breadcrumbs were displayed')); + $this->assertText(t('Home ' . $crumb . ' Blogs ' . $crumb . ' @name' . $quote . 's blog', array('@name' => $node_user->name)), t('Breadcrumbs were displayed')); // View blog edit node. - $this->drupalGet('node/'. $node->nid .'/edit'); + $this->drupalGet('node/' . $node->nid . '/edit'); $this->assertResponse($response); if ($response == 200) { $this->assertTitle($node->title. ' | Drupal', t('Blog edit node was displayed')); - $this->assertText(t('Home '. $crumb .' @title', array('@title' => $node->title)), t('Breadcrumbs were displayed')); + $this->assertText(t('Home ' . $crumb . ' @title', array('@title' => $node->title)), t('Breadcrumbs were displayed')); } if ($response == 200) { @@ -127,11 +127,11 @@ class BlogTestCase extends DrupalWebTestCase { $edit = array(); $edit['title'] = 'node/' . $node->nid; $edit['body'] = $this->randomName(256); - $this->drupalPost('node/'. $node->nid .'/edit', $edit, t('Save')); + $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save')); $this->assertRaw(t('Blog entry %title has been updated.', array('%title' => $edit['title'])), t('Blog node was edited')); // Delete blog node. - $this->drupalPost('node/'. $node->nid .'/delete', array(), t('Delete')); + $this->drupalPost('node/' . $node->nid . '/delete', array(), t('Delete')); $this->assertResponse($response); $this->assertRaw(t('Blog entry %title has been deleted.', array('%title' => $edit['title'])), t('Blog node was deleted')); } @@ -147,7 +147,7 @@ class BlogTestCase extends DrupalWebTestCase { $crumb = '›'; // Confirm blog entries link exists on the user page. - $this->drupalGet('user/'. $user->uid); + $this->drupalGet('user/' . $user->uid); $this->assertResponse(200); $this->assertText(t('View recent blog entries'), t('View recent blog entries link was displayed')); @@ -162,16 +162,16 @@ class BlogTestCase extends DrupalWebTestCase { $this->assertText(t('Home'), t('Breadcrumbs were displayed')); // Confirm a blog page was displayed per user. - $this->drupalGet('blog/'. $user->uid); + $this->drupalGet('blog/' . $user->uid); $this->assertTitle(t("@name's blog | Drupal", array('@name' => $user->name)), t('User blog node was displayed')); - $this->assertText(t('Home '. $crumb .' Blogs'), t('Breadcrumbs were displayed')); + $this->assertText(t('Home ' . $crumb . ' Blogs'), t('Breadcrumbs were displayed')); // Confirm a blog feed was displayed. $this->drupalGet('blog/feed'); $this->assertTitle(t('Drupal blogs'), t('Blog feed was displayed')); // Confirm a blog feed was displayed per user. - $this->drupalGet('blog/'. $user->uid .'/feed'); + $this->drupalGet('blog/' . $user->uid . '/feed'); $this->assertTitle(t("@name's blog", array('@name' => $user->name)), t('User blog feed was displayed')); } } diff --git a/modules/blogapi/blogapi.test b/modules/blogapi/blogapi.test index 0f7770d4184..cd0475433b8 100644 --- a/modules/blogapi/blogapi.test +++ b/modules/blogapi/blogapi.test @@ -75,7 +75,7 @@ class BlogAPITestCase extends DrupalWebTestCase { $file = current($this->drupalGetTestFiles('text')); $file_contents = file_get_contents($file->filename); $file = array(); - $file['name'] = $this->randomName() .'.txt'; + $file['name'] = $this->randomName() . '.txt'; $file['type'] = 'text'; $file['bits'] = xmlrpc_base64($file_contents); $result = xmlrpc($local, 'metaWeblog.newMediaObject', $blog_id, $web_user->name, $web_user->pass_raw, $file); @@ -146,7 +146,7 @@ class BlogAPITestCase extends DrupalWebTestCase { function addTerm($vid, $term) { $edit = array(); $edit['name'] = $term; - $this->drupalPost('admin/content/taxonomy/'. $vid .'/add/term', $edit, t('Save')); + $this->drupalPost('admin/content/taxonomy/' . $vid . '/add/term', $edit, t('Save')); $this->assertRaw(t('Created new term %term.', array('%term' => $edit['name'])), t('Taxonomy term added.')); $tree = taxonomy_get_tree($vid); diff --git a/modules/comment/comment.test b/modules/comment/comment.test index d70708c18f9..f8933b82023 100644 --- a/modules/comment/comment.test +++ b/modules/comment/comment.test @@ -44,7 +44,7 @@ class CommentTestCase extends DrupalWebTestCase { // Post comment without subject. $this->drupalLogin($this->web_user); - $this->drupalGet('comment/reply/'. $this->node->nid); + $this->drupalGet('comment/reply/' . $this->node->nid); $this->assertNoFieldByName('subject', '', t('Subject field not found.')); // Set comments to have subject and preview to required. @@ -60,12 +60,12 @@ class CommentTestCase extends DrupalWebTestCase { $this->assertTrue($this->commentExists($comment), t('Comment found.')); // Reply to comment. - $this->drupalGet('comment/reply/'. $this->node->nid .'/'. $comment->id); + $this->drupalGet('comment/reply/' . $this->node->nid . '/' . $comment->id); $reply = $this->postComment(NULL, $this->randomName(), $this->randomName()); $this->assertTrue($this->commentExists($reply, TRUE), t('Reply found.')); // Edit reply. - $this->drupalGet('comment/edit/'. $reply->id); + $this->drupalGet('comment/edit/' . $reply->id); $reply = $this->postComment(NULL, $this->randomName(), $this->randomName()); $this->assertTrue($this->commentExists($reply, TRUE), t('Modified reply found.')); @@ -74,7 +74,7 @@ class CommentTestCase extends DrupalWebTestCase { $this->drupalLogin($this->admin_user); $this->deleteComment($comment); - $this->drupalGet('node/'. $this->node->nid); + $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.')); } @@ -90,7 +90,7 @@ class CommentTestCase extends DrupalWebTestCase { // Submit comment through node form. $this->drupalLogin($this->web_user); - $this->drupalGet('node/'. $this->node->nid); + $this->drupalGet('node/' . $this->node->nid); $form_comment = $this->postComment(NULL, $this->randomName(), $this->randomName()); $this->assertTrue($this->commentExists($form_comment), t('Form comment found.')); @@ -120,7 +120,7 @@ class CommentTestCase extends DrupalWebTestCase { $this->drupalLogout(); // Post anonymous comment with contact info (optional). - $this->drupalGet('comment/reply/'. $this->node->nid); + $this->drupalGet('comment/reply/' . $this->node->nid); $this->assertTrue($this->commentContactInfoAvailable(), t('Contact information available.')); $anonymous_comment2 = $this->postComment($this->node, $this->randomName(), $this->randomName()); @@ -132,7 +132,7 @@ class CommentTestCase extends DrupalWebTestCase { $this->drupalLogout(); // Try to post comment with contact info (required). - $this->drupalGet('comment/reply/'. $this->node->nid); + $this->drupalGet('comment/reply/' . $this->node->nid); $this->assertTrue($this->commentContactInfoAvailable(), t('Contact information available.')); $anonymous_comment3 = $this->postComment($this->node, $this->randomName(), $this->randomName(), TRUE, TRUE); @@ -148,19 +148,19 @@ class CommentTestCase extends DrupalWebTestCase { $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 . ']', t('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 . ']', t('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 . ']', t('Comment was deleted.')); // Set anonymouse comments to require approval. $this->setAnonymousUserComment(TRUE, FALSE); @@ -186,7 +186,7 @@ class CommentTestCase extends DrupalWebTestCase { $this->performCommentOperation($anonymous_comment4, 'publish', TRUE); $this->drupalLogout(); - $this->drupalGet('node/'. $this->node->nid); + $this->drupalGet('node/' . $this->node->nid); $this->assertTrue($this->commentExists($anonymous_comment4), t('Anonymous comment visible.')); // Reset. @@ -213,7 +213,7 @@ class CommentTestCase extends DrupalWebTestCase { } if ($node !== NULL) { - $this->drupalGet('comment/reply/'. $node->nid); + $this->drupalGet('comment/reply/' . $node->nid); } if ($preview) { @@ -245,11 +245,11 @@ class CommentTestCase extends DrupalWebTestCase { */ function commentExists($comment, $reply = FALSE) { if ($comment && is_object($comment)) { - $regex = '/'. ($reply ? '<div class="indented">(.*?)' : ''); - $regex .= '<a id="comment-'. $comment->id .'"(.*?)'; // Comment anchor. + $regex = '/' . ($reply ? '<div class="indented">(.*?)' : ''); + $regex .= '<a id="comment-' . $comment->id . '"(.*?)'; // Comment anchor. $regex .= '<div(.*?)'; // Begin in comment div. - $regex .= $comment->subject .'(.*?)'; // Match subject. - $regex .= $comment->comment .'(.*?)'; // Match comment. + $regex .= $comment->subject . '(.*?)'; // Match subject. + $regex .= $comment->comment . '(.*?)'; // Match comment. $regex .= '<\/div>/s'; // Dot matches newlines and ensure that match doesn't bleed outside comment div. return preg_match($regex, $this->drupalGetContent()); @@ -266,7 +266,7 @@ class CommentTestCase extends DrupalWebTestCase { * Comment to delete. */ function deleteComment($comment) { - $this->drupalPost('comment/delete/'. $comment->id, array(), t('Delete')); + $this->drupalPost('comment/delete/' . $comment->id, array(), t('Delete')); $this->assertText(t('The comment and all its replies have been deleted.'), t('Comment deleted.')); } @@ -277,7 +277,7 @@ class CommentTestCase extends DrupalWebTestCase { * Subject value. */ function setCommentSubject($enabled) { - $this->setCommentSettings('comment_subject_field', ($enabled ? '1' : '0'), 'Comment subject '. ($enabled ? 'enabled' : 'disabled') .'.'); + $this->setCommentSettings('comment_subject_field', ($enabled ? '1' : '0'), 'Comment subject ' . ($enabled ? 'enabled' : 'disabled') . '.'); } /** @@ -287,7 +287,7 @@ class CommentTestCase extends DrupalWebTestCase { * Preview value. */ function setCommentPreview($required) { - $this->setCommentSettings('comment_preview', ($required ? '1' : '0'), 'Comment preview '. ($required ? 'required' : 'optional') .'.'); + $this->setCommentSettings('comment_preview', ($required ? '1' : '0'), 'Comment preview ' . ($required ? 'required' : 'optional') . '.'); } /** @@ -297,7 +297,7 @@ class CommentTestCase extends DrupalWebTestCase { * Form value. */ function setCommentForm($enabled) { - $this->setCommentSettings('comment_form_location', ($enabled ? '1' : '3'), 'Comment controls '. ($enabled ? 'enabled' : 'disabled') .'.'); + $this->setCommentSettings('comment_form_location', ($enabled ? '1' : '3'), 'Comment controls ' . ($enabled ? 'enabled' : 'disabled') . '.'); } /** @@ -307,7 +307,7 @@ class CommentTestCase extends DrupalWebTestCase { * Anonymous level. */ function setCommentAnonymous($level) { - $this->setCommentSettings('comment_anonymous', $level, 'Anonymous commenting set to level '. $level .'.'); + $this->setCommentSettings('comment_anonymous', $level, 'Anonymous commenting set to level ' . $level . '.'); } /** @@ -321,7 +321,7 @@ class CommentTestCase extends DrupalWebTestCase { * Status message to display. */ function setCommentSettings($name, $value, $message) { - variable_set($name .'_story', $value); + variable_set($name . '_story', $value); $this->assertTrue(TRUE, t($message)); // Display status message. } @@ -339,7 +339,7 @@ class CommentTestCase extends DrupalWebTestCase { $edit['1[post comments]'] = $enabled; $edit['1[post comments without approval]'] = $without_approval; $this->drupalPost('admin/user/permissions', $edit, t('Save permissions')); - $this->assertText(t('The changes have been saved.'), t('Anonymous user comments '. ($enabled ? 'enabled' : 'disabled') .'.')); + $this->assertText(t('The changes have been saved.'), t('Anonymous user comments ' . ($enabled ? 'enabled' : 'disabled') . '.')); } /** @@ -364,15 +364,15 @@ class CommentTestCase extends DrupalWebTestCase { function performCommentOperation($comment, $operation, $approval = FALSE) { $edit = array(); $edit['operation'] = $operation; - $edit['comments['. $comment->id .']'] = TRUE; - $this->drupalPost('admin/content/comment'. ($approval ? '/approval' : ''), $edit, t('Update')); + $edit['comments[' . $comment->id . ']'] = TRUE; + $this->drupalPost('admin/content/comment' . ($approval ? '/approval' : ''), $edit, t('Update')); if ($operation == 'delete') { $this->drupalPost(NULL, array(), t('Delete comments')); - $this->assertText(t('The comments have been deleted.'), t('Operation "'. $operation .'" was performed on comment.')); + $this->assertText(t('The comments have been deleted.'), t('Operation "' . $operation . '" was performed on comment.')); } else { - $this->assertText(t('The update has been performed.'), t('Operation "'. $operation .'" was performed on comment.')); + $this->assertText(t('The update has been performed.'), t('Operation "' . $operation . '" was performed on comment.')); } } @@ -386,7 +386,7 @@ class CommentTestCase extends DrupalWebTestCase { */ function getUnaprovedComment($subject) { $this->drupalGet('admin/content/comment/approval'); - preg_match('/href="(.*?)#comment-([^"]+)"(.*?)>('. $subject .')/', $this->drupalGetContent(), $match); + preg_match('/href="(.*?)#comment-([^"]+)"(.*?)>(' . $subject . ')/', $this->drupalGetContent(), $match); return $match[2]; } diff --git a/modules/contact/contact.test b/modules/contact/contact.test index de637e829ec..b6b87d1ecdd 100644 --- a/modules/contact/contact.test +++ b/modules/contact/contact.test @@ -44,7 +44,7 @@ class ContactTestCase extends DrupalWebTestCase { $invalid_recipients = array('invalid', 'invalid@', /*'invalid@site', 'invalid@site.',*/ '@site.', '@site.com'); foreach ($invalid_recipients as $invalid_recipient) { $this->addCategory($this->randomName(16), $invalid_recipient, '', FALSE); - $this->assertRaw(t('%recipient is an invalid e-mail address.', array('%recipient' => $invalid_recipient)), t('Caught invalid recipient ('. $invalid_recipient .').')); + $this->assertRaw(t('%recipient is an invalid e-mail address.', array('%recipient' => $invalid_recipient)), t('Caught invalid recipient (' . $invalid_recipient . ').')); } // Create valid categories. @@ -132,7 +132,7 @@ class ContactTestCase extends DrupalWebTestCase { $this->drupalLogin($web_user1); - $this->drupalGet('user/'. $web_user2->uid .'/contact'); + $this->drupalGet('user/' . $web_user2->uid . '/contact'); $this->assertResponse(200, t('Access to personal contact form granted.')); $edit = array(); @@ -160,7 +160,7 @@ class ContactTestCase extends DrupalWebTestCase { $this->drupalLogin($web_user3); - $this->drupalGet('user/'. $web_user4->uid .'/contact'); + $this->drupalGet('user/' . $web_user4->uid . '/contact'); $this->assertResponse(403, t('Access to personal contact form denied.')); } @@ -207,7 +207,7 @@ class ContactTestCase extends DrupalWebTestCase { $categories = $this->getCategories(); foreach ($categories as $category) { $category_name = db_result(db_query('SELECT category FROM {contact} WHERE cid = %d', array($category))); - $this->drupalPost('admin/build/contact/delete/'. $category, array(), t('Delete')); + $this->drupalPost('admin/build/contact/delete/' . $category, array(), t('Delete')); $this->assertRaw(t('Category %category has been deleted.', array('%category' => $category_name)), t('Category deleted sucessfully.')); } } @@ -236,13 +236,13 @@ class ContactTestCase extends DrupalWebTestCase { // Get role id (rid) for specified role. $rid = db_result(db_query("SELECT rid FROM {role} WHERE name = '%s'", array($role))); if ($rid === FALSE) { - $this->fail(t(' [permission] Role "'. $role .'" not found.')); + $this->fail(t(' [permission] Role "' . $role . '" not found.')); } // Create edit array from permission. $edit = array(); foreach ($permissions as $name => $value) { - $edit[$rid .'['. $name .']'] = $value; + $edit[$rid . '[' . $name . ']'] = $value; } $this->drupalPost('admin/user/permissions', $edit, t('Save permissions')); diff --git a/modules/dblog/dblog.test b/modules/dblog/dblog.test index 1fe2b0dba70..8fa75e4daf8 100644 --- a/modules/dblog/dblog.test +++ b/modules/dblog/dblog.test @@ -108,7 +108,7 @@ class DBLogTestCase extends DrupalWebTestCase { ); $message = 'Log entry added to test the dblog row limit.'; for ($i = 0; $i < $count; $i++) { - $log['message'] = $i. ' => ' .$message; + $log['message'] = $i . ' => ' . $message; dblog_watchdog($log); } } @@ -139,14 +139,14 @@ class DBLogTestCase extends DrupalWebTestCase { $this->drupalGet('admin/reports/page-not-found'); $this->assertResponse($response); if ($response == 200) { - $this->assertText(t('Top '. $quote .'page not found'. $quote .' errors'), t('DBLog page-not-found report was displayed')); + $this->assertText(t('Top ' . $quote . 'page not found' . $quote . ' errors'), t('DBLog page-not-found report was displayed')); } // View dblog access-denied report node. $this->drupalGet('admin/reports/access-denied'); $this->assertResponse($response); if ($response == 200) { - $this->assertText(t('Top '. $quote .'access denied'. $quote .' errors'), t('DBLog access-denied report was displayed')); + $this->assertText(t('Top ' . $quote . 'access denied' . $quote . ' errors'), t('DBLog access-denied report was displayed')); } // View dblog event node. @@ -184,7 +184,7 @@ class DBLogTestCase extends DrupalWebTestCase { // Add user using form to generate add user event (which is not triggered by drupalCreateUser). $edit = array(); $edit['name'] = $name; - $edit['mail'] = $name .'@example.com'; + $edit['mail'] = $name . '@example.com'; $edit['pass[pass1]'] = $pass; $edit['pass[pass2]'] = $pass; $edit['status'] = 1; @@ -252,7 +252,7 @@ class DBLogTestCase extends DrupalWebTestCase { */ private function doNode($type) { // Create user. - $perm = array('create '. $type .' content', 'edit own '. $type .' content', 'delete own '. $type .' content'); + $perm = array('create ' . $type . ' content', 'edit own ' . $type . ' content', 'delete own ' . $type . ' content'); $user = $this->drupalCreateUser($perm); // Login user. $this->drupalLogin($user); @@ -260,20 +260,20 @@ class DBLogTestCase extends DrupalWebTestCase { // Create node using form to generate add content event (which is not triggered by drupalCreateNode). $edit = $this->getContent($type); $title = $edit['title']; - $this->drupalPost('node/add/'. $type, $edit, t('Save')); + $this->drupalPost('node/add/' . $type, $edit, t('Save')); $this->assertResponse(200); // Retrieve node object. $node = node_load(array('title' => $title)); $this->assertTrue($node != null, t('Node @title was loaded', array('@title' => $title))); // Edit node. $edit = $this->getContentUpdate($type); - $this->drupalPost('node/'. $node->nid .'/edit', $edit, t('Save')); + $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save')); $this->assertResponse(200); // Delete node. - $this->drupalPost('node/'. $node->nid .'/delete', array(), t('Delete')); + $this->drupalPost('node/' . $node->nid . '/delete', array(), t('Delete')); $this->assertResponse(200); // View node (to generate page not found event). - $this->drupalGet('node/'. $node->nid); + $this->drupalGet('node/' . $node->nid); $this->assertResponse(404); // View the dblog report (to generate access denied event). $this->drupalGet('admin/reports/dblog'); diff --git a/modules/filter/filter.test b/modules/filter/filter.test index c146d159b6a..924de3486c7 100644 --- a/modules/filter/filter.test +++ b/modules/filter/filter.test @@ -39,7 +39,7 @@ class FilterAdminTestCase extends DrupalWebTestCase { // Add an additional tag. $edit = array(); $edit['allowed_html_1'] = '<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>' . ' <quote>'; // Adding <quote> tag. - $this->drupalPost('admin/settings/filters/' . $filtered .'/configure', $edit, t('Save configuration')); + $this->drupalPost('admin/settings/filters/' . $filtered . '/configure', $edit, t('Save configuration')); $this->assertText(t('The configuration options have been saved.'), t('Allowed HTML tag added.')); $this->assertRaw(htmlentities($edit['allowed_html_1']), t('Tag displayed.')); @@ -49,8 +49,8 @@ class FilterAdminTestCase extends DrupalWebTestCase { // Reorder filters. $edit = array(); - $edit['weights[filter/' . $second_filter .']'] = 1; - $edit['weights[filter/' . $first_filter .']'] = 2; + $edit['weights[filter/' . $second_filter . ']'] = 1; + $edit['weights[filter/' . $first_filter . ']'] = 2; $this->drupalPost('admin/settings/filters/' . $filtered . '/order', $edit, t('Save configuration')); $this->assertText(t('The filter ordering has been saved.'), t('Order saved successfully.')); @@ -131,7 +131,7 @@ class FilterAdminTestCase extends DrupalWebTestCase { // 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->drupalPost('admin/settings/filters/' . $filtered . '/configure', $edit, t('Save configuration')); $this->assertText(t('The configuration options have been saved.'), t('Changes reverted.')); // Full HTML. @@ -142,9 +142,9 @@ class FilterAdminTestCase extends DrupalWebTestCase { // Filter order. $edit = array(); - $edit['weights[filter/' . $second_filter .']'] = 2; - $edit['weights[filter/' . $first_filter .']'] = 1; - $this->drupalPost('admin/settings/filters/' . $filtered .'/order', $edit, t('Save configuration')); + $edit['weights[filter/' . $second_filter . ']'] = 2; + $edit['weights[filter/' . $first_filter . ']'] = 1; + $this->drupalPost('admin/settings/filters/' . $filtered . '/order', $edit, t('Save configuration')); $this->assertText(t('The filter ordering has been saved.'), t('Order successfully reverted.')); } @@ -269,7 +269,7 @@ END; $edit['type'] = 'page'; $page = $this->drupalCreateNode($edit); - $this->drupalGet('node/' .$page->nid); + $this->drupalGet('node/' . $page->nid); $this->assertRaw('href="http://www.test1.com"', t('Parse simple www-string but not the end-of-sentence period.')); $this->assertRaw('href="mailto:person@test2.com"', t('Parse simple email string but not the end-of-sentence period.')); $this->assertRaw('href="http://www.test3.com"', t('Parse simple HTTP URL but not the end-of-sentence period.')); diff --git a/modules/forum/forum.test b/modules/forum/forum.test index a92fa190a23..8988e6d0f8c 100644 --- a/modules/forum/forum.test +++ b/modules/forum/forum.test @@ -96,7 +96,7 @@ class ForumTestCase extends DrupalWebTestCase { // Add forum to navigation menu. $edit = array(); - $edit['mlid:'. $mlid .'[hidden]'] = TRUE; + $edit['mlid:' . $mlid . '[hidden]'] = TRUE; $this->drupalPost('admin/build/menu-customize/navigation', $edit, t('Save configuration')); $this->assertResponse(200); @@ -134,7 +134,7 @@ class ForumTestCase extends DrupalWebTestCase { ); // Edit the vocabulary. - $this->drupalPost('admin/content/taxonomy/edit/vocabulary/'. $vid, $edit, t('Save')); + $this->drupalPost('admin/content/taxonomy/edit/vocabulary/' . $vid, $edit, t('Save')); $this->assertResponse(200); $this->assertRaw(t('Updated vocabulary %name.', array('%name' => $title)), t('Vocabulary was edited')); @@ -158,7 +158,7 @@ class ForumTestCase extends DrupalWebTestCase { ); // Edit the vocabulary. - $this->drupalPost('admin/content/taxonomy/edit/vocabulary/'. $vid, $edit, t('Save')); + $this->drupalPost('admin/content/taxonomy/edit/vocabulary/' . $vid, $edit, t('Save')); $this->assertResponse(200); $this->assertRaw(t('Updated vocabulary %name.', array('%name' => $title)), t('Vocabulary was edited')); /* @@ -191,19 +191,19 @@ class ForumTestCase extends DrupalWebTestCase { ); // Create forum. - $this->drupalPost('admin/content/forum/add/'. $type, $edit, t('Save')); + $this->drupalPost('admin/content/forum/add/' . $type, $edit, t('Save')); $this->assertResponse(200); $type = ($type == 'container') ? 'forum container' : 'forum'; - $this->assertRaw(t('Created new @type %term.', array('%term' => $name, '@type' => t($type))), t(ucfirst($type) .' was created')); + $this->assertRaw(t('Created new @type %term.', array('%term' => $name, '@type' => t($type))), t(ucfirst($type) . ' was created')); // Verify forum. $term = db_fetch_array(db_query("SELECT * FROM {term_data} t WHERE t.vid = %d AND t.name = '%s' AND t.description = '%s'", variable_get('forum_nav_vocabulary', ''), $name, $description)); - $this->assertTrue(!empty($term), 'The '. $type .' exists in the database'); + $this->assertTrue(!empty($term), 'The ' . $type . ' exists in the database'); // Verify forum hierarchy. $tid = $term['tid']; $parent_tid = db_result(db_query("SELECT t.parent FROM {term_hierarchy} t WHERE t.tid = %d", $tid)); - $this->assertTrue($parent == $parent_tid, 'The '. $type .' is linked to its container'); + $this->assertTrue($parent == $parent_tid, 'The ' . $type . ' is linked to its container'); return $term; } @@ -249,7 +249,7 @@ class ForumTestCase extends DrupalWebTestCase { // Instead, the post variables seem to pick up the first non-blank value in the select list. // Create forum topic. -// $this->drupalPost('node/add/forum/'. $forum['tid'], $edit, t('Save')); +// $this->drupalPost('node/add/forum/' . $forum['tid'], $edit, t('Save')); $this->drupalPost('node/add/forum/', $edit, t('Save')); $type = t('Forum topic'); if ($container) { @@ -267,7 +267,7 @@ class ForumTestCase extends DrupalWebTestCase { $this->assertTrue($node != null, t('Node @title was loaded', array('@title' => $title))); // View forum topic. - $this->drupalGet('node/'. $node->nid); + $this->drupalGet('node/' . $node->nid); $this->assertRaw($title, t('Subject was found')); $this->assertRaw($body, t('Body was found')); @@ -294,7 +294,7 @@ class ForumTestCase extends DrupalWebTestCase { if ($response2 == 200) { $this->assertTitle(t('Forum | Drupal'), t('Forum help node was displayed')); $this->assertText(t('Forum'), t('Forum help node was displayed')); - $this->assertText(t('Home '. $crumb .' Administer '. $crumb .' Help'), t('Breadcrumbs were displayed')); + $this->assertText(t('Home ' . $crumb . ' Administer ' . $crumb . ' Help'), t('Breadcrumbs were displayed')); } // Verify the forum blocks were displayed. @@ -312,17 +312,17 @@ class ForumTestCase extends DrupalWebTestCase { $this->verifyForumView($this->root_forum); // View forum node. - $this->drupalGet('node/'. $node->nid); + $this->drupalGet('node/' . $node->nid); $this->assertResponse(200); - $this->assertTitle($node->title .' | Drupal', t('Forum node was displayed')); - $this->assertText(t('Home '. $crumb .' Forums '. $crumb .' @container '. $crumb .' @forum', array('@container' => $this->container['name'], '@forum' => $this->forum['name'])), t('Breadcrumbs were displayed')); + $this->assertTitle($node->title . ' | Drupal', t('Forum node was displayed')); + $this->assertText(t('Home ' . $crumb . ' Forums ' . $crumb . ' @container ' . $crumb . ' @forum', array('@container' => $this->container['name'], '@forum' => $this->forum['name'])), t('Breadcrumbs were displayed')); // View forum edit node. - $this->drupalGet('node/'. $node->nid .'/edit'); + $this->drupalGet('node/' . $node->nid . '/edit'); $this->assertResponse($response); if ($response == 200) { - $this->assertTitle($node->title .' | Drupal', t('Forum edit node was displayed')); - $this->assertText(t('Home '. $crumb .' @title', array('@title' => $node->title)), t('Breadcrumbs were displayed')); + $this->assertTitle($node->title . ' | Drupal', t('Forum edit node was displayed')); + $this->assertText(t('Home ' . $crumb . ' @title', array('@title' => $node->title)), t('Breadcrumbs were displayed')); } if ($response == 200) { @@ -332,7 +332,7 @@ class ForumTestCase extends DrupalWebTestCase { $edit['body'] = $this->randomName(256); $edit['taxonomy[1]'] = $this->root_forum['tid']; // Assumes the topic is initially associated with $forum. $edit['shadow'] = TRUE; - $this->drupalPost('node/'. $node->nid .'/edit', $edit, t('Save')); + $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save')); $this->assertRaw(t('Forum topic %title has been updated.', array('%title' => $edit['title'])), t('Forum node was edited')); // Verify topic was moved to a different forum. @@ -340,7 +340,7 @@ class ForumTestCase extends DrupalWebTestCase { $this->assertTrue($forum_tid == $this->root_forum['tid'], 'The forum topic is linked to a different forum'); // Delete forum node. - $this->drupalPost('node/'. $node->nid .'/delete', array(), t('Delete')); + $this->drupalPost('node/' . $node->nid . '/delete', array(), t('Delete')); $this->assertResponse($response); $this->assertRaw(t('Forum topic %title has been deleted.', array('%title' => $edit['title'])), t('Forum node was deleted')); } @@ -355,14 +355,14 @@ class ForumTestCase extends DrupalWebTestCase { $crumb = '›'; // View forum page. - $this->drupalGet('forum/'. $forum['tid']); + $this->drupalGet('forum/' . $forum['tid']); $this->assertResponse(200); - $this->assertTitle($forum['name'] .' | Drupal', t('Forum node was displayed')); + $this->assertTitle($forum['name'] . ' | Drupal', t('Forum node was displayed')); if (isset($parent)) { - $this->assertText(t('Home '. $crumb .' Forums '. $crumb .' @name', array('@name' => $parent['name'])), t('Breadcrumbs were displayed')); + $this->assertText(t('Home ' . $crumb . ' Forums ' . $crumb . ' @name', array('@name' => $parent['name'])), t('Breadcrumbs were displayed')); } else { - $this->assertText(t('Home '. $crumb .' Forums'), t('Breadcrumbs were displayed')); + $this->assertText(t('Home ' . $crumb . ' Forums'), t('Breadcrumbs were displayed')); } } @@ -389,9 +389,9 @@ class ForumTestCase extends DrupalWebTestCase { for ($i = 0; $i < 2; $i++) { foreach ($nids as $nid) { - $this->drupalGet('node/'. $nid); - $this->drupalGet('node/'. $nid); - $this->drupalGet('node/'. $nid); + $this->drupalGet('node/' . $nid); + $this->drupalGet('node/' . $nid); + $this->drupalGet('node/' . $nid); } } } diff --git a/modules/help/help.test b/modules/help/help.test index a5f6b927160..4cc79c46fe0 100644 --- a/modules/help/help.test +++ b/modules/help/help.test @@ -55,16 +55,16 @@ class HelpTestCase extends DrupalWebTestCase { foreach ($this->modules as $module => $name) { // View module help node. - $this->drupalGet('admin/help/'. $module); + $this->drupalGet('admin/help/' . $module); $this->assertResponse($response); if ($response == 200) { // NOTE: The asserts fail on blog and poll because the get returns the 'admin/help' node instead of the indicated node??? // if ($module == 'blog' || $module == 'poll') { // continue; // } - $this->assertTitle($name. ' | Drupal', t('['. $module .'] Title was displayed')); - $this->assertRaw('<h2>'. t($name) .'</h2>', t('['. $module .'] Heading was displayed')); - $this->assertText(t('Home '. $crumb .' Administer '. $crumb .' Help'), t('['. $module .'] Breadcrumbs were displayed')); + $this->assertTitle($name . ' | Drupal', t('[' . $module . '] Title was displayed')); + $this->assertRaw('<h2>' . t($name) . '</h2>', t('[' . $module . '] Heading was displayed')); + $this->assertText(t('Home ' . $crumb . ' Administer ' . $crumb . ' Help'), t('[' . $module . '] Breadcrumbs were displayed')); } } } diff --git a/modules/locale/locale.test b/modules/locale/locale.test index 8dfdbef0e34..8dcb5f5a116 100644 --- a/modules/locale/locale.test +++ b/modules/locale/locale.test @@ -94,7 +94,7 @@ class LocaleTestCase extends DrupalWebTestCase { // Delete the language. $this->drupalLogin($admin_user); - $path = 'admin/settings/language/delete/'. $langcode; + $path = 'admin/settings/language/delete/' . $langcode; // This a confirm form, we do not need any fields changed. $this->drupalPost($path, array(), t('Delete')); // We need raw here because %locale will add HTML. @@ -108,7 +108,7 @@ class LocaleTestCase extends DrupalWebTestCase { // Delete the name string. $this->drupalLogin($translate_user); - $this->drupalGet('admin/build/translate/delete/'. $lid); + $this->drupalGet('admin/build/translate/delete/' . $lid); $this->assertText(t('The string has been removed.'), 'The string has been removed message.'); $this->drupalPost('admin/build/translate/search', $search, t('Search')); $this->assertNoText($name, 'Search now can not find the name'); diff --git a/modules/menu/menu.test b/modules/menu/menu.test index d5310317d56..ac8bdcbef90 100644 --- a/modules/menu/menu.test +++ b/modules/menu/menu.test @@ -111,9 +111,9 @@ class MenuTestCase extends DrupalWebTestCase { $this->assertText($title, 'Menu created'); // Enable the custom menu block. - $menu_name = 'menu-'. $menu_name; // Drupal prepends the name with 'menu-'. + $menu_name = 'menu-' . $menu_name; // Drupal prepends the name with 'menu-'. $edit = array(); - $edit['menu_'. $menu_name .'[region]'] = 'left'; + $edit['menu_' . $menu_name . '[region]'] = 'left'; $this->drupalPost('admin/build/block', $edit, t('Save blocks')); $this->assertResponse(200); $this->assertText(t('The block settings have been updated.'), t('Custom menu block was enabled')); @@ -147,8 +147,8 @@ class MenuTestCase extends DrupalWebTestCase { $node2 = $this->drupalCreateNode(array('type' => 'article', 'uid' => $this->big_user->uid)); // Add menu items. - $item1 = $this->addMenuItem(0, 'node/'. $node1->nid, $menu_name); - $item2 = $this->addMenuItem($item1['mlid'], 'node/'. $node2->nid, $menu_name); + $item1 = $this->addMenuItem(0, 'node/' . $node1->nid, $menu_name); + $item2 = $this->addMenuItem($item1['mlid'], 'node/' . $node2->nid, $menu_name); // Verify menu items. $this->verifyMenuItem($item1, $node1); @@ -180,14 +180,14 @@ class MenuTestCase extends DrupalWebTestCase { $this->drupalGet("admin/build/menu-customize/$menu_name/add"); $this->assertResponse(200); - $title = '!link_'. $this->randomName(16); + $title = '!link_' . $this->randomName(16); $edit = array ( 'menu[link_path]' => $link, 'menu[link_title]' => $title, 'menu[description]' => '', 'menu[enabled]' => TRUE, // Use this to disable the menu and test. 'menu[expanded]' => TRUE, // Setting this to true should test whether it works when we do the std_user tests. - 'menu[parent]' => $menu_name .':'. $plid, + 'menu[parent]' => $menu_name . ':' . $plid, 'menu[weight]' => '0', ); @@ -202,8 +202,8 @@ class MenuTestCase extends DrupalWebTestCase { $item = db_fetch_array(db_query("SELECT * FROM {menu_links} WHERE link_title = '%s'", $title)); // Check the structure in the DB of the two menu items. - // In general, if $n = $item['depth'] then $item['p'. $n] == $item['mlid'] and $item['p'. ($n - 1)] == $item['plid'] (unless depth == 0). - // All $item['p'. $n] for $n > depth must be 0. + // In general, if $n = $item['depth'] then $item['p'. $n] == $item['mlid'] and $item['p' . ($n - 1)] == $item['plid'] (unless depth == 0). + // All $item['p' . $n] for $n > depth must be 0. // We know link1 is at the top level, so $item1['deptj'] == 1 and $item1['plid'] == 0. // We know that the parent of link2 is link1, so $item2['plid'] == $item1['mlid']. // Both menu items were created in the navigation menu. @@ -289,7 +289,7 @@ class MenuTestCase extends DrupalWebTestCase { // $this->assertRaw(t('The menu item %title has been updated.', array('%title' => $title)), t('Menu item was edited')); // Verify menu item. - $this->drupalGet('admin/build/menu-customize/'. $item['menu_name']); + $this->drupalGet('admin/build/menu-customize/' . $item['menu_name']); $this->assertText($title, 'Menu item was edited'); } @@ -412,7 +412,7 @@ class MenuTestCase extends DrupalWebTestCase { // View menu edit node. $item = $this->getStandardMenuItem(); - $this->drupalGet('admin/build/menu/item/'. $item['mlid'] .'/edit'); + $this->drupalGet('admin/build/menu/item/' . $item['mlid'] . '/edit'); $this->assertResponse($response); if ($response == 200) { $this->assertText(t('Edit menu item'), t('Menu edit node was displayed')); diff --git a/modules/php/php.test b/modules/php/php.test index d0293d1f3d6..29d0bad5476 100644 --- a/modules/php/php.test +++ b/modules/php/php.test @@ -50,7 +50,7 @@ class PHPTestCase extends DrupalWebTestCase { // Change filter to PHP filter and see that PHP code is evaluated. $edit = array(); $edit['format'] = 3; - $this->drupalPost('node/'. $node->nid .'/edit', $edit, t('Save')); + $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save')); $this->assertRaw(t('Page %title has been updated.', array('%title' => $node->title)), t('PHP code filter turned on.')); // Make sure that the PHP code shows up as text. @@ -72,7 +72,7 @@ class PHPTestCase extends DrupalWebTestCase { $this->assertText('print', t('PHP code is displayed.')); // Make sure that user doesn't have access to filter. - $this->drupalGet('node/'. $node->nid .'/edit'); + $this->drupalGet('node/' . $node->nid . '/edit'); $this->assertNoFieldByName('format', '3', t('Format not available.')); } @@ -86,7 +86,7 @@ class PHPTestCase extends DrupalWebTestCase { $node = $this->drupalCreateNode(array('uid' => $user->uid)); $edit = array(); $edit['body'] = '<?php print "SimpleTest PHP was executed!"; ?>'; - $this->drupalPost('node/'. $node->nid .'/edit', $edit, t('Save')); + $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save')); $this->assertRaw(t('Page %title has been updated.', array('%title' => $node->title)), t('PHP code inserted into node.')); return $node; } diff --git a/modules/profile/profile.test b/modules/profile/profile.test index 5ffef860084..d594c345c3d 100644 --- a/modules/profile/profile.test +++ b/modules/profile/profile.test @@ -42,7 +42,7 @@ class ProfileTestCase extends DrupalWebTestCase { $this->assertTrue($fid, t('New Profile field has been entered in the database')); // Check that the new field is appearing on the user edit form. - $this->drupalGet('user/' . $this->admin_user->uid . '/edit/' .$category); + $this->drupalGet('user/' . $this->admin_user->uid . '/edit/' . $category); // Checking field. if ($type == 'date') { @@ -202,9 +202,9 @@ class ProfileTestDate extends ProfileTestCase { // Set date to January 09, 1983 $edit = array( - $field['form_name'] .'[month]' => 1, - $field['form_name'] .'[day]' => 9, - $field['form_name'] .'[year]' => 1983, + $field['form_name'] . '[month]' => 1, + $field['form_name'] . '[day]' => 9, + $field['form_name'] . '[year]' => 1983, ); $this->drupalPost('user/' . $this->normal_user->uid . '/edit/' . $field['category'], $edit, t('Save')); diff --git a/modules/search/search.test b/modules/search/search.test index 28a524cca03..e06be293b5f 100644 --- a/modules/search/search.test +++ b/modules/search/search.test @@ -258,7 +258,7 @@ class SearchRankingTestCase extends DrupalWebTestCase { // Add a comment to one of the nodes. $edit = array('subject' => 'my comment title', 'comment' => 'some random comment'); - $this->drupalGet('comment/reply/'. $nodes['comments'][1]->nid); + $this->drupalGet('comment/reply/' . $nodes['comments'][1]->nid); $this->drupalPost(NULL, $edit, t('Preview')); $this->drupalPost(NULL, $edit, t('Save')); @@ -274,12 +274,12 @@ class SearchRankingTestCase extends DrupalWebTestCase { foreach ($node_ranks as $node_rank) { // Disable all relevancy rankings except the one we are testing. foreach ($node_ranks as $var) { - variable_set('node_rank_'. $var, $var == $node_rank ? 10 : 0); + variable_set('node_rank_' . $var, $var == $node_rank ? 10 : 0); } // Do the search and assert the results. $set = node_search('search', 'rocks'); - $this->assertEqual($set[0]['node']->nid, $nodes[$node_rank][1]->nid, 'Search ranking "'. $node_rank .'" order.'); + $this->assertEqual($set[0]['node']->nid, $nodes[$node_rank][1]->nid, 'Search ranking "' . $node_rank . '" order.'); } } } diff --git a/modules/syslog/syslog.test b/modules/syslog/syslog.test index 1fec48c93ac..4b57f064e53 100644 --- a/modules/syslog/syslog.test +++ b/modules/syslog/syslog.test @@ -34,7 +34,7 @@ class SyslogTestCase extends DrupalWebTestCase { $this->drupalGet('admin/settings/logging/syslog'); if ($this->parse()) { - $field = $this->elements->xpath('//option[@value="'. $edit['syslog_facility'] .'"]'); // Should be one field. + $field = $this->elements->xpath('//option[@value="' . $edit['syslog_facility'] . '"]'); // Should be one field. $this->assertTrue($field[0]['selected'] == 'selected', t('Facility value saved.')); } } diff --git a/modules/taxonomy/taxonomy.test b/modules/taxonomy/taxonomy.test index 65314b5e873..82b3fd46e65 100644 --- a/modules/taxonomy/taxonomy.test +++ b/modules/taxonomy/taxonomy.test @@ -358,7 +358,7 @@ class TaxonomyTestNodeApiTestCase extends DrupalWebTestCase { $edit = array('title' => $title, 'body' => $body, "taxonomy[$vid][]" => $parent); - $this->drupalPost('node/'. $node->nid .'/edit', $edit, t('Save')); + $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save')); // TODO Do a MUCH better check here of the information msg. $patternArray['information message'] = 'been updated'; @@ -374,9 +374,9 @@ class TaxonomyTestNodeApiTestCase extends DrupalWebTestCase { } // Delete node through browser. - $this->drupalPost('node/'. $node->nid .'/delete', array(), t('Delete')); + $this->drupalPost('node/' . $node->nid . '/delete', array(), t('Delete')); // Checking after delete. - $this->drupalGet("node/".$node->nid); + $this->drupalGet("node/" . $node->nid); $this->assertNoText($termname, t('Checking if node exists')); // Checking database fields. $num_rows = db_result(db_query('SELECT COUNT(*) FROM {term_node} WHERE nid = %d', $node->nid)); diff --git a/modules/tracker/tracker.test b/modules/tracker/tracker.test index 3e400de769a..85fc6dba5d6 100644 --- a/modules/tracker/tracker.test +++ b/modules/tracker/tracker.test @@ -89,19 +89,19 @@ class TrackerTest extends DrupalWebTestCase { $node = $this->drupalCreateNode($edit); $this->drupalGet('tracker'); - $this->assertPattern('/'. $edit['title'] . '.*new/', t('New nodes are flagged as such in the tracker listing.')); + $this->assertPattern('/' . $edit['title'] . '.*new/', t('New nodes are flagged as such in the tracker listing.')); $this->drupalGet('node/' . $node->nid); $this->drupalGet('tracker'); - $this->assertNoPattern('/'. $edit['title'] . '.*new/', t('Visited nodes are not flagged as new.')); + $this->assertNoPattern('/' . $edit['title'] . '.*new/', t('Visited nodes are not flagged as new.')); $this->drupalLogin($this->other_user); $this->drupalGet('tracker'); - $this->assertPattern('/'. $edit['title'] . '.*new/', t('For another user, new nodes are flagged as such in the tracker listing.')); + $this->assertPattern('/' . $edit['title'] . '.*new/', t('For another user, new nodes are flagged as such in the tracker listing.')); $this->drupalGet('node/' . $node->nid); $this->drupalGet('tracker'); - $this->assertNoPattern('/'. $edit['title'] . '.*new/', t('For another user, visited nodes are not flagged as new.')); + $this->assertNoPattern('/' . $edit['title'] . '.*new/', t('For another user, visited nodes are not flagged as new.')); } /** diff --git a/modules/translation/translation.test b/modules/translation/translation.test index 3dcd5b20a28..1b4b28d25b3 100644 --- a/modules/translation/translation.test +++ b/modules/translation/translation.test @@ -45,29 +45,29 @@ class TranslationTestCase extends DrupalWebTestCase { $this->drupalLogin($translator); // Create page in English. - $node_title = 'Test Translation '. $this->randomName(); + $node_title = 'Test Translation ' . $this->randomName(); $node = $this->createPage($node_title, 'Node body.', 'en'); // Submit translation in Spanish. - $node_trans_title = 'Test Traduccion '. $this->randomName(); + $node_trans_title = 'Test Traduccion ' . $this->randomName(); $node_trans = $this->createTranslation($node->nid, $node_trans_title, 'Nodo cuerpo.', 'es'); // Update origninal and mark translation as outdated. $edit = array(); $edit['body'] = 'Node body. Additional Text.'; $edit['translation[retranslate]'] = TRUE; - $this->drupalPost('node/'. $node->nid .'/edit', $edit, t('Save')); + $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save')); $this->assertRaw(t('Page %title has been updated.', array('%title' => $node_title)), t('Original node updated.')); // Check to make sure that interface shows translation as outdated - $this->drupalGet('node/'. $node->nid .'/translate'); - $this->assertRaw('<span class="marker">'. t('outdated') .'</span>', t('Translation marked as outdated.')); + $this->drupalGet('node/' . $node->nid . '/translate'); + $this->assertRaw('<span class="marker">' . t('outdated') . '</span>', t('Translation marked as outdated.')); // Update translation and mark as updated. $edit = array(); $edit['body'] = 'Nodo cuerpo. Texto adicional.'; $edit['translation[status]'] = FALSE; - $this->drupalPost('node/'. $node_trans->nid .'/edit', $edit, t('Save')); + $this->drupalPost('node/' . $node_trans->nid . '/edit', $edit, t('Save')); $this->assertRaw(t('Page %title has been updated.', array('%title' => $node_trans_title)), t('Translated node updated.')); } @@ -81,7 +81,7 @@ class TranslationTestCase extends DrupalWebTestCase { // Check to make sure that language has not already been installed. $this->drupalGet('admin/settings/language'); - if (strpos($this->drupalGetContent(), 'enabled['. $language_code .']') === FALSE) { + if (strpos($this->drupalGetContent(), 'enabled[' . $language_code . ']') === FALSE) { // Doesn't have language installed so add it. $edit = array(); $edit['langcode'] = $language_code; @@ -96,8 +96,8 @@ class TranslationTestCase extends DrupalWebTestCase { } else { // Ensure that it is enabled. - $this->assertTrue(true, 'Language ['. $language_code .'] already installed.'); - $this->drupalPost(NULL, array('enabled['. $language_code .']' => TRUE), t('Save configuration')); + $this->assertTrue(true, 'Language [' . $language_code . '] already installed.'); + $this->drupalPost(NULL, array('enabled[' . $language_code . ']' => TRUE), t('Save configuration')); $this->assertRaw(t('Configuration saved.'), t('Language successfully enabled.')); } diff --git a/modules/trigger/trigger.test b/modules/trigger/trigger.test index 1a6b687bce0..ed907cdf21a 100644 --- a/modules/trigger/trigger.test +++ b/modules/trigger/trigger.test @@ -61,9 +61,9 @@ class TriggerContentTestCase extends DrupalWebTestCase { $this->assertRaw(t('The action you chose is already assigned to that trigger.'), t('Check to make sure an error occurs when assigning an action to a trigger twice.')); // Test 3: The action should be able to be unassigned from a trigger. - $this->drupalPost('admin/build/trigger/unassign/nodeapi/presave/'. $hash, array(), t('Unassign')); + $this->drupalPost('admin/build/trigger/unassign/nodeapi/presave/' . $hash, array(), t('Unassign')); $this->assertRaw(t('Action %action has been unassigned.', array('%action' => 'Publish post')), t('Check to make sure the @action action can be unassigned from the trigger.', array('@action' => $info['name']))); - $assigned = db_result(db_query("SELECT COUNT(*) FROM {trigger_assignments} WHERE aid IN ('". implode("','", $content_actions) ."')")); + $assigned = db_result(db_query("SELECT COUNT(*) FROM {trigger_assignments} WHERE aid IN ('" . implode("','", $content_actions) . "')")); $this->assertFalse($assigned, t('Check to make sure unassign worked properly at the database level.')); } } diff --git a/modules/upload/upload.test b/modules/upload/upload.test index cc8c18c9b13..285ce37f557 100644 --- a/modules/upload/upload.test +++ b/modules/upload/upload.test @@ -47,8 +47,8 @@ class UploadTestCase extends DrupalWebTestCase { $this->uploadFile($node, $files[1]); // Check to see that uploaded file is listed and actually accessible. - $this->assertText(basename($files[0]), basename($files[0]) .' found on node.'); - $this->assertText(basename($files[1]), basename($files[1]) .' found on node.'); + $this->assertText(basename($files[0]), basename($files[0]) . ' found on node.'); + $this->assertText(basename($files[1]), basename($files[1]) . ' found on node.'); $this->checkUploadedFile(basename($files[0])); $this->checkUploadedFile(basename($files[1])); @@ -58,22 +58,22 @@ class UploadTestCase extends DrupalWebTestCase { if ($upload) { // Rename file. $edit = array(); - $edit['files['. $upload->fid .'][description]'] = $new_name = substr($upload->description, 1); - $this->drupalPost('node/'. $node->nid .'/edit', $edit, t('Save')); + $edit['files[' . $upload->fid . '][description]'] = $new_name = substr($upload->description, 1); + $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save')); $this->assertRaw(t('Page %title has been updated.', array('%title' => $node->title)), 'File renamed successfully.'); - $this->assertText($new_name, $new_name .' found on node.'); - $this->assertNoText($upload->description, $upload->description .' not found on node.'); + $this->assertText($new_name, $new_name . ' found on node.'); + $this->assertNoText($upload->description, $upload->description . ' not found on node.'); // Delete a file. $edit = array(); - $edit['files['. $upload->fid .'][remove]'] = TRUE; - $this->drupalPost('node/'. $node->nid .'/edit', $edit, t('Save')); + $edit['files[' . $upload->fid . '][remove]'] = TRUE; + $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save')); $this->assertRaw(t('Page %title has been updated.', array('%title' => $node->title)), 'File deleted successfully.'); - $this->assertNoText($new_name, $new_name .' not found on node.'); - $this->drupalGet(file_directory_path() .'/'. $upload->description); - $this->assertResponse(array(404), 'Uploaded '. $upload->description .' is not accessible.'); + $this->assertNoText($new_name, $new_name . ' not found on node.'); + $this->drupalGet(file_directory_path() . '/' . $upload->description); + $this->assertResponse(array(404), 'Uploaded ' . $upload->description . ' is not accessible.'); } else { $this->fail('File upload record not found in database.'); @@ -106,7 +106,7 @@ class UploadTestCase extends DrupalWebTestCase { // Attempt to upload .txt file when .test is only extension allowed. $this->uploadFile($node, $files[0], FALSE); - $this->assertRaw(t('The selected file %name could not be uploaded. Only files with the following extensions are allowed: %files-allowed.', array('%name' => basename($files[0]), '%files-allowed' => $settings['upload_extensions'])), 'File '. $files[0] .' was not allowed to be uploaded'); + $this->assertRaw(t('The selected file %name could not be uploaded. Only files with the following extensions are allowed: %files-allowed.', array('%name' => basename($files[0]), '%files-allowed' => $settings['upload_extensions'])), 'File '. $files[0] . ' was not allowed to be uploaded'); // Attempt to upload .test file when .test is only extension allowed. $this->uploadFile($node, $files[1]); @@ -142,16 +142,16 @@ class UploadTestCase extends DrupalWebTestCase { $info = stat($file); $filename = basename($file); $filesize = format_size($info['size']); - $maxsize = format_size(parse_size(($settings['upload_uploadsize'] * 1024) .'KB')); // Won't parse decimals. + $maxsize = format_size(parse_size(($settings['upload_uploadsize'] * 1024) . 'KB')); // Won't parse decimals. $this->assertRaw(t('The selected file %name could not be uploaded. The file is %filesize exceeding the maximum file size of %maxsize.', array('%name' => $filename, '%filesize' => $filesize, '%maxsize' => $maxsize)), t('File upload was blocked since it was larger than maxsize.')); } function setUploadSettings($settings, $rid = NULL) { $edit = array(); foreach ($settings as $key => $value) { - $edit[$key .'_default'] = $value; + $edit[$key . '_default'] = $value; if ($rid !== NULL && $key != 'upload_list' && $key != 'upload_max_resolution') { - $edit[$key .'_'. $rid] = $value; + $edit[$key . '_' . $rid] = $value; } } $this->drupalPost('admin/settings/uploads', $edit, 'Save configuration'); @@ -168,7 +168,7 @@ class UploadTestCase extends DrupalWebTestCase { function uploadFile($node, $filename, $assert = TRUE) { $edit = array(); $edit['files[upload]'] = $filename; //edit-upload - $this->drupalPost('node/'. $node->nid .'/edit', $edit, t('Save')); + $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save')); if ($assert) { $this->assertRaw(t('Page %title has been updated.', array('%title' => $node->title)), 'File attached successfully.'); } @@ -180,10 +180,10 @@ class UploadTestCase extends DrupalWebTestCase { * @param string $filename Name of file to verifiy. */ function checkUploadedFile($filename) { - $file = realpath(file_directory_path() .'/'. $filename); - $this->drupalGet(file_directory_path() .'/'. $filename); - $this->assertResponse(array(200), 'Uploaded '. $filename .' is accessible.'); - $this->assertEqual(file_get_contents($file), $this->drupalGetContent(), 'Uploaded contents of '. $filename .' verified.'); + $file = realpath(file_directory_path() . '/' . $filename); + $this->drupalGet(file_directory_path() . '/' . $filename); + $this->assertResponse(array(200), 'Uploaded ' . $filename . ' is accessible.'); + $this->assertEqual(file_get_contents($file), $this->drupalGetContent(), 'Uploaded contents of ' . $filename . ' verified.'); } /** @@ -219,7 +219,7 @@ class UploadPictureTestCase extends DrupalWebTestCase { $file_dir = file_directory_path(); $picture_dir = variable_get('user_picture_path', 'pictures'); $file_check = file_check_directory($file_dir, FILE_CREATE_DIRECTORY, 'file_directory_path'); - $picture_path = $file_dir .'/'.$picture_dir; + $picture_path = $file_dir . '/' . $picture_dir; $pic_check = file_check_directory($picture_path, FILE_CREATE_DIRECTORY, 'user_picture_path'); // check directories @@ -241,7 +241,7 @@ class UploadPictureTestCase extends DrupalWebTestCase { //$img_path = realpath(drupal_get_path('module', 'simpletest'). "/tests/functional/upload.test"); $img_path = realpath(drupal_get_path('module', 'simpletest'). "/files/html-1.txt"); $edit = array('files[picture_upload]' => $img_path); - $this->drupalPost('user/'.$user->uid.'/edit', $edit, t('Save')); + $this->drupalPost('user/' . $user->uid. '/edit', $edit, t('Save')); $this->assertRaw(t('The selected file %file could not be uploaded. Only JPEG, PNG and GIF images are allowed.', array('%file' => basename($img_path))), 'The uploaded file was not an image.'); variable_set('user_pictures', $old_pic_set); @@ -290,14 +290,14 @@ class UploadPictureTestCase extends DrupalWebTestCase { // Create pictures folder $file_dir = file_directory_path(); $picture_dir = variable_get('user_picture_path', 'pictures'); - $picture_path = $file_dir .'/'.$picture_dir; + $picture_path = $file_dir . '/' . $picture_dir; $pic_check = file_check_directory($picture_path, FILE_CREATE_DIRECTORY, 'user_picture_path'); // TEST: $edit = array('files[picture_upload]' => $img_path); - $this->drupalPost('user/'.$user->uid.'/edit', $edit, t('Save')); + $this->drupalPost('user/' . $user->uid. '/edit', $edit, t('Save')); $picture_dir = variable_get('user_picture_path', 'pictures'); - $picture = $picture_dir .'/picture-'.$user->uid.'.jpg'; + $picture = $picture_dir . '/picture-' . $user->uid. '.jpg'; // get full url to the user's image $picture_url = file_create_url($picture); @@ -354,14 +354,14 @@ class UploadPictureTestCase extends DrupalWebTestCase { // Create pictures folder $file_dir = file_directory_path(); $picture_dir = variable_get('user_picture_path', 'pictures'); - $picture_path = $file_dir .'/'.$picture_dir; + $picture_path = $file_dir . '/' . $picture_dir; $pic_check = file_check_directory($picture_path, FILE_CREATE_DIRECTORY, 'user_picture_path'); // TEST: $edit = array('files[picture_upload]' => $img_path); - $this->drupalPost('user/'.$user->uid.'/edit', $edit, t('Save')); + $this->drupalPost('user/' . $user->uid. '/edit', $edit, t('Save')); $picture_dir = variable_get('user_picture_path', 'pictures'); - $picture = $picture_dir .'/picture-'.$user->uid.'.png'; + $picture = $picture_dir . '/picture-' . $user->uid. '.png'; // get full url to the user's image $picture_url = file_create_url($picture); @@ -413,19 +413,19 @@ class UploadPictureTestCase extends DrupalWebTestCase { // Create pictures folder $file_dir = file_directory_path(); $picture_dir = variable_get('user_picture_path', 'pictures'); - $picture_path = $file_dir .'/'.$picture_dir; + $picture_path = $file_dir . '/' . $picture_dir; $pic_check = file_check_directory($picture_path, FILE_CREATE_DIRECTORY, 'user_picture_path'); // TEST: $edit = array('picture' => $img_path); - $this->drupalPost('user/'.$user->uid.'/edit', $edit, t('Save')); + $this->drupalPost('user/' . $user->uid. '/edit', $edit, t('Save')); $text = t('The uploaded image is too large; the maximum dimensions are %dimensions pixels.', array('%dimensions' => variable_get('user_picture_dimensions', '85x85'))); $this->assertText($text, 'Checking response on invalid image (dimensions).'); // check if file is not uploaded $file_dir = variable_get('file_directory_path', 'files'); $picture_dir = variable_get('user_picture_path', 'pictures'); - $pic_path = $file_dir .'/'.$picture_dir .'/picture-'.$user->uid.'.jpg'; + $pic_path = $file_dir . '/' . $picture_dir . '/picture-' . $user->uid. '.jpg'; $this->assertFalse(is_file($pic_path), "File is not uploaded"); // restore variables; @@ -468,14 +468,14 @@ class UploadPictureTestCase extends DrupalWebTestCase { variable_set('user_picture_file_size', $test_size); $edit = array('picture' => $img_path); - $this->drupalPost('user/'.$user->uid.'/edit', $edit, t('Save')); + $this->drupalPost('user/' . $user->uid. '/edit', $edit, t('Save')); $text = t('The uploaded image is too large; the maximum file size is %size kB.', array('%size' => variable_get('user_picture_file_size', '30'))); $this->assertText($text, 'Checking response on invalid image size.'); // check if file is not uploaded $file_dir = variable_get('file_directory_path', 'files'); $picture_dir = variable_get('user_picture_path', 'pictures'); - $pic_path = $file_dir .'/'.$picture_dir .'/picture-'.$user->uid.'.jpg'; + $pic_path = $file_dir . '/' . $picture_dir . '/picture-' . $user->uid. '.jpg'; $this->assertFalse(is_file($pic_path), "File is not uploaded"); // restore variables; variable_set('user_picture_file_size', $old_size); @@ -517,14 +517,14 @@ class UploadPictureTestCase extends DrupalWebTestCase { // Create pictures folder $file_dir = file_directory_path(); $picture_dir = variable_get('user_picture_path', 'pictures'); - $picture_path = $file_dir .'/'.$picture_dir; + $picture_path = $file_dir . '/' . $picture_dir; $pic_check = file_check_directory($picture_path, FILE_CREATE_DIRECTORY, 'user_picture_path'); // TEST: $edit = array('files[picture_upload]' => $img_path); - $this->drupalPost('user/'.$user->uid.'/edit', $edit, t('Save')); + $this->drupalPost('user/' . $user->uid. '/edit', $edit, t('Save')); $picture_dir = variable_get('user_picture_path', 'pictures'); - $pic_path = file_directory_path() .'/'.$picture_dir .'/picture-'.$user->uid.'.jpg'; + $pic_path = file_directory_path() . '/' . $picture_dir . '/picture-' . $user->uid. '.jpg'; // get full url to the user's image $picture = file_create_url($pic_path); diff --git a/modules/user/upload.test b/modules/user/upload.test index 6cb54ffadb0..750a56086ec 100644 --- a/modules/user/upload.test +++ b/modules/user/upload.test @@ -47,8 +47,8 @@ class UploadTestCase extends DrupalWebTestCase { $this->uploadFile($node, $files[1]); // Check to see that uploaded file is listed and actually accessible. - $this->assertText(basename($files[0]), basename($files[0]) .' found on node.'); - $this->assertText(basename($files[1]), basename($files[1]) .' found on node.'); + $this->assertText(basename($files[0]), basename($files[0]) . ' found on node.'); + $this->assertText(basename($files[1]), basename($files[1]) . ' found on node.'); $this->checkUploadedFile(basename($files[0])); $this->checkUploadedFile(basename($files[1])); @@ -58,22 +58,22 @@ class UploadTestCase extends DrupalWebTestCase { if ($upload) { // Rename file. $edit = array(); - $edit['files['. $upload->fid .'][description]'] = $new_name = substr($upload->description, 1); - $this->drupalPost('node/'. $node->nid .'/edit', $edit, t('Save')); + $edit['files[' . $upload->fid . '][description]'] = $new_name = substr($upload->description, 1); + $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save')); $this->assertRaw(t('Page %title has been updated.', array('%title' => $node->title)), 'File renamed successfully.'); - $this->assertText($new_name, $new_name .' found on node.'); - $this->assertNoText($upload->description, $upload->description .' not found on node.'); + $this->assertText($new_name, $new_name . ' found on node.'); + $this->assertNoText($upload->description, $upload->description . ' not found on node.'); // Delete a file. $edit = array(); - $edit['files['. $upload->fid .'][remove]'] = TRUE; - $this->drupalPost('node/'. $node->nid .'/edit', $edit, t('Save')); + $edit['files[' . $upload->fid . '][remove]'] = TRUE; + $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save')); $this->assertRaw(t('Page %title has been updated.', array('%title' => $node->title)), 'File deleted successfully.'); - $this->assertNoText($new_name, $new_name .' not found on node.'); - $this->drupalGet(file_directory_path() .'/'. $upload->description); - $this->assertResponse(array(404), 'Uploaded '. $upload->description .' is not accessible.'); + $this->assertNoText($new_name, $new_name . ' not found on node.'); + $this->drupalGet(file_directory_path() . '/' . $upload->description); + $this->assertResponse(array(404), 'Uploaded ' . $upload->description . ' is not accessible.'); } else { $this->fail('File upload record not found in database.'); @@ -106,7 +106,7 @@ class UploadTestCase extends DrupalWebTestCase { // Attempt to upload .txt file when .test is only extension allowed. $this->uploadFile($node, $files[0], FALSE); - $this->assertRaw(t('The selected file %name could not be uploaded. Only files with the following extensions are allowed: %files-allowed.', array('%name' => basename($files[0]), '%files-allowed' => $settings['upload_extensions'])), 'File '. $files[0] .' was not allowed to be uploaded'); + $this->assertRaw(t('The selected file %name could not be uploaded. Only files with the following extensions are allowed: %files-allowed.', array('%name' => basename($files[0]), '%files-allowed' => $settings['upload_extensions'])), 'File '. $files[0] . ' was not allowed to be uploaded'); // Attempt to upload .test file when .test is only extension allowed. $this->uploadFile($node, $files[1]); @@ -142,16 +142,16 @@ class UploadTestCase extends DrupalWebTestCase { $info = stat($file); $filename = basename($file); $filesize = format_size($info['size']); - $maxsize = format_size(parse_size(($settings['upload_uploadsize'] * 1024) .'KB')); // Won't parse decimals. + $maxsize = format_size(parse_size(($settings['upload_uploadsize'] * 1024) . 'KB')); // Won't parse decimals. $this->assertRaw(t('The selected file %name could not be uploaded. The file is %filesize exceeding the maximum file size of %maxsize.', array('%name' => $filename, '%filesize' => $filesize, '%maxsize' => $maxsize)), t('File upload was blocked since it was larger than maxsize.')); } function setUploadSettings($settings, $rid = NULL) { $edit = array(); foreach ($settings as $key => $value) { - $edit[$key .'_default'] = $value; + $edit[$key . '_default'] = $value; if ($rid !== NULL && $key != 'upload_list' && $key != 'upload_max_resolution') { - $edit[$key .'_'. $rid] = $value; + $edit[$key . '_' . $rid] = $value; } } $this->drupalPost('admin/settings/uploads', $edit, 'Save configuration'); @@ -168,7 +168,7 @@ class UploadTestCase extends DrupalWebTestCase { function uploadFile($node, $filename, $assert = TRUE) { $edit = array(); $edit['files[upload]'] = $filename; //edit-upload - $this->drupalPost('node/'. $node->nid .'/edit', $edit, t('Save')); + $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save')); if ($assert) { $this->assertRaw(t('Page %title has been updated.', array('%title' => $node->title)), 'File attached successfully.'); } @@ -180,10 +180,10 @@ class UploadTestCase extends DrupalWebTestCase { * @param string $filename Name of file to verifiy. */ function checkUploadedFile($filename) { - $file = realpath(file_directory_path() .'/simpletest/'. $filename); - $this->drupalGet(file_directory_path() .'/'. $filename); - $this->assertResponse(array(200), 'Uploaded '. $filename .' is accessible.'); - $this->assertEqual(file_get_contents($file), $this->drupalGetContent(), 'Uploaded contents of '. $filename .' verified.'); + $file = realpath(file_directory_path() . '/simpletest/' . $filename); + $this->drupalGet(file_directory_path() . '/' . $filename); + $this->assertResponse(array(200), 'Uploaded ' . $filename . ' is accessible.'); + $this->assertEqual(file_get_contents($file), $this->drupalGetContent(), 'Uploaded contents of ' . $filename . ' verified.'); } /** @@ -219,7 +219,7 @@ class UploadPictureTestCase extends DrupalWebTestCase { $file_dir = file_directory_path(); $picture_dir = variable_get('user_picture_path', 'pictures'); $file_check = file_check_directory($file_dir, FILE_CREATE_DIRECTORY, 'file_directory_path'); - $picture_path = $file_dir .'/'.$picture_dir; + $picture_path = $file_dir . '/' . $picture_dir; $pic_check = file_check_directory($picture_path, FILE_CREATE_DIRECTORY, 'user_picture_path'); // check directories @@ -240,7 +240,7 @@ class UploadPictureTestCase extends DrupalWebTestCase { // not a image $img_path = realpath(drupal_get_path('module', 'simpletest'). "/tests/functional/upload.test"); $edit = array('files[picture_upload]' => $img_path); - $this->drupalPost('user/'.$user->uid.'/edit', $edit, t('Save')); + $this->drupalPost('user/' . $user->uid. '/edit', $edit, t('Save')); $this->assertRaw(t('The selected file %file could not be uploaded. Only JPEG, PNG and GIF images are allowed.', array('%file' => 'upload.test')), 'The uploaded file was not an image.'); variable_set('user_pictures', $old_pic_set); @@ -286,9 +286,9 @@ class UploadPictureTestCase extends DrupalWebTestCase { // TEST: $edit = array('files[picture_upload]' => $img_path); - $this->drupalPost('user/'.$user->uid.'/edit', $edit, t('Save')); + $this->drupalPost('user/' . $user->uid. '/edit', $edit, t('Save')); $picture_dir = variable_get('user_picture_path', 'pictures'); - $picture = $picture_dir .'/picture-'.$user->uid.'.jpg'; + $picture = $picture_dir . '/picture-' . $user->uid. '.jpg'; // get full url to the user's image $picture_url = file_create_url($picture); @@ -344,9 +344,9 @@ class UploadPictureTestCase extends DrupalWebTestCase { // TEST: $edit = array('files[picture_upload]' => $img_path); - $this->drupalPost('user/'.$user->uid.'/edit', $edit, t('Save')); + $this->drupalPost('user/' . $user->uid. '/edit', $edit, t('Save')); $picture_dir = variable_get('user_picture_path', 'pictures'); - $picture = $picture_dir .'/picture-'.$user->uid.'.jpg'; + $picture = $picture_dir . '/picture-' . $user->uid. '.jpg'; // get full url to the user's image $picture_url = file_create_url($picture); @@ -397,14 +397,14 @@ class UploadPictureTestCase extends DrupalWebTestCase { // TEST: $edit = array('picture' => $img_path); - $this->drupalPost('user/'.$user->uid.'/edit', $edit, t('Save')); + $this->drupalPost('user/' . $user->uid. '/edit', $edit, t('Save')); $text = t('The uploaded image is too large; the maximum dimensions are %dimensions pixels.', array('%dimensions' => variable_get('user_picture_dimensions', '85x85'))); $this->assertText($text, 'Checking response on invalid image (dimensions).'); // check if file is not uploaded $file_dir = variable_get('file_directory_path', 'files'); $picture_dir = variable_get('user_picture_path', 'pictures'); - $pic_path = $file_dir .'/'.$picture_dir .'/picture-'.$user->uid.'.jpg'; + $pic_path = $file_dir . '/' . $picture_dir . '/picture-' . $user->uid. '.jpg'; $this->assertFalse(is_file($pic_path), "File is not uploaded"); // restore variables; @@ -446,14 +446,14 @@ class UploadPictureTestCase extends DrupalWebTestCase { variable_set('user_picture_file_size', $test_size); $edit = array('picture' => $img_path); - $this->drupalPost('user/'.$user->uid.'/edit', $edit, t('Save')); + $this->drupalPost('user/' . $user->uid. '/edit', $edit, t('Save')); $text = t('The uploaded image is too large; the maximum file size is %size kB.', array('%size' => variable_get('user_picture_file_size', '30'))); $this->assertText($text, 'Checking response on invalid image size.'); // check if file is not uploaded $file_dir = variable_get('file_directory_path', 'files'); $picture_dir = variable_get('user_picture_path', 'pictures'); - $pic_path = $file_dir .'/'.$picture_dir .'/picture-'.$user->uid.'.jpg'; + $pic_path = $file_dir . '/' . $picture_dir . '/picture-' . $user->uid. '.jpg'; $this->assertFalse(is_file($pic_path), "File is not uploaded"); // restore variables; variable_set('user_picture_file_size', $old_size); @@ -494,9 +494,9 @@ class UploadPictureTestCase extends DrupalWebTestCase { // TEST: $edit = array('files[picture_upload]' => $img_path); - $this->drupalPost('user/'.$user->uid.'/edit', $edit, t('Save')); + $this->drupalPost('user/' . $user->uid. '/edit', $edit, t('Save')); $picture_dir = variable_get('user_picture_path', 'pictures'); - $pic_path = file_directory_path() .'/'.$picture_dir .'/picture-'.$user->uid.'.jpg'; + $pic_path = file_directory_path() . '/' . $picture_dir . '/picture-' . $user->uid. '.jpg'; // get full url to the user's image $picture = file_create_url($pic_path); diff --git a/modules/user/user.test b/modules/user/user.test index 0e38def11cd..882f27859a4 100644 --- a/modules/user/user.test +++ b/modules/user/user.test @@ -29,7 +29,7 @@ class UserRegistrationTestCase extends DrupalWebTestCase { $edit = array(); $edit['name'] = $name = $this->randomName(); - $edit['mail'] = $mail = $edit['name'] .'@example.com'; + $edit['mail'] = $mail = $edit['name'] . '@example.com'; $this->drupalPost('user/register', $edit, t('Create new account')); $this->assertText(t('Your password and further instructions have been sent to your e-mail address.'), t('User registered successfully.')); @@ -185,7 +185,7 @@ class UserDeleteTestCase extends DrupalWebTestCase { $edit = array(); $edit['name'] = $this->randomName(); - $edit['mail'] = $edit['name'] .'@example.com'; + $edit['mail'] = $edit['name'] . '@example.com'; $this->drupalPost('user/register', $edit, t('Create new account')); $this->assertText(t('Your password and further instructions have been sent to your e-mail address.'), t('User registered successfully.')); @@ -196,7 +196,7 @@ class UserDeleteTestCase extends DrupalWebTestCase { $this->drupalLogin($admin_user); // Delete user. - $this->drupalGet('user/'. $user->uid .'/edit'); + $this->drupalGet('user/' . $user->uid . '/edit'); $this->drupalPost(NULL, NULL, t('Delete')); $this->assertRaw(t('Are you sure you want to delete the account %name?', array('%name' => $user->name)), t('[confirm deletion] Asks for confirmation.')); $this->assertText(t('All submissions made by this user will be attributed to the anonymous account. This action cannot be undone.'), t('[confirm deletion] Inform that all submissions will be attributed to anonymouse account.')); |