From 7e4cf94f839528a89e7f3af3e8b83c52a2440641 Mon Sep 17 00:00:00 2001 From: Andy Postnikov Date: Mon, 18 Feb 2013 10:20:07 +0400 Subject: [PATCH 2/3] Fixed all tests after conversion except FileFieldWidgetTest --- .../lib/Drupal/file/Tests/FileFieldWidgetTest.php | 11 ++++----- .../filter/Tests/FilterHtmlImageSecureTest.php | 2 +- .../lib/Drupal/node/Tests/NodeAccessPagerTest.php | 6 +---- .../node/lib/Drupal/node/Tests/NodeTitleTest.php | 3 --- .../lib/Drupal/rdf/Tests/CommentAttributesTest.php | 2 +- .../lib/Drupal/rdf/Tests/TrackerAttributesTest.php | 4 ++-- .../search/Tests/SearchCommentCountToggleTest.php | 9 ++++---- .../lib/Drupal/search/Tests/SearchCommentTest.php | 15 ------------ .../lib/Drupal/search/Tests/SearchRankingTest.php | 4 ++-- .../system/Tests/Entity/EntityCrudHookTest.php | 7 ------ .../lib/Drupal/tracker/Tests/TrackerTest.php | 24 -------------------- .../user/lib/Drupal/user/Tests/UserCancelTest.php | 12 +--------- .../user/lib/Drupal/user/Tests/UserPictureTest.php | 3 --- .../lib/Drupal/user/Tests/UserSignatureTest.php | 2 +- .../lib/Drupal/views/Tests/DefaultViewsTest.php | 1 - .../Drupal/views/Tests/Entity/FieldEntityTest.php | 3 --- 16 files changed, 17 insertions(+), 91 deletions(-) diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php index fc95eaa..1dc0f2c 100644 --- a/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php +++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php @@ -266,13 +266,10 @@ function testPrivateFileComment() { $this->drupalPost(NULL, array(), t('Save settings')); // Create node. - $langcode = LANGUAGE_NOT_SPECIFIED; - $edit = array( + $node = $this->drupalCreateNode(array( + 'type' => 'article', 'title' => $this->randomName(), - "comment[$langcode][0][comment]" => COMMENT_OPEN - ); - $this->drupalPost('node/add/article', $edit, t('Save and publish')); - $node = $this->drupalGetNodeByTitle($edit['title']); + )); // Add a comment with a file. $text_file = $this->getTestFile('text'); @@ -280,7 +277,7 @@ function testPrivateFileComment() { 'files[field_' . $name . '_' . LANGUAGE_NOT_SPECIFIED . '_' . 0 . ']' => drupal_realpath($text_file->uri), 'comment_body[' . LANGUAGE_NOT_SPECIFIED . '][0][value]' => $comment_body = $this->randomName(), ); - $this->drupalPost(NULL, $edit, t('Save')); + $this->drupalPost('node/' . $node->nid, $edit, t('Save')); // Get the comment ID. preg_match('/comment-([0-9]+)/', $this->getUrl(), $matches); diff --git a/core/modules/filter/lib/Drupal/filter/Tests/FilterHtmlImageSecureTest.php b/core/modules/filter/lib/Drupal/filter/Tests/FilterHtmlImageSecureTest.php index efb7aa8..2bfe106 100644 --- a/core/modules/filter/lib/Drupal/filter/Tests/FilterHtmlImageSecureTest.php +++ b/core/modules/filter/lib/Drupal/filter/Tests/FilterHtmlImageSecureTest.php @@ -68,7 +68,7 @@ function setUp() { $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page')); // Add a comment field. comment_add_default_comment_field('node', 'page'); - $this->node = $this->drupalCreateNode(array('comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN))))); + $this->node = $this->drupalCreateNode(); } /** diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeAccessPagerTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeAccessPagerTest.php index 3e83e7f..17b14c0 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeAccessPagerTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeAccessPagerTest.php @@ -42,11 +42,7 @@ public function setUp() { */ public function testCommentPager() { // Create a node. - $node = $this->drupalCreateNode( - array('comment' => array( - LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN)) - )) - ); + $node = $this->drupalCreateNode(); // Create 60 comments. for ($i = 0; $i < 60; $i++) { diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeTitleTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeTitleTest.php index 662c042..d323446 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeTitleTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeTitleTest.php @@ -46,9 +46,6 @@ function testNodeTitle() { $settings = array( 'title' => $this->randomName(8), 'promote' => 1, - 'comment' => array( - LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN)) - ) ); $node = $this->drupalCreateNode($settings); diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/CommentAttributesTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/CommentAttributesTest.php index 107b053..ec08eb5 100644 --- a/core/modules/rdf/lib/Drupal/rdf/Tests/CommentAttributesTest.php +++ b/core/modules/rdf/lib/Drupal/rdf/Tests/CommentAttributesTest.php @@ -51,7 +51,7 @@ public function setUp() { // Creates the nodes on which the test comments will be posted. $this->drupalLogin($this->web_user); - $this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN))))); + $this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1)); $this->drupalLogout(); // Prepares commonly used URIs. $this->base_uri = url('', array('absolute' => TRUE)); diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/TrackerAttributesTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/TrackerAttributesTest.php index 73c1c84..db37d0e 100644 --- a/core/modules/rdf/lib/Drupal/rdf/Tests/TrackerAttributesTest.php +++ b/core/modules/rdf/lib/Drupal/rdf/Tests/TrackerAttributesTest.php @@ -59,9 +59,9 @@ function setUp() { */ function testAttributesInTracker() { // Creates node as anonymous user. - $node_anon = $this->drupalCreateNode(array('type' => 'article', 'uid' => 0, 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN))))); + $node_anon = $this->drupalCreateNode(array('type' => 'article', 'uid' => 0)); // Creates node as admin user. - $node_admin = $this->drupalCreateNode(array('type' => 'article', 'uid' => 1, 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN))))); + $node_admin = $this->drupalCreateNode(array('type' => 'article', 'uid' => 1)); // Passes both the anonymously posted node and the administrator posted node // through to test for the RDF attributes. diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchCommentCountToggleTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchCommentCountToggleTest.php index 60d9c36..e719260 100644 --- a/core/modules/search/lib/Drupal/search/Tests/SearchCommentCountToggleTest.php +++ b/core/modules/search/lib/Drupal/search/Tests/SearchCommentCountToggleTest.php @@ -52,7 +52,6 @@ function setUp() { $node_params = array( 'type' => 'article', 'body' => array(LANGUAGE_NOT_SPECIFIED => array(array('value' => 'SearchCommentToggleTestCase'))), - 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN))) ); $this->searchable_nodes['1 comment'] = $this->drupalCreateNode($node_params); @@ -96,11 +95,11 @@ function testSearchCommentCountToggle() { // Test comment count display for nodes with comment status set to Closed $this->searchable_nodes['0 comments']->comment = array( - LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_CLOSED)) + LANGUAGE_NOT_SPECIFIED => array(array('status' => COMMENT_CLOSED)) ); node_save($this->searchable_nodes['0 comments']); $this->searchable_nodes['1 comment']->comment = array( - LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_CLOSED)) + LANGUAGE_NOT_SPECIFIED => array(array('status' => COMMENT_CLOSED)) ); node_save($this->searchable_nodes['1 comment']); @@ -110,11 +109,11 @@ function testSearchCommentCountToggle() { // Test comment count display for nodes with comment status set to Hidden $this->searchable_nodes['0 comments']->comment = array( - LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_HIDDEN)) + LANGUAGE_NOT_SPECIFIED => array(array('status' => COMMENT_HIDDEN)) );; node_save($this->searchable_nodes['0 comments']); $this->searchable_nodes['1 comment']->comment = array( - LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_HIDDEN)) + LANGUAGE_NOT_SPECIFIED => array(array('status' => COMMENT_HIDDEN)) );; node_save($this->searchable_nodes['1 comment']); diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchCommentTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchCommentTest.php index 655adad..417775d 100644 --- a/core/modules/search/lib/Drupal/search/Tests/SearchCommentTest.php +++ b/core/modules/search/lib/Drupal/search/Tests/SearchCommentTest.php @@ -78,11 +78,6 @@ function testSearchResultsComment() { // Create a node. $node = $this->drupalCreateNode(array( 'type' => 'article', - 'comment' => array( - LANGUAGE_NOT_SPECIFIED => array( - array('comment' => COMMENT_OPEN) - ) - ) )); // Post a comment using 'Full HTML' text format. $edit_comment = array(); @@ -148,11 +143,6 @@ function testSearchResultsCommentAccess() { field_update_instance($instance); $this->node = $this->drupalCreateNode(array( 'type' => 'article', - 'comment' => array( - LANGUAGE_NOT_SPECIFIED => array( - array('comment' => COMMENT_OPEN) - ) - ) )); // Post a comment using 'Full HTML' text format. @@ -245,11 +235,6 @@ function testAddNewComment() { 'type' => 'article', 'title' => 'short title', 'body' => array(LANGUAGE_NOT_SPECIFIED => array(array('value' => 'short body text'))), - 'comment' => array( - LANGUAGE_NOT_SPECIFIED => array( - array('comment' => COMMENT_OPEN) - ) - ) ); $user = $this->drupalCreateUser(array('search content', 'create article content', 'access content')); diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchRankingTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchRankingTest.php index 1c789e7..67dcd8c 100644 --- a/core/modules/search/lib/Drupal/search/Tests/SearchRankingTest.php +++ b/core/modules/search/lib/Drupal/search/Tests/SearchRankingTest.php @@ -38,7 +38,7 @@ function testRankings() { $settings = array( 'type' => 'page', 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array( - 'comment' => COMMENT_HIDDEN + 'status' => COMMENT_HIDDEN ))), 'title' => 'Drupal rocks', 'body' => array(LANGUAGE_NOT_SPECIFIED => array(array('value' => "Drupal's search rocks"))), @@ -57,7 +57,7 @@ function testRankings() { $settings['created'] = REQUEST_TIME + 3600; break; case 'comments': - $settings['comment'][LANGUAGE_NOT_SPECIFIED][0]['comment'] = COMMENT_OPEN; + $settings['comment'][LANGUAGE_NOT_SPECIFIED][0]['status'] = COMMENT_OPEN; break; } } diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCrudHookTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCrudHookTest.php index b514998..fd6f2ad 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCrudHookTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCrudHookTest.php @@ -130,13 +130,6 @@ public function testCommentHooks() { 'type' => 'article', 'title' => 'Test node', 'status' => 1, - 'comment' => array( - LANGUAGE_NOT_SPECIFIED => array( - array( - 'comment' => COMMENT_OPEN - ) - ) - ), 'promote' => 0, 'sticky' => 0, 'langcode' => LANGUAGE_NOT_SPECIFIED, diff --git a/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php b/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php index 31acc67..d20488c 100644 --- a/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php +++ b/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php @@ -63,16 +63,10 @@ function testTrackerAll() { $unpublished = $this->drupalCreateNode(array( 'title' => $this->randomName(8), 'status' => 0, - 'comment' => array( - LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN)) - ), )); $published = $this->drupalCreateNode(array( 'title' => $this->randomName(8), 'status' => 1, - 'comment' => array( - LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN)) - ), )); $this->drupalGet('tracker'); @@ -96,17 +90,11 @@ function testTrackerUser() { 'title' => $this->randomName(8), 'uid' => $this->user->uid, 'status' => 0, - 'comment' => array( - LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN)) - ), )); $my_published = $this->drupalCreateNode(array( 'title' => $this->randomName(8), 'uid' => $this->user->uid, 'status' => 1, - 'comment' => array( - LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN)) - ), )); $other_published_no_comment = $this->drupalCreateNode(array( 'title' => $this->randomName(8), @@ -117,9 +105,6 @@ function testTrackerUser() { 'title' => $this->randomName(8), 'uid' => $this->other_user->uid, 'status' => 1, - 'comment' => array( - LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN)) - ), )); $comment = array( 'subject' => $this->randomName(), @@ -176,9 +161,6 @@ function testTrackerNewComments() { $this->drupalLogin($this->user); $node = $this->drupalCreateNode(array( - 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array( - 'comment' => COMMENT_OPEN - ))), 'title' => $this->randomName(8), )); @@ -221,9 +203,6 @@ function testTrackerCronIndexing() { $nodes = array(); for ($i = 1; $i <= 3; $i++) { $edits[$i] = array( - 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array( - 'comment' => COMMENT_OPEN - ))), 'title' => $this->randomName(), ); $nodes[$i] = $this->drupalCreateNode($edits[$i]); @@ -277,9 +256,6 @@ function testTrackerAdminUnpublish() { $this->drupalLogin($admin_user); $node = $this->drupalCreateNode(array( - 'comment' => array( - LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN)) - ), 'title' => $this->randomName(), )); diff --git a/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php b/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php index cdbe853..5bcb7d3 100644 --- a/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php +++ b/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php @@ -54,7 +54,7 @@ function testUserCancelWithoutPermission() { 'uid' => $account->uid, 'comment' => array( LANGUAGE_NOT_SPECIFIED => array( - array('comment' => COMMENT_CLOSED) + array('status' => COMMENT_CLOSED) ) ) )); @@ -128,7 +128,6 @@ function testUserCancelInvalid() { // Create a node. $node = $this->drupalCreateNode(array( 'uid' => $account->uid, - 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN))) )); // Attempt to cancel account. @@ -208,7 +207,6 @@ function testUserBlockUnpublish() { // Create a node with two revisions. $node = $this->drupalCreateNode(array( 'uid' => $account->uid, - 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN))) )); $settings = get_object_vars($node); $settings['revision'] = 1; @@ -255,14 +253,12 @@ function testUserAnonymize() { // Create a simple node. $node = $this->drupalCreateNode(array( 'uid' => $account->uid, - 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN))) )); // Create a node with two revisions, the initial one belonging to the // cancelling user. $revision_node = $this->drupalCreateNode(array( 'uid' => $account->uid, - 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN))) )); $revision = $revision_node->vid; $settings = get_object_vars($revision_node); @@ -314,11 +310,6 @@ function testUserDelete() { // Create a simple node. $node = $this->drupalCreateNode(array( 'uid' => $account->uid, - 'comment' => array( - LANGUAGE_NOT_SPECIFIED => array( - array('comment' => COMMENT_OPEN) - ) - ) )); // Create comment. @@ -338,7 +329,6 @@ function testUserDelete() { // cancelling user. $revision_node = $this->drupalCreateNode(array( 'uid' => $account->uid, - 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN))) )); $revision = $revision_node->vid; $settings = get_object_vars($revision_node); diff --git a/core/modules/user/lib/Drupal/user/Tests/UserPictureTest.php b/core/modules/user/lib/Drupal/user/Tests/UserPictureTest.php index 71f5d2b..5955325 100644 --- a/core/modules/user/lib/Drupal/user/Tests/UserPictureTest.php +++ b/core/modules/user/lib/Drupal/user/Tests/UserPictureTest.php @@ -97,9 +97,6 @@ function testPictureOnNodeComment() { $node = $this->drupalCreateNode(array( 'type' => 'article', - 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array( - 'comment' => COMMENT_OPEN - ))), )); // Enable user pictures on nodes. diff --git a/core/modules/user/lib/Drupal/user/Tests/UserSignatureTest.php b/core/modules/user/lib/Drupal/user/Tests/UserSignatureTest.php index 3274616..a4047c3 100644 --- a/core/modules/user/lib/Drupal/user/Tests/UserSignatureTest.php +++ b/core/modules/user/lib/Drupal/user/Tests/UserSignatureTest.php @@ -76,7 +76,7 @@ function setUp() { */ function testUserSignature() { // Create a new node with comments on (default). - $node = $this->drupalCreateNode(array('comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN))))); + $node = $this->drupalCreateNode(); // Verify that user signature field is not displayed on registration form. $this->drupalGet('user/register'); diff --git a/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php b/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php index 8501b61..8c5967d 100644 --- a/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php @@ -96,7 +96,6 @@ protected function setUp() { $values = array('created' => $time, 'type' => 'page'); $values[$this->field_name][LANGUAGE_NOT_SPECIFIED][]['tid'] = $term->tid; - $values['comment'][LANGUAGE_NOT_SPECIFIED][]['comment'] = COMMENT_OPEN; // Make every other node promoted. if ($i % 2) { diff --git a/core/modules/views/lib/Drupal/views/Tests/Entity/FieldEntityTest.php b/core/modules/views/lib/Drupal/views/Tests/Entity/FieldEntityTest.php index ee2cf74..dc8211d 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Entity/FieldEntityTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Entity/FieldEntityTest.php @@ -49,9 +49,6 @@ public function testGetEntity() { $node = entity_create('node', array( 'uid' => $account->id(), 'type' => 'page', - 'comment' => array( - LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN)) - ), )); $node->save(); $comment = entity_create('comment', array( -- 1.7.10.4