diff --git a/core/modules/node/lib/Drupal/node/Tests/MultiStepNodeFormBasicOptionsTest.php b/core/modules/node/lib/Drupal/node/Tests/MultiStepNodeFormBasicOptionsTest.php index abb31f3..14b0b1a 100644 --- a/core/modules/node/lib/Drupal/node/Tests/MultiStepNodeFormBasicOptionsTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/MultiStepNodeFormBasicOptionsTest.php @@ -29,7 +29,7 @@ class MultiStepNodeFormBasicOptionsTest extends WebTestBase { ); } - function setUp() { + public function setUp() { parent::setUp(); $web_user = $this->drupalCreateUser(array('administer nodes', 'create poll content')); @@ -39,7 +39,7 @@ class MultiStepNodeFormBasicOptionsTest extends WebTestBase { /** * Change the default values of basic options to ensure they persist. */ - function testMultiStepNodeFormBasicOptions() { + public function testMultiStepNodeFormBasicOptions() { $edit = array( 'title' => 'a', 'status' => FALSE, diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeAccessBaseTableTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeAccessBaseTableTest.php index e5253a8..614832f 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeAccessBaseTableTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeAccessBaseTableTest.php @@ -54,14 +54,16 @@ class NodeAccessBaseTableTest extends NodeTestBase { * - Test that user 4 can view all content created above. * - Test that user 4 can view all content on taxonomy listing. */ - function testNodeAccessBasic() { + public function testNodeAccessBasic() { $num_simple_users = 2; $simple_users = array(); - // nodes keyed by uid and nid: $nodes[$uid][$nid] = $is_private; + // Nodes keyed by uid and nid: $nodes[$uid][$nid] = $is_private; $this->nodesByUser = array(); - $titles = array(); // Titles keyed by nid - $private_nodes = array(); // Array of nids marked private. + // Titles keyed by nid. + $titles = array(); + // Array of nids marked private. + $private_nodes = array(); for ($i = 0; $i < $num_simple_users; $i++) { $simple_users[$i] = $this->drupalCreateUser(array('access content', 'create article content')); } @@ -123,7 +125,12 @@ class NodeAccessBaseTableTest extends NodeTestBase { } // Now test that a user with 'access any private content' can view content. - $access_user = $this->drupalCreateUser(array('access content', 'create article content', 'node test view', 'search content')); + $access_user = $this->drupalCreateUser(array( + 'access content', + 'create article content', + 'node test view', + 'search content', + )); $this->drupalLogin($access_user); foreach ($this->nodesByUser as $uid => $private_status) { @@ -141,7 +148,7 @@ class NodeAccessBaseTableTest extends NodeTestBase { /** * Checks taxonomy/term listings to ensure only accessible nodes are listed. * - * @param $is_admin + * @param boolean $is_admin * A boolean indicating whether the current user is an administrator. If * TRUE, all nodes should be listed. If FALSE, only public nodes and the * user's own private nodes should be listed. diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeAccessFieldTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeAccessFieldTest.php index 3d11e26..12d5ea7 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeAccessFieldTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeAccessFieldTest.php @@ -49,7 +49,7 @@ class NodeAccessFieldTest extends NodeTestBase { /** * Tests administering fields when node access is restricted. */ - function testNodeAccessAdministerField() { + public function testNodeAccessAdministerField() { // Create a page node. $langcode = LANGUAGE_NOT_SPECIFIED; $field_data = array(); diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageTest.php index 8a6ce99..6e64ca7 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageTest.php @@ -30,9 +30,15 @@ class NodeAccessLanguageTest extends NodeTestBase { /** * Asserts node_access correctly grants or denies access. */ - function assertNodeAccess($ops, $node, $account, $langcode = NULL) { + public function assertNodeAccess($ops, $node, $account, $langcode = NULL) { foreach ($ops as $op => $result) { - $msg = t("node_access returns @result with operation '@op', language code @langcode.", array('@result' => $result ? 'true' : 'false', '@op' => $op, '@langcode' => !empty($langcode) ? "'$langcode'" : 'empty')); + $msg = t("node_access returns @result with operation '@op', language code @langcode.", + array( + '@result' => $result ? 'true' : 'false', + '@op' => $op, + '@langcode' => !empty($langcode) ? "'$langcode'" : 'empty' + ) + ); $this->assertEqual($result, node_access($op, $node, $account, $langcode), $msg); } } diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeAccessPagerTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeAccessPagerTest.php index 640f9e0..1b6e1d5 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeAccessPagerTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeAccessPagerTest.php @@ -33,7 +33,11 @@ class NodeAccessPagerTest extends WebTestBase { parent::setUp(); node_access_rebuild(); - $this->web_user = $this->drupalCreateUser(array('access content', 'access comments', 'node test view')); + $this->web_user = $this->drupalCreateUser(array( + 'access content', + 'access comments', + 'node test view', + )); } /** @@ -88,7 +92,11 @@ class NodeAccessPagerTest extends WebTestBase { 'type' => 'forum', 'taxonomy_forums' => array( LANGUAGE_NOT_SPECIFIED => array( - array('tid' => $tid, 'vid' => $vid, 'vocabulary_machine_name' => 'forums'), + array( + 'tid' => $tid, + 'vid' => $vid, + 'vocabulary_machine_name' => 'forums', + ), ), ), )); diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeAccessRebuildTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeAccessRebuildTest.php index 612ba36..b1b90db 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeAccessRebuildTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeAccessRebuildTest.php @@ -19,15 +19,22 @@ class NodeAccessRebuildTest extends NodeTestBase { ); } - function setUp() { + public function setUp() { parent::setUp(); - $web_user = $this->drupalCreateUser(array('administer site configuration', 'access administration pages', 'access site reports')); + $web_user = $this->drupalCreateUser(array( + 'administer site configuration', + 'access administration pages', + 'access site reports', + )); $this->drupalLogin($web_user); $this->web_user = $web_user; } - function testNodeAccessRebuild() { + /** + * Test the "rebuild permissions" link. + */ + public function testNodeAccessRebuild() { $this->drupalGet('admin/reports/status'); $this->clickLink(t('Rebuild permissions')); $this->drupalPost(NULL, array(), t('Rebuild permissions')); diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeAccessRecordsTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeAccessRecordsTest.php index 4c5598a..e28db3c 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeAccessRecordsTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeAccessRecordsTest.php @@ -30,7 +30,7 @@ class NodeAccessRecordsTest extends NodeTestBase { /** * Create a node and test the creation of node access rules. */ - function testNodeAccessRecords() { + public function testNodeAccessRecords() { // Create an article node. $node1 = $this->drupalCreateNode(array('type' => 'article')); $this->assertTrue(node_load($node1->nid), t('Article node created.')); @@ -52,7 +52,11 @@ class NodeAccessRecordsTest extends NodeTestBase { $this->assertEqual($records[0]->gid, 1, t('Grant with gid = 1 acquired for node without alteration.')); // Create an unpromoted, unpublished "Basic page" node. - $node3 = $this->drupalCreateNode(array('type' => 'page', 'promote' => 0, 'status' => 0)); + $node3 = $this->drupalCreateNode(array( + 'type' => 'page', + 'promote' => 0, + 'status' => 0, + )); $this->assertTrue(node_load($node3->nid), t('Unpromoted, unpublished basic page node created.')); // Check to see if grants added by node_test_node_access_records made it in. diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeAccessTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeAccessTest.php index 0c784ae..eeb9ee6 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeAccessTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeAccessTest.php @@ -24,14 +24,14 @@ class NodeAccessTest extends NodeTestBase { /** * Asserts node_access correctly grants or denies access. */ - function assertNodeAccess($ops, $node, $account) { + public function assertNodeAccess($ops, $node, $account) { foreach ($ops as $op => $result) { $msg = t("node_access returns @result with operation '@op'.", array('@result' => $result ? 'true' : 'false', '@op' => $op)); $this->assertEqual($result, node_access($op, $node, $account), $msg); } } - function setUp() { + public function setUp() { parent::setUp(); // Clear permissions for authenticated users. db_delete('role_permission') @@ -42,18 +42,30 @@ class NodeAccessTest extends NodeTestBase { /** * Runs basic tests for node_access function. */ - function testNodeAccess() { + public function testNodeAccess() { // Ensures user without 'access content' permission can do nothing. - $web_user1 = $this->drupalCreateUser(array('create page content', 'edit any page content', 'delete any page content')); + $web_user1 = $this->drupalCreateUser(array( + 'create page content', + 'edit any page content', + 'delete any page content', + )); $node1 = $this->drupalCreateNode(array('type' => 'page')); $this->assertNodeAccess(array('create' => FALSE), 'page', $web_user1); - $this->assertNodeAccess(array('view' => FALSE, 'update' => FALSE, 'delete' => FALSE), $node1, $web_user1); + $this->assertNodeAccess(array( + 'view' => FALSE, + 'update' => FALSE, + 'delete' => FALSE, + ), $node1, $web_user1); // Ensures user with 'bypass node access' permission can do everything. $web_user2 = $this->drupalCreateUser(array('bypass node access')); $node2 = $this->drupalCreateNode(array('type' => 'page')); $this->assertNodeAccess(array('create' => TRUE), 'page', $web_user2); - $this->assertNodeAccess(array('view' => TRUE, 'update' => TRUE, 'delete' => TRUE), $node2, $web_user2); + $this->assertNodeAccess(array( + 'view' => TRUE, + 'update' => TRUE, + 'delete' => TRUE, + ), $node2, $web_user2); // User cannot 'view own unpublished content'. $web_user3 = $this->drupalCreateUser(array('access content')); @@ -72,6 +84,10 @@ class NodeAccessTest extends NodeTestBase { // Tests the default access provided for a published node. $node5 = $this->drupalCreateNode(); - $this->assertNodeAccess(array('view' => TRUE, 'update' => FALSE, 'delete' => FALSE), $node5, $web_user3); + $this->assertNodeAccess(array( + 'view' => TRUE, + 'update' => FALSE, + 'delete' => FALSE, + ), $node5, $web_user3); } } diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeAdminTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeAdminTest.php index d89100d..e66a50e 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeAdminTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeAdminTest.php @@ -19,7 +19,7 @@ class NodeAdminTest extends NodeTestBase { ); } - function setUp() { + public function setUp() { parent::setUp(); // Remove the "view own unpublished content" permission which is set @@ -27,7 +27,12 @@ class NodeAdminTest extends NodeTestBase { // correctly. user_role_revoke_permissions(DRUPAL_AUTHENTICATED_RID, array('view own unpublished content')); - $this->admin_user = $this->drupalCreateUser(array('access administration pages', 'access content overview', 'administer nodes', 'bypass node access')); + $this->admin_user = $this->drupalCreateUser(array( + 'access administration pages', + 'access content overview', + 'administer nodes', + 'bypass node access', + )); $this->base_user_1 = $this->drupalCreateUser(array('access content overview')); $this->base_user_2 = $this->drupalCreateUser(array('access content overview', 'view own unpublished content')); $this->base_user_3 = $this->drupalCreateUser(array('access content overview', 'bypass node access')); @@ -36,7 +41,7 @@ class NodeAdminTest extends NodeTestBase { /** * Tests that the table sorting works on the content admin pages. */ - function testContentAdminSort() { + public function testContentAdminSort() { $this->drupalLogin($this->admin_user); foreach (array('dd', 'aa', 'DD', 'bb', 'cc', 'CC', 'AA', 'BB') as $prefix) { $this->drupalCreateNode(array('title' => $prefix . $this->randomName(6))); @@ -78,13 +83,21 @@ class NodeAdminTest extends NodeTestBase { * Taxonomy filters are tested separately. * @see TaxonomyNodeFilterTestCase */ - function testContentAdminPages() { + public function testContentAdminPages() { $this->drupalLogin($this->admin_user); $nodes['published_page'] = $this->drupalCreateNode(array('type' => 'page')); $nodes['published_article'] = $this->drupalCreateNode(array('type' => 'article')); - $nodes['unpublished_page_1'] = $this->drupalCreateNode(array('type' => 'page', 'uid' => $this->base_user_1->uid, 'status' => 0)); - $nodes['unpublished_page_2'] = $this->drupalCreateNode(array('type' => 'page', 'uid' => $this->base_user_2->uid, 'status' => 0)); + $nodes['unpublished_page_1'] = $this->drupalCreateNode(array( + 'type' => 'page', + 'uid' => $this->base_user_1->uid, + 'status' => 0, + )); + $nodes['unpublished_page_2'] = $this->drupalCreateNode(array( + 'type' => 'page', + 'uid' => $this->base_user_2->uid, + 'status' => 0, + )); // Verify view, edit, and delete links for any content. $this->drupalGet('admin/content'); diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeBlockFunctionalTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeBlockFunctionalTest.php index 0c86de2..1ab8015 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeBlockFunctionalTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeBlockFunctionalTest.php @@ -27,18 +27,22 @@ class NodeBlockFunctionalTest extends NodeTestBase { ); } - function setUp() { + public function setUp() { parent::setUp(); // Create users and test node. - $this->admin_user = $this->drupalCreateUser(array('administer content types', 'administer nodes', 'administer blocks')); + $this->admin_user = $this->drupalCreateUser(array( + 'administer content types', + 'administer nodes', + 'administer blocks', + )); $this->web_user = $this->drupalCreateUser(array('access content', 'create article content')); } /** * Test the recent comments block. */ - function testRecentNodeBlock() { + public function testRecentNodeBlock() { $this->drupalLogin($this->admin_user); // Disallow anonymous users to view content. @@ -61,7 +65,7 @@ class NodeBlockFunctionalTest extends NodeTestBase { $this->drupalPost('admin/structure/block/manage/node/recent/configure', $block, t('Save block')); $this->assertText(t('The block configuration has been saved.'), t('Block saved.')); - // Test that block is not visible without nodes + // Test that block is not visible without nodes. $this->drupalGet(''); $this->assertText(t('No content available.'), t('Block with "No content available." found.')); diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeBlockTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeBlockTest.php index 9aca3cf..e43ec03 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeBlockTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeBlockTest.php @@ -24,15 +24,20 @@ class NodeBlockTest extends NodeTestBase { ); } - function setUp() { + public function setUp() { parent::setUp(); - // Create and login user + // Create and login user. $admin_user = $this->drupalCreateUser(array('administer blocks')); $this->drupalLogin($admin_user); } - function testSearchFormBlock() { + /** + * Test the search form. + * + * Sees if the search form is available, and one can set is to a region. + */ + public function testSearchFormBlock() { // Set block title to confirm that the interface is available. $this->drupalPost('admin/structure/block/manage/node/syndicate/configure', array('title' => $this->randomName(8)), t('Save block')); $this->assertText(t('The block configuration has been saved.'), t('Block configuration set.')); diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeBuildContentTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeBuildContentTest.php index 2b0dbeb..4ec9594 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeBuildContentTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeBuildContentTest.php @@ -20,13 +20,17 @@ class NodeBuildContentTest extends NodeTestBase { ); } - /** - * Test to ensure that a node's content array is rebuilt on every call to node_build_content(). - */ - function testNodeRebuildContent() { + /** + * Test if nodes get rebuilt. + * + * Test to ensure that a node's content array is rebuilt on every + * call to node_build_content(). + */ + public function testNodeRebuildContent() { $node = $this->drupalCreateNode(); - // Set a property in the content array so we can test for its existence later on. + // Set a property in the content array so we can test for its existence + // later on. $node->content['test_content_property'] = array('#value' => $this->randomString()); $content = node_build_content($node); diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeCreationTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeCreationTest.php index a8fbb07..4fb8f93 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeCreationTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeCreationTest.php @@ -29,7 +29,7 @@ class NodeCreationTest extends NodeTestBase { ); } - function setUp() { + public function setUp() { parent::setUp(); $web_user = $this->drupalCreateUser(array('create page content', 'edit own page content')); @@ -39,7 +39,7 @@ class NodeCreationTest extends NodeTestBase { /** * Create a "Basic page" node and verify its consistency in the database. */ - function testNodeCreation() { + public function testNodeCreation() { // Create a node. $edit = array(); $langcode = LANGUAGE_NOT_SPECIFIED; @@ -56,9 +56,12 @@ class NodeCreationTest extends NodeTestBase { } /** - * Create a page node and verify that a transaction rolls back the failed creation + * Test a failing page creation. + * + * Create a page node and verify that a transaction rolls back the failed + * creation. */ - function testFailedPageCreation() { + public function testFailedPageCreation() { // Create a node. $edit = array( 'uid' => $this->loggedInUser->uid, diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeEntityFieldQueryAlterTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeEntityFieldQueryAlterTest.php index 2333dd9..4a265da 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeEntityFieldQueryAlterTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeEntityFieldQueryAlterTest.php @@ -37,7 +37,7 @@ class NodeEntityFieldQueryAlterTest extends NodeTestBase { */ protected $noAccessUser; - function setUp() { + public function setUp() { parent::setUp(); node_access_rebuild(); @@ -63,7 +63,7 @@ class NodeEntityFieldQueryAlterTest extends NodeTestBase { /** * Tests that node access permissions are followed. */ - function testNodeQueryAlterWithUI() { + public function testNodeQueryAlterWithUI() { // Verify that a user with access permission can see at least one node. $this->drupalLogin($this->accessUser); $this->drupalGet('node_access_entity_test_page'); diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeFeedTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeFeedTest.php index ca660e4..2ab1182 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeFeedTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeFeedTest.php @@ -18,13 +18,13 @@ class NodeFeedTest extends WebTestBase { 'name' => 'Node feed', 'description' => 'Ensures that node_feed() functions correctly.', 'group' => 'Node', - ); + ); } /** * Ensure that node_feed accepts and prints extra channel elements. */ - function testNodeFeedExtraChannelElements() { + public function testNodeFeedExtraChannelElements() { $response = node_feed(array(), array('copyright' => 'Drupal is a registered trademark of Dries Buytaert.')); $this->assertTrue(strpos($response->getContent(), 'Drupal is a registered trademark of Dries Buytaert.') !== FALSE); } diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeFieldMultilingualTestCase.php b/core/modules/node/lib/Drupal/node/Tests/NodeFieldMultilingualTestCase.php index f51342b..a884608 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeFieldMultilingualTestCase.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeFieldMultilingualTestCase.php @@ -29,14 +29,20 @@ class NodeFieldMultilingualTestCase extends WebTestBase { ); } - function setUp() { + public function setUp() { parent::setUp(); // Create Basic page node type. $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page')); // Setup users. - $admin_user = $this->drupalCreateUser(array('administer languages', 'administer content types', 'access administration pages', 'create page content', 'edit own page content')); + $admin_user = $this->drupalCreateUser(array( + 'administer languages', + 'administer content types', + 'access administration pages', + 'create page content', + 'edit own page content', + )); $this->drupalLogin($admin_user); // Add a new language. @@ -66,7 +72,7 @@ class NodeFieldMultilingualTestCase extends WebTestBase { /** * Test if field languages are correctly set through the node form. */ - function testMultilingualNodeForm() { + public function testMultilingualNodeForm() { // Create "Basic page" content. $langcode = node_type_get_default_langcode('page'); $title_key = "title"; @@ -91,7 +97,7 @@ class NodeFieldMultilingualTestCase extends WebTestBase { $this->drupalGet("node/$node->nid/edit"); $edit = array( $title_key => $this->randomName(8), - 'langcode' => 'it' + 'langcode' => 'it', ); $this->drupalPost(NULL, $edit, t('Save')); $node = $this->drupalGetNodeByTitle($edit[$title_key]); @@ -111,10 +117,10 @@ class NodeFieldMultilingualTestCase extends WebTestBase { $this->assertRaw($body_value, t('Body correctly displayed using English as requested language')); } - /* + /** * Test multilingual field display settings. */ - function testMultilingualDisplaySettings() { + public function testMultilingualDisplaySettings() { // Create "Basic page" content. $langcode = node_type_get_default_langcode('page'); $title_key = "title"; diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeLoadHooksTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeLoadHooksTest.php index 36b99da..ec94447 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeLoadHooksTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeLoadHooksTest.php @@ -30,7 +30,7 @@ class NodeLoadHooksTest extends NodeTestBase { /** * Tests that hook_node_load() is invoked correctly. */ - function testHookNodeLoad() { + public function testHookNodeLoad() { // Create some sample articles and pages. $node1 = $this->drupalCreateNode(array('type' => 'article', 'status' => NODE_PUBLISHED)); $node2 = $this->drupalCreateNode(array('type' => 'article', 'status' => NODE_PUBLISHED)); diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeLoadMultipleTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeLoadMultipleTest.php index dd7f9da..e10eb0c 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeLoadMultipleTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeLoadMultipleTest.php @@ -20,7 +20,7 @@ class NodeLoadMultipleTest extends NodeTestBase { ); } - function setUp() { + public function setUp() { parent::setUp(); $web_user = $this->drupalCreateUser(array('create article content', 'create page content')); $this->drupalLogin($web_user); @@ -29,7 +29,7 @@ class NodeLoadMultipleTest extends NodeTestBase { /** * Creates four nodes and ensures that they are loaded correctly. */ - function testNodeMultipleLoad() { + public function testNodeMultipleLoad() { $node1 = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1)); $node2 = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1)); $node3 = $this->drupalCreateNode(array('type' => 'article', 'promote' => 0)); diff --git a/core/modules/node/lib/Drupal/node/Tests/NodePostSettingsTest.php b/core/modules/node/lib/Drupal/node/Tests/NodePostSettingsTest.php index 9ce688a..c7748f6 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodePostSettingsTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodePostSettingsTest.php @@ -19,17 +19,24 @@ class NodePostSettingsTest extends NodeTestBase { ); } - function setUp() { + public function setUp() { parent::setUp(); - $web_user = $this->drupalCreateUser(array('create page content', 'administer content types', 'access user profiles')); + $web_user = $this->drupalCreateUser(array( + 'create page content', + 'administer content types', + 'access user profiles', + )); $this->drupalLogin($web_user); } /** - * Set "Basic page" content type to display post information and confirm its presence on a new node. + * Test post information on nodes. + * + * Set "Basic page" content type to display post information and confirm + * its presence on a new node. */ - function testPagePostInfo() { + public function testPagePostInfo() { // Set "Basic page" content type to display post information. $edit = array(); @@ -50,9 +57,12 @@ class NodePostSettingsTest extends NodeTestBase { } /** - * Set "Basic page" content type to not display post information and confirm its absence on a new node. + * Test 'not display' post information. + * + * Set "Basic page" content type to not display post information and confirm + * its absence on a new node. */ - function testPageNotPostInfo() { + public function testPageNotPostInfo() { // Set "Basic page" content type to display post information. $edit = array(); diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeQueryAlterTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeQueryAlterTest.php index 6d149dd..47fbc91 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeQueryAlterTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeQueryAlterTest.php @@ -39,7 +39,7 @@ class NodeQueryAlterTest extends NodeTestBase { */ protected $noAccessUser; - function setUp() { + public function setUp() { parent::setUp(); node_access_rebuild(); @@ -60,7 +60,7 @@ class NodeQueryAlterTest extends NodeTestBase { /** * Tests that node access permissions are followed. */ - function testNodeQueryAlterWithUI() { + public function testNodeQueryAlterWithUI() { // Verify that a user with access permission can see at least one node. $this->drupalLogin($this->accessUser); $this->drupalGet('node_access_test_page'); @@ -80,7 +80,7 @@ class NodeQueryAlterTest extends NodeTestBase { * Verifies that a non-standard table alias can be used, and that a * user with node access can view the nodes. */ - function testNodeQueryAlterLowLevelWithAccess() { + public function testNodeQueryAlterLowLevelWithAccess() { // User with access should be able to view 4 nodes. try { $query = db_select('node', 'mytab') @@ -103,7 +103,7 @@ class NodeQueryAlterTest extends NodeTestBase { * Verifies that a non-standard table alias can be used, and that a * user without node access cannot view the nodes. */ - function testNodeQueryAlterLowLevelNoAccess() { + public function testNodeQueryAlterLowLevelNoAccess() { // User without access should be able to view 0 nodes. try { $query = db_select('node', 'mytab') @@ -126,7 +126,7 @@ class NodeQueryAlterTest extends NodeTestBase { * Verifies that a non-standard table alias can be used, and that a * user with view-only node access cannot edit the nodes. */ - function testNodeQueryAlterLowLevelEditAccess() { + public function testNodeQueryAlterLowLevelEditAccess() { // User with view-only access should not be able to edit nodes. try { $query = db_select('node', 'mytab') @@ -154,7 +154,7 @@ class NodeQueryAlterTest extends NodeTestBase { * to view the nodes when we add a record to {node_access} paired * with a corresponding privilege in hook_node_grants(). */ - function testNodeQueryAlterOverride() { + public function testNodeQueryAlterOverride() { $record = array( 'nid' => 0, 'gid' => 0, diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeRSSContentTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeRSSContentTest.php index 97b3b25..797507f 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeRSSContentTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeRSSContentTest.php @@ -31,21 +31,27 @@ class NodeRSSContentTest extends NodeTestBase { ); } - function setUp() { + public function setUp() { parent::setUp(); // Use bypass node access permission here, because the test class uses // hook_grants_alter() to deny access to everyone on node_access // queries. - $user = $this->drupalCreateUser(array('bypass node access', 'access content', 'create article content')); + $user = $this->drupalCreateUser(array( + 'bypass node access', + 'access content', + 'create article content', + )); $this->drupalLogin($user); } /** + * Test if custom data is added to the RSS feed. + * * Create a new node and ensure that it includes the custom data when added * to an RSS feed. */ - function testNodeRSSContent() { + public function testNodeRSSContent() { // Create a node. $node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1)); @@ -58,7 +64,7 @@ class NodeRSSContentTest extends NodeTestBase { // Check that content added in view modes other than 'rss' doesn't // appear in RSS feed. $non_rss_content = t('Extra data that should appear everywhere except the RSS feed for node !nid.', array('!nid' => $node->nid)); - $this->assertNoText($non_rss_content, t('Node content not designed for RSS doesn\'t appear in RSS feed.')); + $this->assertNoText($non_rss_content, t("Node content not designed for RSS doesn't appear in RSS feed.")); // Check that extra RSS elements and namespaces are added to RSS feed. $test_element = array( @@ -72,7 +78,7 @@ class NodeRSSContentTest extends NodeTestBase { // Check that content added in 'rss' view mode doesn't appear when // viewing node. $this->drupalGet("node/$node->nid"); - $this->assertNoText($rss_only_content, t('Node content designed for RSS doesn\'t appear when viewing node.')); + $this->assertNoText($rss_only_content, t("Node content designed for RSS doesn't appear when viewing node.")); } } diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeRevisionPermissionsTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeRevisionPermissionsTest.php index 7156e10..b9b161b 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeRevisionPermissionsTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeRevisionPermissionsTest.php @@ -11,7 +11,7 @@ namespace Drupal\node\Tests; * Tests user permissions for node revisions. */ class NodeRevisionPermissionsTest extends NodeTestBase { - protected $node_revisions = array(); + protected $nodeRevisions = array(); protected $accounts = array(); // Map revision permission names to node revision access ops. @@ -29,12 +29,12 @@ class NodeRevisionPermissionsTest extends NodeTestBase { ); } - function setUp() { + public function setUp() { parent::setUp(); // Create a node with several revisions. $node = $this->drupalCreateNode(); - $this->node_revisions[] = $node; + $this->nodeRevisions[] = $node; for ($i = 0; $i < 3; $i++) { // Create a revision for the same nid and settings with a random log. @@ -42,7 +42,7 @@ class NodeRevisionPermissionsTest extends NodeTestBase { $revision->revision = 1; $revision->log = $this->randomName(32); node_save($revision); - $this->node_revisions[] = $revision; + $this->nodeRevisions[] = $revision; } // Create three users, one with each revision permission. @@ -74,8 +74,8 @@ class NodeRevisionPermissionsTest extends NodeTestBase { /** * Tests the _node_revision_access() function. */ - function testNodeRevisionAccess() { - $revision = $this->node_revisions[1]; + public function testNodeRevisionAccess() { + $revision = $this->nodeRevisions[1]; $parameters = array( 'op' => array_keys($this->map), diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeRevisionsTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeRevisionsTest.php index ee12f0a..c0d52cd 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeRevisionsTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeRevisionsTest.php @@ -19,7 +19,7 @@ class NodeRevisionsTest extends NodeTestBase { ); } - function setUp() { + public function setUp() { parent::setUp(); // Create and login user. @@ -45,7 +45,8 @@ class NodeRevisionsTest extends NodeTestBase { // Create revision with random title and body and update variables. $this->drupalCreateNode($settings); - $node = node_load($node->nid); // Make sure we get revision information. + // Make sure we get revision information. + $node = node_load($node->nid); $settings = get_object_vars($node); $nodes[] = $node; @@ -58,7 +59,7 @@ class NodeRevisionsTest extends NodeTestBase { /** * Check node revision related operations. */ - function testRevisions() { + public function testRevisions() { $nodes = $this->nodes; $logs = $this->logs; @@ -81,8 +82,11 @@ class NodeRevisionsTest extends NodeTestBase { // Confirm that revisions revert properly. $this->drupalPost("node/$node->nid/revisions/{$nodes[1]->vid}/revert", array(), t('Revert')); $this->assertRaw(t('@type %title has been reverted back to the revision from %revision-date.', - array('@type' => 'Basic page', '%title' => $nodes[1]->label(), - '%revision-date' => format_date($nodes[1]->revision_timestamp))), t('Revision reverted.')); + array( + '@type' => 'Basic page', + '%title' => $nodes[1]->label(), + '%revision-date' => format_date($nodes[1]->revision_timestamp), + )), t('Revision reverted.')); $reverted_node = node_load($node->nid); $this->assertTrue(($nodes[1]->body[LANGUAGE_NOT_SPECIFIED][0]['value'] == $reverted_node->body[LANGUAGE_NOT_SPECIFIED][0]['value']), t('Node reverted correctly.')); @@ -93,8 +97,11 @@ class NodeRevisionsTest extends NodeTestBase { // Confirm revisions delete properly. $this->drupalPost("node/$node->nid/revisions/{$nodes[1]->vid}/delete", array(), t('Delete')); $this->assertRaw(t('Revision from %revision-date of @type %title has been deleted.', - array('%revision-date' => format_date($nodes[1]->revision_timestamp), - '@type' => 'Basic page', '%title' => $nodes[1]->label())), t('Revision deleted.')); + array( + '%revision-date' => format_date($nodes[1]->revision_timestamp), + '@type' => 'Basic page', + '%title' => $nodes[1]->label(), + )), t('Revision deleted.')); $this->assertTrue(db_query('SELECT COUNT(vid) FROM {node_revision} WHERE nid = :nid and vid = :vid', array(':nid' => $node->nid, ':vid' => $nodes[1]->vid))->fetchField() == 0, t('Revision not found.')); // Set the revision timestamp to an older date to make sure that the @@ -117,7 +124,7 @@ class NodeRevisionsTest extends NodeTestBase { /** * Checks that revisions are correctly saved without log messages. */ - function testNodeRevisionWithoutLogMessage() { + public function testNodeRevisionWithoutLogMessage() { // Create a node with an initial log message. $log = $this->randomName(10); $node = $this->drupalCreateNode(array('log' => $log)); diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeSaveTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeSaveTest.php index 116ca18..57be0f5 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeSaveTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeSaveTest.php @@ -27,10 +27,11 @@ class NodeSaveTest extends NodeTestBase { ); } - function setUp() { + public function setUp() { parent::setUp(); - // Create a user that is allowed to post; we'll use this to test the submission. + // Create a user that is allowed to post; we'll use this to test the + // submission. $web_user = $this->drupalCreateUser(array('create article content')); $this->drupalLogin($web_user); $this->web_user = $web_user; @@ -38,12 +39,13 @@ class NodeSaveTest extends NodeTestBase { /** * Import test, to check if custom node ids are saved properly. + * * Workflow: * - first create a piece of content * - save the content * - check if node exists */ - function testImport() { + public function testImport() { // Node ID must be a number that is not in the database. $max_nid = db_query('SELECT MAX(nid) FROM {node}')->fetchField(); $test_nid = $max_nid + mt_rand(1000, 1000000); @@ -71,10 +73,12 @@ class NodeSaveTest extends NodeTestBase { } /** + * Test the "created" and "changed" timestamps. + * * Check that the "created" and "changed" timestamps are set correctly when * saving a new node or updating an existing node. */ - function testTimestamps() { + public function testTimestamps() { // Use the default timestamps. $edit = array( 'uid' => $this->web_user->uid, @@ -108,8 +112,10 @@ class NodeSaveTest extends NodeTestBase { 'uid' => $this->web_user->uid, 'type' => 'article', 'title' => $this->randomName(8), - 'created' => 280299600, // Sun, 19 Nov 1978 05:00:00 GMT - 'changed' => 979534800, // Drupal 1.0 release. + // Sun, 19 Nov 1978 05:00:00 GMT. + 'created' => 280299600, + // Drupal 1.0 release. + 'changed' => 979534800, ); entity_create('node', $edit)->save(); @@ -128,10 +134,12 @@ class NodeSaveTest extends NodeTestBase { } /** + * Tests determing changes in hool_node_presave(). + * * Tests determing changes in hook_node_presave() and verifies the static node * load cache is cleared upon save. */ - function testDeterminingChanges() { + public function testDeterminingChanges() { // Initial creation. $node = entity_create('node', array( 'uid' => $this->web_user->uid, diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeTestBase.php b/core/modules/node/lib/Drupal/node/Tests/NodeTestBase.php index 3c39279..cf058da 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeTestBase.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeTestBase.php @@ -18,7 +18,7 @@ abstract class NodeTestBase extends WebTestBase { */ public static $modules = array('node'); - function setUp() { + public function setUp() { parent::setUp(); // Create Basic page and Article node types. diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeTitleTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeTitleTest.php index 1880d4f..df426cc 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeTitleTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeTitleTest.php @@ -19,29 +19,35 @@ class NodeTitleTest extends NodeTestBase { */ public static $modules = array('comment'); - protected $admin_user; + protected $adminUser; public static function getInfo() { return array( 'name' => 'Node title', 'description' => 'Test node title.', - 'group' => 'Node' + 'group' => 'Node', ); } - function setUp() { + public function setUp() { parent::setUp(); - $this->admin_user = $this->drupalCreateUser(array('administer nodes', 'create article content', 'create page content', 'post comments')); - $this->drupalLogin($this->admin_user); + $this->adminUser = $this->drupalCreateUser(array( + 'administer nodes', + 'create article content', + 'create page content', + 'post comments', + )); + $this->drupalLogin($this->adminUser); } /** * Create one node and test if the node title has the correct value. */ - function testNodeTitle() { + public function testNodeTitle() { // Create "Basic page" content with title. - // Add the node to the frontpage so we can test if teaser links are clickable. + // Add the node to the frontpage so we can test if teaser links are + // clickable. $settings = array( 'title' => $this->randomName(8), 'promote' => 1, @@ -51,7 +57,7 @@ class NodeTitleTest extends NodeTestBase { // Test tag. $this->drupalGet("node/$node->nid"); $xpath = '//title'; - $this->assertEqual(current($this->xpath($xpath)), $node->label() .' | Drupal', 'Page title is equal to node title.', 'Node'); + $this->assertEqual(current($this->xpath($xpath)), $node->label() . ' | Drupal', 'Page title is equal to node title.', 'Node'); // Test breadcrumb in comment preview. $this->drupalGet("comment/reply/$node->nid"); diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeTitleXSSTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeTitleXSSTest.php index 610c41f..d007472 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeTitleXSSTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeTitleXSSTest.php @@ -16,7 +16,7 @@ class NodeTitleXSSTest extends NodeTestBase { ); } - function testNodeTitleXSS() { + public function testNodeTitleXSS() { // Prepare a user to do the stuff. $web_user = $this->drupalCreateUser(array('create page content', 'edit any page content')); $this->drupalLogin($web_user); diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeTokenReplaceTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeTokenReplaceTest.php index 4174ee6..22992d3 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeTokenReplaceTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeTokenReplaceTest.php @@ -22,7 +22,7 @@ class NodeTokenReplaceTest extends NodeTestBase { /** * Creates a node, then tests the tokens generated from it. */ - function testNodeTokenReplacement() { + public function testNodeTokenReplacement() { $language_interface = language(LANGUAGE_TYPE_INTERFACE); $url_options = array( 'absolute' => TRUE, diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeTypeInitialLanguageTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeTypeInitialLanguageTest.php index 434384f..94d3bff 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeTypeInitialLanguageTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeTypeInitialLanguageTest.php @@ -27,10 +27,14 @@ class NodeTypeInitialLanguageTest extends NodeTestBase { ); } - function setUp() { + public function setUp() { parent::setUp(); - $web_user = $this->drupalCreateUser(array('bypass node access', 'administer content types', 'administer languages')); + $web_user = $this->drupalCreateUser(array( + 'bypass node access', + 'administer content types', + 'administer languages', + )); $this->drupalLogin($web_user); } @@ -40,7 +44,7 @@ class NodeTypeInitialLanguageTest extends NodeTestBase { * The default initial language must be the site's default, and the language * locked option must be on. */ - function testNodeTypeInitialLanguageDefaults() { + public function testNodeTypeInitialLanguageDefaults() { $this->drupalGet('admin/structure/types/manage/article'); $this->assertOptionSelected('edit-node-type-language-default', 'site_default', 'The default inital language is the site default.'); $this->assertFieldChecked('edit-node-type-language-hidden', 'Language selector is hidden by default.'); @@ -59,7 +63,7 @@ class NodeTypeInitialLanguageTest extends NodeTestBase { $this->drupalPost('admin/config/regional/language', $edit, t('Save configuration')); // Tests the initial language after changing the site default language. - // First unhide the language selector + // First unhide the language selector. $edit = array( 'node_type_language_hidden' => FALSE, ); diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeTypePersistenceTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeTypePersistenceTest.php index b02bf7d..c6512a1 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeTypePersistenceTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeTypePersistenceTest.php @@ -22,8 +22,12 @@ class NodeTypePersistenceTest extends NodeTestBase { /** * Test node type customizations persist through disable and uninstall. */ - function testNodeTypeCustomizationPersistence() { - $web_user = $this->drupalCreateUser(array('bypass node access', 'administer content types', 'administer modules')); + public function testNodeTypeCustomizationPersistence() { + $web_user = $this->drupalCreateUser(array( + 'bypass node access', + 'administer content types', + 'administer modules', + )); $this->drupalLogin($web_user); $poll_key = 'modules[Core][poll][enable]'; $poll_enable = array($poll_key => "1"); diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeTypeTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeTypeTest.php index bf925c4..7889312 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeTypeTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeTypeTest.php @@ -32,7 +32,7 @@ class NodeTypeTest extends NodeTestBase { * * Load available node types and validate the returned data. */ - function testNodeTypeGetFunctions() { + public function testNodeTypeGetFunctions() { $node_types = node_type_get_types(); $node_names = node_type_get_names(); @@ -49,7 +49,7 @@ class NodeTypeTest extends NodeTestBase { /** * Test creating a content type programmatically and via a form. */ - function testNodeTypeCreation() { + public function testNodeTypeCreation() { // Create a content type programmaticaly. $type = $this->drupalCreateContentType(); @@ -79,7 +79,7 @@ class NodeTypeTest extends NodeTestBase { /** * Test editing a node type using the UI. */ - function testNodeTypeEditing() { + public function testNodeTypeEditing() { $web_user = $this->drupalCreateUser(array('bypass node access', 'administer content types')); $this->drupalLogin($web_user); @@ -132,7 +132,7 @@ class NodeTypeTest extends NodeTestBase { /** * Test that node_types_rebuild() correctly handles the 'disabled' flag. */ - function testNodeTypeStatus() { + public function testNodeTypeStatus() { // Enable all core node modules, and all types should be active. module_enable(array('book', 'poll'), FALSE); node_types_rebuild(); @@ -171,7 +171,7 @@ class NodeTypeTest extends NodeTestBase { /** * Tests deleting a content type that still has content. */ - function testNodeTypeDeletion() { + public function testNodeTypeDeletion() { // Create a content type programmatically. $type = $this->drupalCreateContentType(); diff --git a/core/modules/node/lib/Drupal/node/Tests/PageEditTest.php b/core/modules/node/lib/Drupal/node/Tests/PageEditTest.php index 9fa1061..598c831 100644 --- a/core/modules/node/lib/Drupal/node/Tests/PageEditTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/PageEditTest.php @@ -8,8 +8,8 @@ namespace Drupal\node\Tests; class PageEditTest extends NodeTestBase { - protected $web_user; - protected $admin_user; + protected $webUser; + protected $adminUser; public static function getInfo() { return array( @@ -19,18 +19,18 @@ class PageEditTest extends NodeTestBase { ); } - function setUp() { + public function setUp() { parent::setUp(); - $this->web_user = $this->drupalCreateUser(array('edit own page content', 'create page content')); - $this->admin_user = $this->drupalCreateUser(array('bypass node access', 'administer nodes')); + $this->webUser = $this->drupalCreateUser(array('edit own page content', 'create page content')); + $this->adminUser = $this->drupalCreateUser(array('bypass node access', 'administer nodes')); } /** * Check node edit functionality. */ - function testPageEdit() { - $this->drupalLogin($this->web_user); + public function testPageEdit() { + $this->drupalLogin($this->webUser); $langcode = LANGUAGE_NOT_SPECIFIED; $title_key = "title"; @@ -51,7 +51,8 @@ class PageEditTest extends NodeTestBase { $actual_url = $this->getURL(); $this->assertEqual($edit_url, $actual_url, t('On edit page.')); - // Check that the title and body fields are displayed with the correct values. + // Check that the title and body fields are displayed with the correct + // values. $active = '<span class="element-invisible">' . t('(active tab)') . '</span>'; $link_text = t('!local-task-title!active', array('!local-task-title' => t('Edit'), '!active' => $active)); $this->assertText(strip_tags($link_text), 0, t('Edit tab found and marked active.')); @@ -65,7 +66,8 @@ class PageEditTest extends NodeTestBase { // Stay on the current page, without reloading. $this->drupalPost(NULL, $edit, t('Save')); - // Check that the title and body fields are displayed with the updated values. + // Check that the title and body fields are displayed with the updated + // values. $this->assertText($edit[$title_key], t('Title displayed.')); $this->assertText($edit[$body_key], t('Body displayed.')); @@ -96,8 +98,8 @@ class PageEditTest extends NodeTestBase { /** * Check changing node authored by fields. */ - function testPageAuthoredBy() { - $this->drupalLogin($this->admin_user); + public function testPageAuthoredBy() { + $this->drupalLogin($this->adminUser); // Create node to edit. $langcode = LANGUAGE_NOT_SPECIFIED; @@ -109,7 +111,7 @@ class PageEditTest extends NodeTestBase { // Check that the node was authored by the currently logged in user. $node = $this->drupalGetNodeByTitle($edit['title']); - $this->assertIdentical($node->uid, $this->admin_user->uid, 'Node authored by admin user.'); + $this->assertIdentical($node->uid, $this->adminUser->uid, 'Node authored by admin user.'); // Try to change the 'authored by' field to an invalid user name. $edit = array( @@ -127,13 +129,13 @@ class PageEditTest extends NodeTestBase { // Change the authored by field to another user's name (that is not // logged in). - $edit['name'] = $this->web_user->name; + $edit['name'] = $this->webUser->name; $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save')); $node = node_load($node->nid, NULL, TRUE); - $this->assertIdentical($node->uid, $this->web_user->uid, 'Node authored by normal user.'); + $this->assertIdentical($node->uid, $this->webUser->uid, 'Node authored by normal user.'); // Check that normal users cannot change the authored by information. - $this->drupalLogin($this->web_user); + $this->drupalLogin($this->webUser); $this->drupalGet('node/' . $node->nid . '/edit'); $this->assertNoFieldByName('name'); } diff --git a/core/modules/node/lib/Drupal/node/Tests/PagePreviewTest.php b/core/modules/node/lib/Drupal/node/Tests/PagePreviewTest.php index 5bfd342..da02b22 100644 --- a/core/modules/node/lib/Drupal/node/Tests/PagePreviewTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/PagePreviewTest.php @@ -16,7 +16,7 @@ class PagePreviewTest extends NodeTestBase { ); } - function setUp() { + public function setUp() { parent::setUp(); $web_user = $this->drupalCreateUser(array('edit own page content', 'create page content')); @@ -26,7 +26,7 @@ class PagePreviewTest extends NodeTestBase { /** * Check the node preview functionality. */ - function testPagePreview() { + public function testPagePreview() { $langcode = LANGUAGE_NOT_SPECIFIED; $title_key = "title"; $body_key = "body[$langcode][0][value]"; @@ -42,7 +42,8 @@ class PagePreviewTest extends NodeTestBase { $this->assertText($edit[$title_key], t('Title displayed.')); $this->assertText($edit[$body_key], t('Body displayed.')); - // Check that the title and body fields are displayed with the correct values. + // Check that the title and body fields are displayed with the correct + // values. $this->assertFieldByName($title_key, $edit[$title_key], t('Title field displayed.')); $this->assertFieldByName($body_key, $edit[$body_key], t('Body field displayed.')); } @@ -50,7 +51,7 @@ class PagePreviewTest extends NodeTestBase { /** * Check the node preview functionality, when using revisions. */ - function testPagePreviewWithRevisions() { + public function testPagePreviewWithRevisions() { $langcode = LANGUAGE_NOT_SPECIFIED; $title_key = "title"; $body_key = "body[$langcode][0][value]"; @@ -69,7 +70,8 @@ class PagePreviewTest extends NodeTestBase { $this->assertText($edit[$title_key], t('Title displayed.')); $this->assertText($edit[$body_key], t('Body displayed.')); - // Check that the title and body fields are displayed with the correct values. + // Check that the title and body fields are displayed with the correct + // values. $this->assertFieldByName($title_key, $edit[$title_key], t('Title field displayed.')); $this->assertFieldByName($body_key, $edit[$body_key], t('Body field displayed.')); diff --git a/core/modules/node/lib/Drupal/node/Tests/PageViewTest.php b/core/modules/node/lib/Drupal/node/Tests/PageViewTest.php index e3f3e54..d8857ef 100644 --- a/core/modules/node/lib/Drupal/node/Tests/PageViewTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/PageViewTest.php @@ -17,9 +17,12 @@ class PageViewTest extends NodeTestBase { } /** - * Creates a node and then an anonymous and unpermissioned user attempt to edit the node. + * Test if an unpermissioned user can edit a node. + * + * Creates a node and then an anonymous and unpermissioned user attempt to + * edit the node. */ - function testPageView() { + public function testPageView() { // Create a node to view. $node = $this->drupalCreateNode(); $this->assertTrue(node_load($node->nid), t('Node created.')); diff --git a/core/modules/node/lib/Drupal/node/Tests/SummaryLengthTest.php b/core/modules/node/lib/Drupal/node/Tests/SummaryLengthTest.php index ca66678..f971fad 100644 --- a/core/modules/node/lib/Drupal/node/Tests/SummaryLengthTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/SummaryLengthTest.php @@ -17,9 +17,12 @@ class SummaryLengthTest extends NodeTestBase { } /** - * Creates a node and then an anonymous and unpermissioned user attempt to edit the node. + * Test if the summary in 600 characters. + * + * Creates a node and add a very long body to it. + * Then check if the summary view is 600 characters in length. */ - function testSummaryLength() { + public function testSummaryLength() { // Create a node to view. $settings = array( 'body' => array(LANGUAGE_NOT_SPECIFIED => array(array('value' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam vitae arcu at leo cursus laoreet. Curabitur dui tortor, adipiscing malesuada tempor in, bibendum ac diam. Cras non tellus a libero pellentesque condimentum. What is a Drupalism? Suspendisse ac lacus libero. Ut non est vel nisl faucibus interdum nec sed leo. Pellentesque sem risus, vulputate eu semper eget, auctor in libero. Ut fermentum est vitae metus convallis scelerisque. Phasellus pellentesque rhoncus tellus, eu dignissim purus posuere id. Quisque eu fringilla ligula. Morbi ullamcorper, lorem et mattis egestas, tortor neque pretium velit, eget eleifend odio turpis eu purus. Donec vitae metus quis leo pretium tincidunt a pulvinar sem. Morbi adipiscing laoreet mauris vel placerat. Nullam elementum, nisl sit amet scelerisque malesuada, dolor nunc hendrerit quam, eu ultrices erat est in orci. Curabitur feugiat egestas nisl sed accumsan.'))), @@ -34,7 +37,7 @@ class SummaryLengthTest extends NodeTestBase { // Attempt to access the front page. $this->drupalGet("node"); - // The node teaser when it has 600 characters in length + // The node teaser when it has 600 characters in length. $expected = 'What is a Drupalism?'; $this->assertRaw($expected, t('Check that the summary is 600 characters in length'), 'Node'); @@ -43,7 +46,8 @@ class SummaryLengthTest extends NodeTestBase { $instance['display']['teaser']['settings']['trim_length'] = 200; field_update_instance($instance); - // Attempt to access the front page again and check if the summary is now only 200 characters in length. + // Attempt to access the front page again and check if the summary is now + // only 200 characters in length. $this->drupalGet("node"); $this->assertNoRaw($expected, t('Check that the summary is not longer than 200 characters'), 'Node'); }