diff --git a/core/modules/editor/src/Tests/QuickEditIntegrationLoadingTest.php b/core/modules/editor/src/Tests/QuickEditIntegrationLoadingTest.php index ff25d40842e80473bee8e3cea94c4b25811a162d..13b882a9c0657599cc0d26de4ded81806e7a1f2e 100644 --- a/core/modules/editor/src/Tests/QuickEditIntegrationLoadingTest.php +++ b/core/modules/editor/src/Tests/QuickEditIntegrationLoadingTest.php @@ -88,7 +88,7 @@ public function testUsersWithoutPermission() { $this->assertRaw('
Do you also love Drupal?
Do you also love Drupal?
Malicious content.
'; $edit['body[0][format]'] = 'filtered_html'; $edit['op'] = t('Save'); - $response = $this->drupalPost('quickedit/form/' . 'node/1/body/und/full', 'application/vnd.drupal-ajax', $edit); + $response = $this->drupalPost('quickedit/form/' . 'node/1/body/en/full', 'application/vnd.drupal-ajax', $edit); // @todo Uncomment the below once https://drupal.org/node/2063303 is fixed. // $this->assertIdentical('[]', $response); $this->assertResponse(403); @@ -135,7 +135,7 @@ public function testUserWithPermission() { // HTML annotation must always exist (to not break the render cache). $this->assertRaw('data-quickedit-entity-id="node/1"'); - $this->assertRaw('data-quickedit-field-id="node/1/body/und/full"'); + $this->assertRaw('data-quickedit-field-id="node/1/body/en/full"'); // There should be only one revision so far. $node = node_load(1); @@ -145,11 +145,11 @@ public function testUserWithPermission() { // Retrieving the metadata should result in a 200 JSON response. $htmlPageDrupalSettings = $this->drupalSettings; - $post = array('fields[0]' => 'node/1/body/und/full'); + $post = array('fields[0]' => 'node/1/body/en/full'); $response = $this->drupalPost('quickedit/metadata', 'application/json', $post); $this->assertResponse(200); $expected = array( - 'node/1/body/und/full' => array( + 'node/1/body/en/full' => array( 'label' => 'Body', 'access' => TRUE, 'editor' => 'form', @@ -177,7 +177,7 @@ public function testUserWithPermission() { // Retrieving the form for this field should result in a 200 response, // containing only a quickeditFieldForm command. $post = array('nocssjs' => 'true', 'reset' => 'true') + $this->getAjaxPageStatePostData(); - $response = $this->drupalPost('quickedit/form/' . 'node/1/body/und/full', 'application/vnd.drupal-ajax', $post); + $response = $this->drupalPost('quickedit/form/' . 'node/1/body/en/full', 'application/vnd.drupal-ajax', $post); $this->assertResponse(200); $ajax_commands = Json::decode($response); $this->assertIdentical(1, count($ajax_commands), 'The field form HTTP request results in one AJAX command.'); @@ -205,7 +205,7 @@ public function testUserWithPermission() { // Submit field form and check response. This should store the updated // entity in TempStore on the server. - $response = $this->drupalPost('quickedit/form/' . 'node/1/body/und/full', 'application/vnd.drupal-ajax', $post); + $response = $this->drupalPost('quickedit/form/' . 'node/1/body/en/full', 'application/vnd.drupal-ajax', $post); $this->assertResponse(200); $ajax_commands = Json::decode($response); $this->assertIdentical(1, count($ajax_commands), 'The field form HTTP request results in one AJAX command.'); @@ -247,7 +247,7 @@ public function testUserWithPermission() { // Retrieve field form. $post = array('nocssjs' => 'true', 'reset' => 'true'); - $response = $this->drupalPost('quickedit/form/' . 'node/1/body/und/full', 'application/vnd.drupal-ajax', $post); + $response = $this->drupalPost('quickedit/form/' . 'node/1/body/en/full', 'application/vnd.drupal-ajax', $post); $this->assertResponse(200); $ajax_commands = Json::decode($response); $this->assertIdentical(1, count($ajax_commands), 'The field form HTTP request results in one AJAX command.'); @@ -264,7 +264,7 @@ public function testUserWithPermission() { 'form_build_id' => $build_id_match[1], ); $post += $edit + $this->getAjaxPageStatePostData(); - $response = $this->drupalPost('quickedit/form/' . 'node/1/body/und/full', 'application/vnd.drupal-ajax', $post); + $response = $this->drupalPost('quickedit/form/' . 'node/1/body/en/full', 'application/vnd.drupal-ajax', $post); // @todo Uncomment the below once https://drupal.org/node/2063303 is fixed. // $this->assertIdentical('[]', $response); $this->assertResponse(200); @@ -299,16 +299,16 @@ public function testTitleBaseField() { // Ensure that the full page title is actually in-place editable $node = entity_load('node', 1); - $elements = $this->xpath('//h1/span[@data-quickedit-field-id="node/1/title/und/full" and normalize-space(text())=:title]', array(':title' => $node->label())); + $elements = $this->xpath('//h1/span[@data-quickedit-field-id="node/1/title/en/full" and normalize-space(text())=:title]', array(':title' => $node->label())); $this->assertTrue(!empty($elements), 'Title with data-quickedit-field-id attribute found.'); // Retrieving the metadata should result in a 200 JSON response. $htmlPageDrupalSettings = $this->drupalSettings; - $post = array('fields[0]' => 'node/1/title/und/full'); + $post = array('fields[0]' => 'node/1/title/en/full'); $response = $this->drupalPost('quickedit/metadata', 'application/json', $post); $this->assertResponse(200); $expected = array( - 'node/1/title/und/full' => array( + 'node/1/title/en/full' => array( 'label' => 'Title', 'access' => TRUE, 'editor' => 'plain_text', @@ -323,7 +323,7 @@ public function testTitleBaseField() { // Retrieving the form for this field should result in a 200 response, // containing only a quickeditFieldForm command. $post = array('nocssjs' => 'true', 'reset' => 'true') + $this->getAjaxPageStatePostData(); - $response = $this->drupalPost('quickedit/form/' . 'node/1/title/und/full', 'application/vnd.drupal-ajax', $post); + $response = $this->drupalPost('quickedit/form/' . 'node/1/title/en/full', 'application/vnd.drupal-ajax', $post); $this->assertResponse(200); $ajax_commands = Json::decode($response); $this->assertIdentical(1, count($ajax_commands), 'The field form HTTP request results in one AJAX command.'); @@ -350,7 +350,7 @@ public function testTitleBaseField() { // Submit field form and check response. This should store the // updated entity in TempStore on the server. - $response = $this->drupalPost('quickedit/form/' . 'node/1/title/und/full', 'application/vnd.drupal-ajax', $post); + $response = $this->drupalPost('quickedit/form/' . 'node/1/title/en/full', 'application/vnd.drupal-ajax', $post); $this->assertResponse(200); $ajax_commands = Json::decode($response); $this->assertIdentical(1, count($ajax_commands), 'The field form HTTP request results in one AJAX command.'); @@ -388,7 +388,7 @@ public function testPseudoFields() { $this->drupalGet('node/1'); // Check that the data- attribute is not added. - $this->assertNoRaw('data-quickedit-field-id="node/1/quickedit_test_pseudo_field/und/default"'); + $this->assertNoRaw('data-quickedit-field-id="node/1/quickedit_test_pseudo_field/en/default"'); } /** @@ -411,7 +411,7 @@ public function testDisplayOptions() { public function testCustomPipeline() { \Drupal::moduleHandler()->install(array('quickedit_test')); - $custom_render_url = 'quickedit/form/node/1/body/und/quickedit_test-custom-render-data'; + $custom_render_url = 'quickedit/form/node/1/body/en/quickedit_test-custom-render-data'; $this->drupalLogin($this->editor_user); // Request editing to render results with the custom render pipeline. @@ -460,7 +460,7 @@ public function testConcurrentEdit() { $this->drupalLogin($this->editor_user); $post = array('nocssjs' => 'true') + $this->getAjaxPageStatePostData(); - $response = $this->drupalPost('quickedit/form/' . 'node/1/body/und/full', 'application/vnd.drupal-ajax', $post); + $response = $this->drupalPost('quickedit/form/' . 'node/1/body/en/full', 'application/vnd.drupal-ajax', $post); $this->assertResponse(200); $ajax_commands = Json::decode($response); @@ -487,7 +487,7 @@ public function testConcurrentEdit() { // Submit field form and check response. Should throw a validation error // because the node was changed in the meantime. - $response = $this->drupalPost('quickedit/form/' . 'node/1/body/und/full', 'application/vnd.drupal-ajax', $post); + $response = $this->drupalPost('quickedit/form/' . 'node/1/body/en/full', 'application/vnd.drupal-ajax', $post); $this->assertResponse(200); $ajax_commands = Json::decode($response); $this->assertIdentical(2, count($ajax_commands), 'The field form HTTP request results in two AJAX commands.'); diff --git a/core/modules/search/src/Tests/SearchRankingTest.php b/core/modules/search/src/Tests/SearchRankingTest.php index b434bc952c84d145f19575c3460c9bec6cfc8a88..af44264d6c6bb2646e5dff6d8a678e8628fbd1fa 100644 --- a/core/modules/search/src/Tests/SearchRankingTest.php +++ b/core/modules/search/src/Tests/SearchRankingTest.php @@ -56,6 +56,8 @@ public function testRankings() { )), 'title' => 'Drupal rocks', 'body' => array(array('value' => "Drupal's search rocks")), + 'sticky' => 0, + 'promote' => 0, ); foreach (array(0, 1) as $num) { if ($num == 1) { diff --git a/core/modules/simpletest/src/WebTestBase.php b/core/modules/simpletest/src/WebTestBase.php index e7c1875eb09f7a3f6db3436c5908d57aebea8d1d..8ff3575c63d54647596ef4c866da00ba354f38af 100644 --- a/core/modules/simpletest/src/WebTestBase.php +++ b/core/modules/simpletest/src/WebTestBase.php @@ -225,16 +225,8 @@ function drupalGetNodeByTitle($title, $reset = FALSE) { * ); * @endcode * - title: Random string. - * - comment: CommentItemInterface::OPEN. - * - promote: NODE_NOT_PROMOTED. - * - log: Empty string. - * - status: NODE_PUBLISHED. - * - sticky: NODE_NOT_STICKY. * - type: 'page'. - * - langcode: LanguageInterface::LANGCODE_NOT_SPECIFIED. - * - uid: The currently logged in user, or the user running test. - * - revision: 1. (Backwards-compatible binary flag indicating whether a - * new revision should be created; use 1 to specify a new revision.) + * - uid: The currently logged in user, or anonymous. * * @return \Drupal\node\NodeInterface * The created node entity. @@ -242,44 +234,15 @@ function drupalGetNodeByTitle($title, $reset = FALSE) { protected function drupalCreateNode(array $settings = array()) { // Populate defaults array. $settings += array( - 'body' => array(array()), + 'body' => array(array( + 'value' => $this->randomMachineName(32), + 'format' => filter_default_format(), + )), 'title' => $this->randomMachineName(8), - 'promote' => NODE_NOT_PROMOTED, - 'revision' => 1, - 'log' => '', - 'status' => NODE_PUBLISHED, - 'sticky' => NODE_NOT_STICKY, 'type' => 'page', - 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, + 'uid' => \Drupal::currentUser()->id(), ); - - // Use the original node's created time for existing nodes. - if (isset($settings['created']) && !isset($settings['date'])) { - $settings['date'] = format_date($settings['created'], 'custom', 'Y-m-d H:i:s O'); - } - - // If the node's user uid is not specified manually, use the currently - // logged in user if available, or else the user running the test. - if (!isset($settings['uid'])) { - if ($this->loggedInUser) { - $settings['uid'] = $this->loggedInUser->id(); - } - else { - $user = \Drupal::currentUser() ?: new AnonymousUserSession(); - $settings['uid'] = $user->id(); - } - } - - // Merge body field value and format separately. - $settings['body'][0] += array( - 'value' => $this->randomMachineName(32), - 'format' => filter_default_format(), - ); - $node = entity_create('node', $settings); - if (!empty($settings['revision'])) { - $node->setNewRevision(); - } $node->save(); return $node;