diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Tests/AggregatorTestBase.php b/core/modules/aggregator/lib/Drupal/aggregator/Tests/AggregatorTestBase.php
index 4542116..48413f5 100644
--- a/core/modules/aggregator/lib/Drupal/aggregator/Tests/AggregatorTestBase.php
+++ b/core/modules/aggregator/lib/Drupal/aggregator/Tests/AggregatorTestBase.php
@@ -356,12 +356,11 @@ function getHtmlEntitiesSample() {
* (optional) The number of nodes to generate. Defaults to five.
*/
function createSampleNodes($count = 5) {
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
// Post $count article nodes.
for ($i = 0; $i < $count; $i++) {
$edit = array();
$edit['title'] = $this->randomName();
- $edit["body[$langcode][0][value]"] = $this->randomName();
+ $edit['body[0][value]'] = $this->randomName();
$this->drupalPost('node/add/article', $edit, t('Save'));
}
}
diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockCreationTest.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockCreationTest.php
index 3ce4513..dc4bccc 100644
--- a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockCreationTest.php
+++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockCreationTest.php
@@ -8,7 +8,6 @@
namespace Drupal\custom_block\Tests;
use Drupal\Core\Database\Database;
-use Drupal\Core\Language\Language;
/**
* Tests creating and saving a block.
@@ -49,9 +48,8 @@ protected function setUp() {
public function testCustomBlockCreation() {
// Create a block.
$edit = array();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
$edit['info'] = $this->randomName(8);
- $edit["block_body[$langcode][0][value]"] = $this->randomName(16);
+ $edit['block_body[0][value]'] = $this->randomName(16);
$this->drupalPost('block/add/basic', $edit, t('Save'));
// Check that the Basic block has been created.
@@ -84,9 +82,8 @@ public function testCustomBlockCreation() {
*/
public function testDefaultCustomBlockCreation() {
$edit = array();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
$edit['info'] = $this->randomName(8);
- $edit["block_body[$langcode][0][value]"] = $this->randomName(16);
+ $edit['block_body[0][value]'] = $this->randomName(16);
// Don't pass the custom block type in the url so the default is forced.
$this->drupalPost('block/add', $edit, t('Save'));
@@ -145,10 +142,9 @@ public function testFailedBlockCreation() {
public function testBlockDelete() {
// Create a block.
$edit = array();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
$edit['info'] = $this->randomName(8);
$body = $this->randomName(16);
- $edit["block_body[$langcode][0][value]"] = $body;
+ $edit['block_body[0][value]'] = $body;
$this->drupalPost('block/add/basic', $edit, t('Save'));
// Place the block.
@@ -179,10 +175,9 @@ public function testBlockDelete() {
// Create another block and force the plugin cache to flush.
$edit2 = array();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
$edit2['info'] = $this->randomName(8);
$body2 = $this->randomName(16);
- $edit2["block_body[$langcode][0][value]"] = $body2;
+ $edit2['block_body[0][value]'] = $body2;
$this->drupalPost('block/add/basic', $edit2, t('Save'));
$this->assertNoRaw('Error message');
@@ -192,7 +187,7 @@ public function testBlockDelete() {
$edit3 = array();
$edit3['info'] = $this->randomName(8);
$body = $this->randomName(16);
- $edit3["block_body[$langcode][0][value]"] = $body;
+ $edit3['block_body[0][value]'] = $body;
$this->drupalPost('block/add/basic', $edit3, t('Save'));
// Show the delete confirm form.
diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockFieldTest.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockFieldTest.php
index 53f8f5a..d637b3f 100644
--- a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockFieldTest.php
+++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockFieldTest.php
@@ -96,8 +96,8 @@ public function testBlockFields() {
$this->drupalGet('block/add/link');
$edit = array(
'info' => $this->randomName(8),
- $this->field['field_name'] . '[und][0][url]' => 'http://example.com',
- $this->field['field_name'] . '[und][0][title]' => 'Example.com'
+ $this->field['field_name'] . '[0][url]' => 'http://example.com',
+ $this->field['field_name'] . '[0][title]' => 'Example.com'
);
$this->drupalPost(NULL, $edit, t('Save'));
$block = entity_load('custom_block', 1);
diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockListTest.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockListTest.php
index d7d8c5c..4a1ea2e 100644
--- a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockListTest.php
+++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockListTest.php
@@ -7,7 +7,6 @@
namespace Drupal\custom_block\Tests;
-use Drupal\Core\Language\Language;
use Drupal\simpletest\WebTestBase;
/**
@@ -64,9 +63,8 @@ public function testListing() {
$this->clickLink($link_text);
$this->assertResponse(200);
$edit = array();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
$edit['info'] = $label;
- $edit["block_body[$langcode][0][value]"] = $this->randomName(16);
+ $edit['block_body[0][value]'] = $this->randomName(16);
$this->drupalPost(NULL, $edit, t('Save'));
// Confirm that once the user returns to the listing, the text of the label
diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/PageEditTest.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/PageEditTest.php
index dab0eb6..dfa8e6f 100644
--- a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/PageEditTest.php
+++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/PageEditTest.php
@@ -31,9 +31,8 @@ public static function getInfo() {
public function testPageEdit() {
$this->drupalLogin($this->adminUser);
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
$title_key = 'info';
- $body_key = "block_body[$langcode][0][value]";
+ $body_key = 'block_body[0][value]';
// Create block to edit.
$edit = array();
$edit['info'] = drupal_strtolower($this->randomName(8));
diff --git a/core/modules/book/lib/Drupal/book/Tests/BookTest.php b/core/modules/book/lib/Drupal/book/Tests/BookTest.php
index f4ad875..a1518bd 100644
--- a/core/modules/book/lib/Drupal/book/Tests/BookTest.php
+++ b/core/modules/book/lib/Drupal/book/Tests/BookTest.php
@@ -243,9 +243,8 @@ function createBookNode($book_nid, $parent = NULL) {
static $number = 0; // Used to ensure that when sorted nodes stay in same order.
$edit = array();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
$edit["title"] = $number . ' - SimpleTest test node ' . $this->randomName(10);
- $edit["body[$langcode][0][value]"] = 'SimpleTest test body ' . $this->randomName(32) . ' ' . $this->randomName(32);
+ $edit['body[0][value]'] = 'SimpleTest test body ' . $this->randomName(32) . ' ' . $this->randomName(32);
$edit['book[bid]'] = $book_nid;
if ($parent !== NULL) {
diff --git a/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorLoadingTest.php b/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorLoadingTest.php
index 89628ad..f322b48 100644
--- a/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorLoadingTest.php
+++ b/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorLoadingTest.php
@@ -109,7 +109,7 @@ function testLoading() {
$this->assertTrue($editor_js_present, 'Text Editor JavaScript is present.');
$this->assertTrue(count($body) === 1, 'A body field exists.');
$this->assertTrue(count($format_selector) === 1, 'A single text format selector exists on the page.');
- $specific_format_selector = $this->xpath('//select[contains(@class, "filter-list") and contains(@class, "editor") and @data-editor-for="edit-body-und-0-value"]');
+ $specific_format_selector = $this->xpath('//select[contains(@class, "filter-list") and contains(@class, "editor") and @data-editor-for="edit-body-0-value"]');
$this->assertTrue(count($specific_format_selector) === 1, 'A single text format selector exists on the page and has the "editor" class and a "data-editor-for" attribute with the correct value.');
$this->assertTrue(isset($settings['ajaxPageState']['js']['core/modules/ckeditor/js/ckeditor.js']), 'CKEditor glue JS is present.');
$this->assertTrue(isset($settings['ajaxPageState']['js']['core/assets/vendor/ckeditor/ckeditor.js']), 'CKEditor lib JS is present.');
@@ -147,7 +147,7 @@ protected function getThingsToCheck() {
// Editor.module's JS present.
isset($settings['ajaxPageState']['js']['core/modules/editor/js/editor.js']),
// Body field.
- $this->xpath('//textarea[@id="edit-body-und-0-value"]'),
+ $this->xpath('//textarea[@id="edit-body-0-value"]'),
// Format selector.
$this->xpath('//select[contains(@class, "filter-list")]'),
);
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentAnonymousTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentAnonymousTest.php
index 5fe19ba..18e2ebe 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentAnonymousTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentAnonymousTest.php
@@ -7,8 +7,6 @@
namespace Drupal\comment\Tests;
-use Drupal\Core\Language\Language;
-
/**
* Tests anonymous commenting.
*/
@@ -68,12 +66,11 @@ function testAnonymous() {
$this->assertTrue($this->commentExists($anonymous_comment2), 'Anonymous comment with contact info (optional) found.');
// Ensure anonymous users cannot post in the name of registered users.
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
$edit = array(
'name' => $this->admin_user->getUsername(),
'mail' => $this->randomName() . '@example.com',
'subject' => $this->randomName(),
- "comment_body[$langcode][0][value]" => $this->randomName(),
+ 'comment_body[0][value]' => $this->randomName(),
);
$this->drupalPost('comment/reply/' . $this->node->id(), $edit, t('Save'));
$this->assertText(t('The name you used belongs to a registered user.'));
@@ -141,7 +138,7 @@ function testAnonymous() {
$this->drupalGet('comment/reply/' . $this->node->id());
$this->assertText('You are not authorized to post comments', 'Error attempting to post comment.');
$this->assertNoFieldByName('subject', '', 'Subject field not found.');
- $this->assertNoFieldByName("comment_body[$langcode][0][value]", '', 'Comment field not found.');
+ $this->assertNoFieldByName('comment_body[0][value]', '', 'Comment field not found.');
user_role_change_permissions(DRUPAL_ANONYMOUS_RID, array(
'access comments' => TRUE,
@@ -161,7 +158,7 @@ function testAnonymous() {
$this->drupalGet('node/' . $this->node->id());
$this->assertNoPattern('@
]*>Comments
@', 'Comments were not displayed.');
$this->assertFieldByName('subject', '', 'Subject field found.');
- $this->assertFieldByName("comment_body[$langcode][0][value]", '', 'Comment field found.');
+ $this->assertFieldByName('comment_body[0][value]', '', 'Comment field found.');
$this->drupalGet('comment/reply/' . $this->node->id() . '/' . $anonymous_comment3->id());
$this->assertText('You are not authorized to view comments', 'Error attempting to post reply.');
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentFieldsTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentFieldsTest.php
index f9d25f1..62e7f67 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentFieldsTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentFieldsTest.php
@@ -111,7 +111,7 @@ function testCommentFormat() {
// Post a comment without an explicit subject.
$this->drupalLogin($this->web_user);
- $edit = array('comment_body[und][0][value]' => $this->randomName(8));
+ $edit = array('comment_body[0][value]' => $this->randomName(8));
$this->drupalPost('node/' . $this->node->id(), $edit, t('Save'));
}
}
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentInterfaceTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentInterfaceTest.php
index 7ebb12e..fc96e38 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentInterfaceTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentInterfaceTest.php
@@ -7,8 +7,6 @@
namespace Drupal\comment\Tests;
-use Drupal\Core\Language\Language;
-
/**
* Tests the comment module administrative and end-user-facing interfaces.
*/
@@ -26,7 +24,6 @@ public static function getInfo() {
* Tests the comment interface.
*/
function testCommentInterface() {
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
// Set comments to have subject and preview disabled.
$this->drupalLogin($this->admin_user);
$this->setCommentPreview(DRUPAL_DISABLED);
@@ -144,7 +141,7 @@ function testCommentInterface() {
$this->assertTrue($this->node, 'Article node created.');
$this->drupalGet('comment/reply/' . $this->node->id());
$this->assertNoText('This discussion is closed', 'Posting to node with comments enabled');
- $this->assertField('edit-comment-body-' . $langcode . '-0-value', 'Comment body field found.');
+ $this->assertField('edit-comment-body-0-value', 'Comment body field found.');
// Delete comment and make sure that reply is also removed.
$this->drupalLogout();
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentLanguageTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentLanguageTest.php
index 4064b22..463eca7 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentLanguageTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentLanguageTest.php
@@ -7,7 +7,6 @@
namespace Drupal\comment\Tests;
-use Drupal\Core\Language\Language;
use Drupal\simpletest\WebTestBase;
/**
@@ -90,14 +89,12 @@ function testCommentLanguage() {
// language and interface language do not influence comment language, as
// only content language has to.
foreach (language_list() as $node_langcode => $node_language) {
- $langcode_not_specified = Language::LANGCODE_NOT_SPECIFIED;
-
// Create "Article" content.
$title = $this->randomName();
$edit = array(
- "title" => $title,
- "body[$langcode_not_specified][0][value]" => $this->randomName(),
- "langcode" => $node_langcode,
+ 'title' => $title,
+ 'body[0][value]' => $this->randomName(),
+ 'langcode' => $node_langcode,
);
$this->drupalPost("node/add/article", $edit, t('Save'));
$node = $this->drupalGetNodeByTitle($title);
@@ -109,7 +106,7 @@ function testCommentLanguage() {
$comment_values[$node_langcode][$langcode] = $this->randomName();
$edit = array(
'subject' => $this->randomName(),
- "comment_body[$langcode][0][value]" => $comment_values[$node_langcode][$langcode],
+ 'comment_body[0][value]' => $comment_values[$node_langcode][$langcode],
);
$this->drupalPost($prefix . 'node/' . $node->id(), $edit, t('Preview'));
$this->drupalPost(NULL, $edit, t('Save'));
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentPreviewTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentPreviewTest.php
index e69507a..21404ab 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentPreviewTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentPreviewTest.php
@@ -9,8 +9,6 @@
use Drupal\Core\Datetime\DrupalDateTime;
-use Drupal\Core\Language\Language;
-
/**
* Tests previewing comments.
*/
@@ -61,8 +59,6 @@ function setUp() {
* Tests comment preview.
*/
function testCommentPreview() {
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
-
// As admin user, configure comment settings.
$this->drupalLogin($this->admin_user);
$this->setCommentPreview(DRUPAL_OPTIONAL);
@@ -83,17 +79,17 @@ function testCommentPreview() {
// As the web user, fill in the comment form and preview the comment.
$edit = array();
$edit['subject'] = $this->randomName(8);
- $edit['comment_body[' . $langcode . '][0][value]'] = $this->randomName(16);
+ $edit['comment_body[0][value]'] = $this->randomName(16);
$this->drupalPost('node/' . $this->node->id(), $edit, t('Preview'));
// Check that the preview is displaying the title and body.
$this->assertTitle(t('Preview comment | Drupal'), 'Page title is "Preview comment".');
$this->assertText($edit['subject'], 'Subject displayed.');
- $this->assertText($edit['comment_body[' . $langcode . '][0][value]'], 'Comment displayed.');
+ $this->assertText($edit['comment_body[0][value]'], 'Comment displayed.');
// Check that the title and body fields are displayed with the correct values.
$this->assertFieldByName('subject', $edit['subject'], 'Subject field displayed.');
- $this->assertFieldByName('comment_body[' . $langcode . '][0][value]', $edit['comment_body[' . $langcode . '][0][value]'], 'Comment field displayed.');
+ $this->assertFieldByName('comment_body[0][value]', $edit['comment_body[0][value]'], 'Comment field displayed.');
// Check that the signature is displaying with the correct text format.
$this->assertLink($test_signature);
@@ -106,7 +102,6 @@ function testCommentPreview() {
* Tests comment edit, preview, and save.
*/
function testCommentEditPreviewSave() {
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
$web_user = $this->drupalCreateUser(array('access comments', 'post comments', 'skip comment approval'));
$this->drupalLogin($this->admin_user);
$this->setCommentPreview(DRUPAL_OPTIONAL);
@@ -117,7 +112,7 @@ function testCommentEditPreviewSave() {
$edit = array();
$date = new DrupalDateTime('2008-03-02 17:23');
$edit['subject'] = $this->randomName(8);
- $edit['comment_body[' . $langcode . '][0][value]'] = $this->randomName(16);
+ $edit['comment_body[0][value]'] = $this->randomName(16);
$edit['name'] = $web_user->getUsername();
$edit['date[date]'] = $date->format('Y-m-d');
$edit['date[time]'] = $date->format('H:i:s');
@@ -125,19 +120,19 @@ function testCommentEditPreviewSave() {
$expected_text_date = format_date($raw_date);
$expected_form_date = $date->format('Y-m-d');
$expected_form_time = $date->format('H:i:s');
- $comment = $this->postComment($this->node, $edit['subject'], $edit['comment_body[' . $langcode . '][0][value]'], TRUE);
+ $comment = $this->postComment($this->node, $edit['subject'], $edit['comment_body[0][value]'], TRUE);
$this->drupalPost('comment/' . $comment->id() . '/edit', $edit, t('Preview'));
// Check that the preview is displaying the subject, comment, author and date correctly.
$this->assertTitle(t('Preview comment | Drupal'), 'Page title is "Preview comment".');
$this->assertText($edit['subject'], 'Subject displayed.');
- $this->assertText($edit['comment_body[' . $langcode . '][0][value]'], 'Comment displayed.');
+ $this->assertText($edit['comment_body[0][value]'], 'Comment displayed.');
$this->assertText($edit['name'], 'Author displayed.');
$this->assertText($expected_text_date, 'Date displayed.');
// Check that the subject, comment, author and date fields are displayed with the correct values.
$this->assertFieldByName('subject', $edit['subject'], 'Subject field displayed.');
- $this->assertFieldByName('comment_body[' . $langcode . '][0][value]', $edit['comment_body[' . $langcode . '][0][value]'], 'Comment field displayed.');
+ $this->assertFieldByName('comment_body[0][value]', $edit['comment_body[0][value]'], 'Comment field displayed.');
$this->assertFieldByName('name', $edit['name'], 'Author field displayed.');
$this->assertFieldByName('date[date]', $edit['date[date]'], 'Date field displayed.');
$this->assertFieldByName('date[time]', $edit['date[time]'], 'Time field displayed.');
@@ -149,7 +144,7 @@ function testCommentEditPreviewSave() {
// Check that the comment fields are correct after loading the saved comment.
$this->drupalGet('comment/' . $comment->id() . '/edit');
$this->assertFieldByName('subject', $edit['subject'], 'Subject field displayed.');
- $this->assertFieldByName('comment_body[' . $langcode . '][0][value]', $edit['comment_body[' . $langcode . '][0][value]'], 'Comment field displayed.');
+ $this->assertFieldByName('comment_body[0][value]', $edit['comment_body[0][value]'], 'Comment field displayed.');
$this->assertFieldByName('name', $edit['name'], 'Author field displayed.');
$this->assertFieldByName('date[date]', $expected_form_date, 'Date field displayed.');
$this->assertFieldByName('date[time]', $expected_form_time, 'Time field displayed.');
@@ -157,7 +152,7 @@ function testCommentEditPreviewSave() {
// Submit the form using the displayed values.
$displayed = array();
$displayed['subject'] = (string) current($this->xpath("//input[@id='edit-subject']/@value"));
- $displayed['comment_body[' . $langcode . '][0][value]'] = (string) current($this->xpath("//textarea[@id='edit-comment-body-" . $langcode . "-0-value']"));
+ $displayed['comment_body[0][value]'] = (string) current($this->xpath("//textarea[@id='edit-comment-body-0-value']"));
$displayed['name'] = (string) current($this->xpath("//input[@id='edit-name']/@value"));
$displayed['date[date]'] = (string) current($this->xpath("//input[@id='edit-date-date']/@value"));
$displayed['date[time]'] = (string) current($this->xpath("//input[@id='edit-date-time']/@value"));
@@ -166,10 +161,9 @@ function testCommentEditPreviewSave() {
// Check that the saved comment is still correct.
$comment_loaded = comment_load($comment->id(), TRUE);
$this->assertEqual($comment_loaded->subject->value, $edit['subject'], 'Subject loaded.');
- $this->assertEqual($comment_loaded->comment_body->value, $edit['comment_body[' . $langcode . '][0][value]'], 'Comment body loaded.');
+ $this->assertEqual($comment_loaded->comment_body->value, $edit['comment_body[0][value]'], 'Comment body loaded.');
$this->assertEqual($comment_loaded->name->value, $edit['name'], 'Name loaded.');
$this->assertEqual($comment_loaded->created->value, $raw_date, 'Date loaded.');
-
}
}
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentTestBase.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentTestBase.php
index 8b9ab47..41e0ba8 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentTestBase.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentTestBase.php
@@ -94,9 +94,8 @@ function setUp() {
* The posted comment or NULL when posted comment was not found.
*/
function postComment($entity, $comment, $subject = '', $contact = NULL) {
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
$edit = array();
- $edit['comment_body[' . $langcode . '][0][value]'] = $comment;
+ $edit['comment_body[0][value]'] = $comment;
$preview_mode = variable_get('comment_preview_article', DRUPAL_OPTIONAL);
$subject_mode = variable_get('comment_subject_field_article', 1);
diff --git a/core/modules/contact/lib/Drupal/contact/Tests/ContactSitewideTest.php b/core/modules/contact/lib/Drupal/contact/Tests/ContactSitewideTest.php
index b524dfa..62a7e16 100644
--- a/core/modules/contact/lib/Drupal/contact/Tests/ContactSitewideTest.php
+++ b/core/modules/contact/lib/Drupal/contact/Tests/ContactSitewideTest.php
@@ -253,14 +253,14 @@ function testSiteWideContact() {
$edit = array(
'subject' => $this->randomName(),
'message' => $this->randomName(),
- $field_name . '[und][0][value]' => $this->randomName(),
+ $field_name . '[0][value]' => $this->randomName(),
);
$this->drupalPost(NULL, $edit, t('Send message'));
$mails = $this->drupalGetMails();
$mail = array_pop($mails);
$this->assertEqual($mail['subject'], t('[@label] @subject', array('@label' => $label, '@subject' => $edit['subject'])));
$this->assertTrue(strpos($mail['body'], $field_label));
- $this->assertTrue(strpos($mail['body'], $edit[$field_name . '[und][0][value]']));
+ $this->assertTrue(strpos($mail['body'], $edit[$field_name . '[0][value]']));
}
/**
diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationUITest.php b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationUITest.php
index 74b779b..5c6665e 100644
--- a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationUITest.php
+++ b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationUITest.php
@@ -78,7 +78,7 @@ protected function assertBasicTranslation() {
$edit = array('source_langcode[source]' => $source_langcode);
$path = $langcode . '/' . $base_path . '/translations/add/' . $default_langcode . '/' . $langcode;
$this->drupalPost($path, $edit, t('Change'));
- $this->assertFieldByXPath("//input[@name=\"{$this->fieldName}[fr][0][value]\"]", $values[$source_langcode][$this->fieldName][0]['value'], 'Source language correctly switched.');
+ $this->assertFieldByXPath("//input[@name=\"{$this->fieldName}[0][value]\"]", $values[$source_langcode][$this->fieldName][0]['value'], 'Source language correctly switched.');
// Add another translation and mark the other ones as outdated.
$values[$langcode] = $this->getNewEntityValues($langcode);
@@ -226,7 +226,7 @@ protected function getEditValues($values, $langcode, $new = FALSE) {
$langcode = $new ? Language::LANGCODE_NOT_SPECIFIED : $langcode;
foreach ($values[$langcode] as $property => $value) {
if (is_array($value)) {
- $edit["{$property}[$langcode][0][value]"] = $value[0]['value'];
+ $edit["{$property}[0][value]"] = $value[0]['value'];
unset($edit[$property]);
}
}
diff --git a/core/modules/datetime/lib/Drupal/datetime/Tests/DatetimeFieldTest.php b/core/modules/datetime/lib/Drupal/datetime/Tests/DatetimeFieldTest.php
index 09d4380..69a4412 100644
--- a/core/modules/datetime/lib/Drupal/datetime/Tests/DatetimeFieldTest.php
+++ b/core/modules/datetime/lib/Drupal/datetime/Tests/DatetimeFieldTest.php
@@ -7,7 +7,6 @@
namespace Drupal\datetime\Tests;
-use Drupal\Core\Language\Language;
use Drupal\simpletest\WebTestBase;
use Drupal\Core\Datetime\DrupalDateTime;
@@ -97,9 +96,8 @@ function testDateField() {
// Display creation form.
$this->drupalGet('entity_test/add');
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
- $this->assertFieldByName("{$field_name}[$langcode][0][value][date]", '', 'Date element found.');
- $this->assertNoFieldByName("{$field_name}[$langcode][0][value][time]", '', 'Time element not found.');
+ $this->assertFieldByName("{$field_name}[0][value][date]", '', 'Date element found.');
+ $this->assertNoFieldByName("{$field_name}[0][value][time]", '', 'Time element not found.');
// Submit a valid date and ensure it is accepted.
$value = '2012-12-31 00:00:00';
@@ -111,7 +109,7 @@ function testDateField() {
$edit = array(
'user_id' => 1,
'name' => $this->randomName(),
- "{$field_name}[$langcode][0][value][date]" => $date->format($date_format),
+ "{$field_name}[0][value][date]" => $date->format($date_format),
);
$this->drupalPost(NULL, $edit, t('Save'));
preg_match('|entity_test/manage/(\d+)/edit|', $this->url, $match);
@@ -168,9 +166,8 @@ function testDatetimeField() {
// Display creation form.
$this->drupalGet('entity_test/add');
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
- $this->assertFieldByName("{$field_name}[$langcode][0][value][date]", '', 'Date element found.');
- $this->assertFieldByName("{$field_name}[$langcode][0][value][time]", '', 'Time element found.');
+ $this->assertFieldByName("{$field_name}[0][value][date]", '', 'Date element found.');
+ $this->assertFieldByName("{$field_name}[0][value][time]", '', 'Time element found.');
// Submit a valid date and ensure it is accepted.
$value = '2012-12-31 00:00:00';
@@ -182,8 +179,8 @@ function testDatetimeField() {
$edit = array(
'user_id' => 1,
'name' => $this->randomName(),
- "{$field_name}[$langcode][0][value][date]" => $date->format($date_format),
- "{$field_name}[$langcode][0][value][time]" => $date->format($time_format),
+ "{$field_name}[0][value][date]" => $date->format($date_format),
+ "{$field_name}[0][value][time]" => $date->format($time_format),
);
$this->drupalPost(NULL, $edit, t('Save'));
preg_match('|entity_test/manage/(\d+)/edit|', $this->url, $match);
@@ -250,21 +247,20 @@ function testDatelistWidget() {
// Display creation form.
$this->drupalGet('entity_test/add');
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
-
- $this->assertFieldByXPath("//*[@id=\"edit-$field_name-$langcode-0-value-year\"]", NULL, 'Year element found.');
- $this->assertOptionSelected("edit-$field_name-$langcode-0-value-year", '', 'No year selected.');
- $this->assertFieldByXPath("//*[@id=\"edit-$field_name-$langcode-0-value-month\"]", NULL, 'Month element found.');
- $this->assertOptionSelected("edit-$field_name-$langcode-0-value-month", '', 'No month selected.');
- $this->assertFieldByXPath("//*[@id=\"edit-$field_name-$langcode-0-value-day\"]", NULL, 'Day element found.');
- $this->assertOptionSelected("edit-$field_name-$langcode-0-value-day", '', 'No day selected.');
- $this->assertFieldByXPath("//*[@id=\"edit-$field_name-$langcode-0-value-hour\"]", NULL, 'Hour element found.');
- $this->assertOptionSelected("edit-$field_name-$langcode-0-value-hour", '', 'No hour selected.');
- $this->assertFieldByXPath("//*[@id=\"edit-$field_name-$langcode-0-value-minute\"]", NULL, 'Minute element found.');
- $this->assertOptionSelected("edit-$field_name-$langcode-0-value-minute", '', 'No minute selected.');
- $this->assertNoFieldByXPath("//*[@id=\"edit-$field_name-$langcode-0-value-second\"]", NULL, 'Second element not found.');
- $this->assertFieldByXPath("//*[@id=\"edit-$field_name-$langcode-0-value-ampm\"]", NULL, 'AMPM element found.');
- $this->assertOptionSelected("edit-$field_name-$langcode-0-value-ampm", '', 'No ampm selected.');
+
+ $this->assertFieldByXPath("//*[@id=\"edit-$field_name-0-value-year\"]", NULL, 'Year element found.');
+ $this->assertOptionSelected("edit-$field_name-0-value-year", '', 'No year selected.');
+ $this->assertFieldByXPath("//*[@id=\"edit-$field_name-0-value-month\"]", NULL, 'Month element found.');
+ $this->assertOptionSelected("edit-$field_name-0-value-month", '', 'No month selected.');
+ $this->assertFieldByXPath("//*[@id=\"edit-$field_name-0-value-day\"]", NULL, 'Day element found.');
+ $this->assertOptionSelected("edit-$field_name-0-value-day", '', 'No day selected.');
+ $this->assertFieldByXPath("//*[@id=\"edit-$field_name-0-value-hour\"]", NULL, 'Hour element found.');
+ $this->assertOptionSelected("edit-$field_name-0-value-hour", '', 'No hour selected.');
+ $this->assertFieldByXPath("//*[@id=\"edit-$field_name-0-value-minute\"]", NULL, 'Minute element found.');
+ $this->assertOptionSelected("edit-$field_name-0-value-minute", '', 'No minute selected.');
+ $this->assertNoFieldByXPath("//*[@id=\"edit-$field_name-0-value-second\"]", NULL, 'Second element not found.');
+ $this->assertFieldByXPath("//*[@id=\"edit-$field_name-0-value-ampm\"]", NULL, 'AMPM element found.');
+ $this->assertOptionSelected("edit-$field_name-0-value-ampm", '', 'No ampm selected.');
// Submit a valid date and ensure it is accepted.
$date_value = array('year' => 2012, 'month' => 12, 'day' => 31, 'hour' => 5, 'minute' => 15);
@@ -276,7 +272,7 @@ function testDatelistWidget() {
// Add the ampm indicator since we are testing 12 hour time.
$date_value['ampm'] = 'am';
foreach ($date_value as $part => $value) {
- $edit["{$field_name}[$langcode][0][value][$part]"] = $value;
+ $edit["{$field_name}[0][value][$part]"] = $value;
}
$this->drupalPost(NULL, $edit, t('Save'));
@@ -284,12 +280,12 @@ function testDatelistWidget() {
$id = $match[1];
$this->assertText(t('entity_test @id has been created.', array('@id' => $id)));
- $this->assertOptionSelected("edit-$field_name-$langcode-0-value-year", '2012', 'Correct year selected.');
- $this->assertOptionSelected("edit-$field_name-$langcode-0-value-month", '12', 'Correct month selected.');
- $this->assertOptionSelected("edit-$field_name-$langcode-0-value-day", '31', 'Correct day selected.');
- $this->assertOptionSelected("edit-$field_name-$langcode-0-value-hour", '5', 'Correct hour selected.');
- $this->assertOptionSelected("edit-$field_name-$langcode-0-value-minute", '15', 'Correct minute selected.');
- $this->assertOptionSelected("edit-$field_name-$langcode-0-value-ampm", 'am', 'Correct ampm selected.');
+ $this->assertOptionSelected("edit-$field_name-0-value-year", '2012', 'Correct year selected.');
+ $this->assertOptionSelected("edit-$field_name-0-value-month", '12', 'Correct month selected.');
+ $this->assertOptionSelected("edit-$field_name-0-value-day", '31', 'Correct day selected.');
+ $this->assertOptionSelected("edit-$field_name-0-value-hour", '5', 'Correct hour selected.');
+ $this->assertOptionSelected("edit-$field_name-0-value-minute", '15', 'Correct minute selected.');
+ $this->assertOptionSelected("edit-$field_name-0-value-ampm", 'am', 'Correct ampm selected.');
}
/**
@@ -311,14 +307,13 @@ function testDefaultValue() {
$date = new DrupalDateTime();
$date_format = 'Y-m-d';
$this->drupalGet('entity_test/add');
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
// See if current date is set. We cannot test for the precise time because
// it may be a few seconds between the time the comparison date is created
// and the form date, so we just test the date and that the time is not
// empty.
- $this->assertFieldByName("{$field_name}[$langcode][0][value][date]", $date->format($date_format), 'Date element found.');
- $this->assertNoFieldByName("{$field_name}[$langcode][0][value][time]", '', 'Time element found.');
+ $this->assertFieldByName("{$field_name}[0][value][date]", $date->format($date_format), 'Date element found.');
+ $this->assertNoFieldByName("{$field_name}[0][value][time]", '', 'Time element found.');
// Set the default value to 'blank'.
$this->instance->settings['default_value'] = 'blank';
@@ -329,8 +324,8 @@ function testDefaultValue() {
$this->drupalGet('entity_test/add');
// See that no date is set.
- $this->assertFieldByName("{$field_name}[$langcode][0][value][date]", '', 'Date element found.');
- $this->assertFieldByName("{$field_name}[$langcode][0][value][time]", '', 'Time element found.');
+ $this->assertFieldByName("{$field_name}[0][value][date]", '', 'Date element found.');
+ $this->assertFieldByName("{$field_name}[0][value][time]", '', 'Time element found.');
}
/**
@@ -345,39 +340,38 @@ function testInvalidField() {
// Display creation form.
$this->drupalGet('entity_test/add');
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
- $this->assertFieldByName("{$field_name}[$langcode][0][value][date]", '', 'Date element found.');
- $this->assertFieldByName("{$field_name}[$langcode][0][value][time]", '', 'Time element found.');
+ $this->assertFieldByName("{$field_name}[0][value][date]", '', 'Date element found.');
+ $this->assertFieldByName("{$field_name}[0][value][time]", '', 'Time element found.');
// Submit invalid dates and ensure they is not accepted.
$date_value = '';
$edit = array(
- "{$field_name}[$langcode][0][value][date]" => $date_value,
- "{$field_name}[$langcode][0][value][time]" => '12:00:00',
+ "{$field_name}[0][value][date]" => $date_value,
+ "{$field_name}[0][value][time]" => '12:00:00',
);
$this->drupalPost(NULL, $edit, t('Save'));
$this->assertText('date is invalid', 'Empty date value has been caught.');
$date_value = 'aaaa-12-01';
$edit = array(
- "{$field_name}[$langcode][0][value][date]" => $date_value,
- "{$field_name}[$langcode][0][value][time]" => '00:00:00',
+ "{$field_name}[0][value][date]" => $date_value,
+ "{$field_name}[0][value][time]" => '00:00:00',
);
$this->drupalPost(NULL, $edit, t('Save'));
$this->assertText('date is invalid', format_string('Invalid year value %date has been caught.', array('%date' => $date_value)));
$date_value = '2012-75-01';
$edit = array(
- "{$field_name}[$langcode][0][value][date]" => $date_value,
- "{$field_name}[$langcode][0][value][time]" => '00:00:00',
+ "{$field_name}[0][value][date]" => $date_value,
+ "{$field_name}[0][value][time]" => '00:00:00',
);
$this->drupalPost(NULL, $edit, t('Save'));
$this->assertText('date is invalid', format_string('Invalid month value %date has been caught.', array('%date' => $date_value)));
$date_value = '2012-12-99';
$edit = array(
- "{$field_name}[$langcode][0][value][date]" => $date_value,
- "{$field_name}[$langcode][0][value][time]" => '00:00:00',
+ "{$field_name}[0][value][date]" => $date_value,
+ "{$field_name}[0][value][time]" => '00:00:00',
);
$this->drupalPost(NULL, $edit, t('Save'));
$this->assertText('date is invalid', format_string('Invalid day value %date has been caught.', array('%date' => $date_value)));
@@ -385,8 +379,8 @@ function testInvalidField() {
$date_value = '2012-12-01';
$time_value = '';
$edit = array(
- "{$field_name}[$langcode][0][value][date]" => $date_value,
- "{$field_name}[$langcode][0][value][time]" => $time_value,
+ "{$field_name}[0][value][date]" => $date_value,
+ "{$field_name}[0][value][time]" => $time_value,
);
$this->drupalPost(NULL, $edit, t('Save'));
$this->assertText('date is invalid', 'Empty time value has been caught.');
@@ -394,8 +388,8 @@ function testInvalidField() {
$date_value = '2012-12-01';
$time_value = '49:00:00';
$edit = array(
- "{$field_name}[$langcode][0][value][date]" => $date_value,
- "{$field_name}[$langcode][0][value][time]" => $time_value,
+ "{$field_name}[0][value][date]" => $date_value,
+ "{$field_name}[0][value][time]" => $time_value,
);
$this->drupalPost(NULL, $edit, t('Save'));
$this->assertText('date is invalid', format_string('Invalid hour value %time has been caught.', array('%time' => $time_value)));
@@ -403,8 +397,8 @@ function testInvalidField() {
$date_value = '2012-12-01';
$time_value = '12:99:00';
$edit = array(
- "{$field_name}[$langcode][0][value][date]" => $date_value,
- "{$field_name}[$langcode][0][value][time]" => $time_value,
+ "{$field_name}[0][value][date]" => $date_value,
+ "{$field_name}[0][value][time]" => $time_value,
);
$this->drupalPost(NULL, $edit, t('Save'));
$this->assertText('date is invalid', format_string('Invalid minute value %time has been caught.', array('%time' => $time_value)));
@@ -412,8 +406,8 @@ function testInvalidField() {
$date_value = '2012-12-01';
$time_value = '12:15:99';
$edit = array(
- "{$field_name}[$langcode][0][value][date]" => $date_value,
- "{$field_name}[$langcode][0][value][time]" => $time_value,
+ "{$field_name}[0][value][date]" => $date_value,
+ "{$field_name}[0][value][time]" => $time_value,
);
$this->drupalPost(NULL, $edit, t('Save'));
$this->assertText('date is invalid', format_string('Invalid second value %time has been caught.', array('%time' => $time_value)));
diff --git a/core/modules/dblog/lib/Drupal/dblog/Tests/DbLogTest.php b/core/modules/dblog/lib/Drupal/dblog/Tests/DbLogTest.php
index c9a34bc..7b63ea0 100644
--- a/core/modules/dblog/lib/Drupal/dblog/Tests/DbLogTest.php
+++ b/core/modules/dblog/lib/Drupal/dblog/Tests/DbLogTest.php
@@ -312,7 +312,6 @@ private function doNode($type) {
// Create a node using the form in order to generate an add content event
// (which is not triggered by drupalCreateNode).
$edit = $this->getContent($type);
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
$title = $edit["title"];
$this->drupalPost('node/add/' . $type, $edit, t('Save'));
$this->assertResponse(200);
@@ -370,20 +369,19 @@ private function doNode($type) {
* Random content needed by various node types.
*/
private function getContent($type) {
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
switch ($type) {
case 'forum':
$content = array(
- "title" => $this->randomName(8),
- "taxonomy_forums[$langcode]" => array(1),
- "body[$langcode][0][value]" => $this->randomName(32),
+ 'title' => $this->randomName(8),
+ 'taxonomy_forums' => array(1),
+ 'body[0][value]' => $this->randomName(32),
);
break;
default:
$content = array(
- "title" => $this->randomName(8),
- "body[$langcode][0][value]" => $this->randomName(32),
+ 'title' => $this->randomName(8),
+ 'body[0][value]' => $this->randomName(32),
);
break;
}
@@ -400,9 +398,8 @@ private function getContent($type) {
* Random content needed by various node types.
*/
private function getContentUpdate($type) {
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
$content = array(
- "body[$langcode][0][value]" => $this->randomName(32),
+ 'body[0][value]' => $this->randomName(32),
);
return $content;
}
diff --git a/core/modules/edit/lib/Drupal/edit/Form/EditFieldForm.php b/core/modules/edit/lib/Drupal/edit/Form/EditFieldForm.php
index 6faa0c9..fd439b0 100644
--- a/core/modules/edit/lib/Drupal/edit/Form/EditFieldForm.php
+++ b/core/modules/edit/lib/Drupal/edit/Form/EditFieldForm.php
@@ -133,9 +133,7 @@ protected function buildEntity(array $form, array &$form_state) {
*/
protected function simplify(array &$form, array &$form_state) {
$field_name = $form_state['field_name'];
- $langcode = $form_state['langcode'];
-
- $widget_element =& $form[$field_name][$langcode];
+ $widget_element =& $form[$field_name]['wrapper'];
// Hide the field label from displaying within the form, because JavaScript
// displays the equivalent label that was provided within an HTML data
diff --git a/core/modules/edit/lib/Drupal/edit/Tests/EditLoadingTest.php b/core/modules/edit/lib/Drupal/edit/Tests/EditLoadingTest.php
index d3e474c..24ef753 100644
--- a/core/modules/edit/lib/Drupal/edit/Tests/EditLoadingTest.php
+++ b/core/modules/edit/lib/Drupal/edit/Tests/EditLoadingTest.php
@@ -105,9 +105,9 @@ function testUserWithoutPermission() {
$edit['form_id'] = 'edit_field_form';
$edit['form_token'] = 'xIOzMjuc-PULKsRn_KxFn7xzNk5Bx7XKXLfQfw1qOnA';
$edit['form_build_id'] = 'form-kVmovBpyX-SJfTT5kY0pjTV35TV-znor--a64dEnMR8';
- $edit['body[und][0][summary]'] = '';
- $edit['body[und][0][value]'] = 'Malicious content.
';
- $edit['body[und][0][format]'] = 'filtered_html';
+ $edit['body[0][summary]'] = '';
+ $edit['body[0][value]'] = 'Malicious content.
';
+ $edit['body[0][format]'] = 'filtered_html';
$edit['op'] = t('Save');
$response = $this->submitFieldForm('node/1/body/und/full', $edit);
// @todo Uncomment the below once https://drupal.org/node/2063303 is fixed.
@@ -188,9 +188,9 @@ function testUserWithPermission() {
$edit['form_id'] = 'edit_field_form';
$edit['form_token'] = $token_match[1];
$edit['form_build_id'] = $build_id_match[1];
- $edit['body[und][0][summary]'] = '';
- $edit['body[und][0][value]'] = 'Fine thanks.
';
- $edit['body[und][0][format]'] = 'filtered_html';
+ $edit['body[0][summary]'] = '';
+ $edit['body[0][value]'] = 'Fine thanks.
';
+ $edit['body[0][format]'] = 'filtered_html';
$edit['op'] = t('Save');
// Submit field form and check response. This should store the
diff --git a/core/modules/editor/lib/Drupal/editor/Tests/EditorLoadingTest.php b/core/modules/editor/lib/Drupal/editor/Tests/EditorLoadingTest.php
index 8de3610..16360eb 100644
--- a/core/modules/editor/lib/Drupal/editor/Tests/EditorLoadingTest.php
+++ b/core/modules/editor/lib/Drupal/editor/Tests/EditorLoadingTest.php
@@ -102,7 +102,7 @@ function testLoading() {
$this->assertTrue($editor_js_present, 'Text Editor JavaScript is present.');
$this->assertTrue(count($body) === 1, 'A body field exists.');
$this->assertTrue(count($format_selector) === 1, 'A single text format selector exists on the page.');
- $specific_format_selector = $this->xpath('//select[contains(@class, "filter-list") and contains(@class, "editor") and @data-editor-for="edit-body-und-0-value"]');
+ $specific_format_selector = $this->xpath('//select[contains(@class, "filter-list") and contains(@class, "editor") and @data-editor-for="edit-body-0-value"]');
$this->assertTrue(count($specific_format_selector) === 1, 'A single text format selector exists on the page and has the "editor" class and a "data-editor-for" attribute with the correct value.');
$this->drupalLogout($this->privileged_user);
@@ -129,7 +129,7 @@ function testLoading() {
$this->assertTrue($editor_js_present, 'Text Editor JavaScript is present.');
$this->assertTrue(count($body) === 1, 'A body field exists.');
$this->assertTrue(count($format_selector) === 0, 'No text format selector exists on the page.');
- $hidden_input = $this->xpath('//input[@type="hidden" and @value="plain_text" and contains(@class, "editor") and @data-editor-for="edit-body-und-0-value"]');
+ $hidden_input = $this->xpath('//input[@type="hidden" and @value="plain_text" and contains(@class, "editor") and @data-editor-for="edit-body-0-value"]');
$this->assertTrue(count($hidden_input) === 1, 'A single text format hidden input exists on the page and has the "editor" class and a "data-editor-for" attribute with the correct value.');
// Create an "article" node that users the full_html text format, then try
@@ -148,7 +148,7 @@ function testLoading() {
$this->assertFalse($editor_settings_present, 'No Text Editor module settings.');
$this->assertFalse($editor_js_present, 'No Text Editor JavaScript.');
$this->assertTrue(count($body) === 1, 'A body field exists.');
- $this->assertFieldByXPath('//textarea[@id="edit-body-und-0-value" and @disabled="disabled"]', t('This field has been disabled because you do not have sufficient permissions to edit it.'), 'Text format access denied message found.');
+ $this->assertFieldByXPath('//textarea[@id="edit-body-0-value" and @disabled="disabled"]', t('This field has been disabled because you do not have sufficient permissions to edit it.'), 'Text format access denied message found.');
$this->assertTrue(count($format_selector) === 0, 'No text format selector exists on the page.');
$hidden_input = $this->xpath('//input[@type="hidden" and contains(@class, "editor")]');
$this->assertTrue(count($hidden_input) === 0, 'A single text format hidden input does not exist on the page.');
@@ -164,7 +164,7 @@ protected function getThingsToCheck() {
// Editor.module's JS present.
isset($settings['ajaxPageState']['js']['core/modules/editor/js/editor.js']),
// Body field.
- $this->xpath('//textarea[@id="edit-body-und-0-value"]'),
+ $this->xpath('//textarea[@id="edit-body-0-value"]'),
// Format selector.
$this->xpath('//select[contains(@class, "filter-list")]'),
);
diff --git a/core/modules/email/lib/Drupal/email/Tests/EmailFieldTest.php b/core/modules/email/lib/Drupal/email/Tests/EmailFieldTest.php
index d051ba2..8ee08c0 100644
--- a/core/modules/email/lib/Drupal/email/Tests/EmailFieldTest.php
+++ b/core/modules/email/lib/Drupal/email/Tests/EmailFieldTest.php
@@ -92,8 +92,7 @@ function testEmailField() {
// Display creation form.
$this->drupalGet('entity_test/add');
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
- $this->assertFieldByName("{$field_name}[$langcode][0][value]", '', 'Widget found.');
+ $this->assertFieldByName("{$field_name}[0][value]", '', 'Widget found.');
$this->assertRaw('placeholder="example@example.com"');
// Submit a valid e-mail address and ensure it is accepted.
@@ -101,7 +100,7 @@ function testEmailField() {
$edit = array(
'user_id' => 1,
'name' => $this->randomName(),
- "{$field_name}[$langcode][0][value]" => $value,
+ "{$field_name}[0][value]" => $value,
);
$this->drupalPost(NULL, $edit, t('Save'));
preg_match('|entity_test/manage/(\d+)/edit|', $this->url, $match);
diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAutoCreateTest.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAutoCreateTest.php
index d81dc5e..1d6c0a2 100644
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAutoCreateTest.php
+++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAutoCreateTest.php
@@ -96,7 +96,7 @@ public function testAutoCreate() {
$edit = array(
'title' => $this->randomName(),
- 'test_field[und][0][target_id]' => $new_title,
+ 'test_field[0][target_id]' => $new_title,
);
$this->drupalPost("node/add/$this->referencing_type", $edit, 'Save');
diff --git a/core/modules/field/field.deprecated.inc b/core/modules/field/field.deprecated.inc
index 25677ac..35a3436 100644
--- a/core/modules/field/field.deprecated.inc
+++ b/core/modules/field/field.deprecated.inc
@@ -488,10 +488,9 @@ function field_read_instances($conditions = array(), $include_additional = array
* // The '#language' key holds the same value of $langcode and it is used
* // to access the field sub-array when $langcode is unknown.
* 'field_foo' => array(
- * '#tree' => TRUE,
- * '#field_name' => The name of the field,
- * '#language' => $langcode,
- * $langcode => array(
+ * '#access' => TRUE if the current user has 'edit' grants for the field,
+ * FALSE if not.
+ * 'wrapper' => array(
* '#field_name' => The name of the field,
* '#language' => $langcode,
* '#field_parents' => The 'parents' space for the field in the form,
diff --git a/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetBase.php b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetBase.php
index 4cf4556..e27e6f7 100644
--- a/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetBase.php
+++ b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetBase.php
@@ -58,13 +58,8 @@ public function __construct($plugin_id, array $plugin_definition, FieldDefinitio
*/
public function form(EntityInterface $entity, $langcode, FieldInterface $items, array &$form, array &$form_state, $get_delta = NULL) {
$field_name = $this->fieldDefinition->getFieldName();
-
$parents = $form['#parents'];
- $addition = array(
- $field_name => array(),
- );
-
// Store field information in $form_state.
if (!field_form_get_state($parents, $field_name, $langcode, $form_state)) {
$field_state = array(
@@ -110,19 +105,6 @@ public function form(EntityInterface $entity, $langcode, FieldInterface $items,
$elements = $this->formMultipleElements($entity, $items, $langcode, $form, $form_state);
}
- // Also aid in theming of field widgets by rendering a classified
- // container.
- $addition[$field_name] = array(
- '#type' => 'container',
- '#attributes' => array(
- 'class' => array(
- 'field-type-' . drupal_html_class($this->fieldDefinition->getFieldType()),
- 'field-name-' . drupal_html_class($field_name),
- 'field-widget-' . drupal_html_class($this->getPluginId()),
- ),
- ),
- );
-
// Populate the 'array_parents' information in $form_state['field'] after
// the form is built, so that we catch changes in the form structure performed
// in alter() hooks.
@@ -130,17 +112,29 @@ public function form(EntityInterface $entity, $langcode, FieldInterface $items,
$elements['#field_name'] = $field_name;
$elements['#language'] = $langcode;
$elements['#field_parents'] = $parents;
-
- $addition[$field_name] += array(
- '#tree' => TRUE,
- // The '#language' key can be used to access the field's form element
- // when $langcode is unknown.
- '#language' => $langcode,
- $langcode => $elements,
- '#access' => $this->checkFieldAccess('edit', $entity),
+ // Enforce the structure of submitted values.
+ $elements['#parents'] = array_merge($parents, array($field_name));
+ // Most widgets need their internal structure preserved in submitted values.
+ $elements += array('#tree' => TRUE);
+
+ $return = array(
+ // @todo should we include the $field_name ourselves ?
+ $field_name => array(
+ // Aid in theming of widgets by rendering a classified container.
+ '#type' => 'container',
+ '#attributes' => array(
+ 'class' => array(
+ 'field-type-' . drupal_html_class($this->fieldDefinition->getFieldType()),
+ 'field-name-' . drupal_html_class($field_name),
+ 'field-widget-' . drupal_html_class($this->getPluginId()),
+ ),
+ ),
+ '#access' => $this->checkFieldAccess('edit', $entity),
+ 'wrapper' => $elements,
+ ),
);
- return $addition;
+ return $return;
}
/**
@@ -285,7 +279,7 @@ public function extractFormValues(EntityInterface $entity, $langcode, FieldInter
$field_name = $this->fieldDefinition->getFieldName();
// Extract the values from $form_state['values'].
- $path = array_merge($form['#parents'], array($field_name, $langcode));
+ $path = array_merge($form['#parents'], array($field_name));
$key_exists = NULL;
$values = NestedArray::getValue($form_state['values'], $path, $key_exists);
diff --git a/core/modules/field/lib/Drupal/field/Tests/FieldAttachOtherTest.php b/core/modules/field/lib/Drupal/field/Tests/FieldAttachOtherTest.php
index 6322522..8e94cc2 100644
--- a/core/modules/field/lib/Drupal/field/Tests/FieldAttachOtherTest.php
+++ b/core/modules/field/lib/Drupal/field/Tests/FieldAttachOtherTest.php
@@ -49,8 +49,6 @@ function testFieldAttachView() {
$entity_type = 'entity_test';
$entity_init = entity_create($entity_type, array());
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
- $options = array('field_name' => $this->field_name_2);
// Populate values to be displayed.
$values = $this->_generateTestFieldValues($this->field['cardinality']);
@@ -330,7 +328,6 @@ function testFieldAttachForm() {
$entity_type = 'entity_test';
$entity = entity_create($entity_type, array('id' => 1, 'revision_id' => 1, 'type' => $this->instance['bundle']));
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
// When generating form for all fields.
$form = array();
@@ -338,15 +335,15 @@ function testFieldAttachForm() {
$form_state['form_display'] = entity_get_form_display($entity_type, $this->instance['bundle'], 'default');
field_attach_form($entity, $form, $form_state);
- $this->assertEqual($form[$this->field_name][$langcode]['#title'], $this->instance['label'], "First field's form title is {$this->instance['label']}");
- $this->assertEqual($form[$this->field_name_2][$langcode]['#title'], $this->instance_2['label'], "Second field's form title is {$this->instance_2['label']}");
+ $this->assertEqual($form[$this->field_name]['wrapper']['#title'], $this->instance['label'], "First field's form title is {$this->instance['label']}");
+ $this->assertEqual($form[$this->field_name_2]['wrapper']['#title'], $this->instance_2['label'], "Second field's form title is {$this->instance_2['label']}");
for ($delta = 0; $delta < $this->field['cardinality']; $delta++) {
// field_test_widget uses 'textfield'
- $this->assertEqual($form[$this->field_name][$langcode][$delta]['value']['#type'], 'textfield', "First field's form delta $delta widget is textfield");
+ $this->assertEqual($form[$this->field_name]['wrapper'][$delta]['value']['#type'], 'textfield', "First field's form delta $delta widget is textfield");
}
for ($delta = 0; $delta < $this->field_2['cardinality']; $delta++) {
// field_test_widget uses 'textfield'
- $this->assertEqual($form[$this->field_name_2][$langcode][$delta]['value']['#type'], 'textfield', "Second field's form delta $delta widget is textfield");
+ $this->assertEqual($form[$this->field_name_2]['wrapper'][$delta]['value']['#type'], 'textfield', "Second field's form delta $delta widget is textfield");
}
// When generating form for a single field (the second field).
@@ -357,10 +354,10 @@ function testFieldAttachForm() {
field_attach_form($entity, $form, $form_state, NULL, $options);
$this->assertFalse(isset($form[$this->field_name]), 'The first field does not exist in the form');
- $this->assertEqual($form[$this->field_name_2][$langcode]['#title'], $this->instance_2['label'], "Second field's form title is {$this->instance_2['label']}");
+ $this->assertEqual($form[$this->field_name_2]['wrapper']['#title'], $this->instance_2['label'], "Second field's form title is {$this->instance_2['label']}");
for ($delta = 0; $delta < $this->field_2['cardinality']; $delta++) {
// field_test_widget uses 'textfield'
- $this->assertEqual($form[$this->field_name_2][$langcode][$delta]['value']['#type'], 'textfield', "Second field's form delta $delta widget is textfield");
+ $this->assertEqual($form[$this->field_name_2]['wrapper'][$delta]['value']['#type'], 'textfield', "Second field's form delta $delta widget is textfield");
}
}
@@ -372,7 +369,6 @@ function testFieldAttachExtractFormValues() {
$entity_type = 'entity_test';
$entity_init = entity_create($entity_type, array('id' => 1, 'revision_id' => 1, 'type' => $this->instance['bundle']));
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
// Build the form for all fields.
$form = array();
@@ -413,8 +409,8 @@ function testFieldAttachExtractFormValues() {
// Pretend the form has been built.
drupal_prepare_form('field_test_entity_form', $form, $form_state);
drupal_process_form('field_test_entity_form', $form, $form_state);
- $form_state['values'][$this->field_name][$langcode] = $values;
- $form_state['values'][$this->field_name_2][$langcode] = $values_2;
+ $form_state['values'][$this->field_name] = $values;
+ $form_state['values'][$this->field_name_2] = $values_2;
// Call field_attach_extract_form_values() for all fields.
$entity = clone($entity_init);
diff --git a/core/modules/field/lib/Drupal/field/Tests/FieldTestBase.php b/core/modules/field/lib/Drupal/field/Tests/FieldTestBase.php
index 1287cb0..c2acc89 100644
--- a/core/modules/field/lib/Drupal/field/Tests/FieldTestBase.php
+++ b/core/modules/field/lib/Drupal/field/Tests/FieldTestBase.php
@@ -8,8 +8,10 @@
namespace Drupal\field\Tests;
use Drupal\Core\Entity\EntityInterface;
+use Drupal\Core\Language\Language;
use Drupal\simpletest\WebTestBase;
+
/**
* Parent class for Field API tests.
*/
@@ -41,14 +43,14 @@ function _generateTestFieldValues($cardinality) {
* The entity to test.
* @param $field_name
* The name of the field to test
- * @param $langcode
- * The language code for the values.
* @param $expected_values
* The array of expected values.
+ * @param $langcode
+ * The language code for the values.
* @param $column
* (Optional) the name of the column to check.
*/
- function assertFieldValues(EntityInterface $entity, $field_name, $langcode, $expected_values, $column = 'value') {
+ function assertFieldValues(EntityInterface $entity, $field_name, $expected_values, $langcode = Language::LANGCODE_NOT_SPECIFIED, $column = 'value') {
// Re-load the entity to make sure we have the latest changes.
entity_get_controller($entity->entityType())->resetCache(array($entity->id()));
$e = entity_load($entity->entityType(), $entity->id());
diff --git a/core/modules/field/lib/Drupal/field/Tests/FieldUnitTestBase.php b/core/modules/field/lib/Drupal/field/Tests/FieldUnitTestBase.php
index 26aa3e9..2bad37d 100644
--- a/core/modules/field/lib/Drupal/field/Tests/FieldUnitTestBase.php
+++ b/core/modules/field/lib/Drupal/field/Tests/FieldUnitTestBase.php
@@ -8,6 +8,7 @@
namespace Drupal\field\Tests;
use Drupal\Core\Entity\EntityInterface;
+use Drupal\Core\Language\Language;
use Drupal\simpletest\DrupalUnitTestBase;
/**
@@ -138,14 +139,14 @@ function _generateTestFieldValues($cardinality) {
* The entity to test.
* @param $field_name
* The name of the field to test
- * @param $langcode
- * The language code for the values.
* @param $expected_values
* The array of expected values.
+ * @param $langcode
+ * The language code for the values.
* @param $column
* (Optional) the name of the column to check.
*/
- function assertFieldValues(EntityInterface $entity, $field_name, $langcode, $expected_values, $column = 'value') {
+ function assertFieldValues(EntityInterface $entity, $field_name, $expected_values, $langcode = Language::LANGCODE_NOT_SPECIFIED, $column = 'value') {
// Re-load the entity to make sure we have the latest changes.
entity_get_controller($entity->entityType())->resetCache(array($entity->id()));
$e = entity_load($entity->entityType(), $entity->id());
diff --git a/core/modules/field/lib/Drupal/field/Tests/FormTest.php b/core/modules/field/lib/Drupal/field/Tests/FormTest.php
index 2a8f43c..9e68eaa 100644
--- a/core/modules/field/lib/Drupal/field/Tests/FormTest.php
+++ b/core/modules/field/lib/Drupal/field/Tests/FormTest.php
@@ -7,9 +7,6 @@
namespace Drupal\field\Tests;
-use Drupal\Core\Entity\EntityInterface;
-use Drupal\Core\Language\Language;
-
class FormTest extends FieldTestBase {
/**
@@ -100,7 +97,6 @@ function testFieldFormSingle() {
entity_get_form_display($this->instance['entity_type'], $this->instance['bundle'], 'default')
->setComponent($field_name)
->save();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
// Display creation form.
$this->drupalGet('entity_test/add');
@@ -108,8 +104,8 @@ function testFieldFormSingle() {
// Create token value expected for description.
$token_description = check_plain(\Drupal::config('system.site')->get('name')) . '_description';
$this->assertText($token_description, 'Token replacement for description is displayed');
- $this->assertFieldByName("{$field_name}[$langcode][0][value]", '', 'Widget is displayed');
- $this->assertNoField("{$field_name}[$langcode][1][value]", 'No extraneous widget is displayed');
+ $this->assertFieldByName("{$field_name}[0][value]", '', 'Widget is displayed');
+ $this->assertNoField("{$field_name}[1][value]", 'No extraneous widget is displayed');
// Check that hook_field_widget_form_alter() does not believe this is the
// default value form.
@@ -119,7 +115,7 @@ function testFieldFormSingle() {
$edit = array(
'user_id' => 1,
'name' => $this->randomName(),
- "{$field_name}[$langcode][0][value]" => -1
+ "{$field_name}[0][value]" => -1
);
$this->drupalPost(NULL, $edit, t('Save'));
$this->assertRaw(t('%name does not accept the value -1.', array('%name' => $this->instance['label'])), 'Field validation fails with invalid input.');
@@ -130,7 +126,7 @@ function testFieldFormSingle() {
$edit = array(
'user_id' => 1,
'name' => $this->randomName(),
- "{$field_name}[$langcode][0][value]" => $value,
+ "{$field_name}[0][value]" => $value,
);
$this->drupalPost(NULL, $edit, t('Save'));
preg_match('|entity_test/manage/(\d+)/edit|', $this->url, $match);
@@ -141,15 +137,15 @@ function testFieldFormSingle() {
// Display edit form.
$this->drupalGet('entity_test/manage/' . $id . '/edit');
- $this->assertFieldByName("{$field_name}[$langcode][0][value]", $value, 'Widget is displayed with the correct default value');
- $this->assertNoField("{$field_name}[$langcode][1][value]", 'No extraneous widget is displayed');
+ $this->assertFieldByName("{$field_name}[0][value]", $value, 'Widget is displayed with the correct default value');
+ $this->assertNoField("{$field_name}[1][value]", 'No extraneous widget is displayed');
// Update the entity.
$value = mt_rand(1, 127);
$edit = array(
'user_id' => 1,
'name' => $this->randomName(),
- "{$field_name}[$langcode][0][value]" => $value,
+ "{$field_name}[0][value]" => $value,
);
$this->drupalPost(NULL, $edit, t('Save'));
$this->assertText(t('entity_test @id has been updated.', array('@id' => $id)), 'Entity was updated');
@@ -162,7 +158,7 @@ function testFieldFormSingle() {
$edit = array(
'user_id' => 1,
'name' => $this->randomName(),
- "{$field_name}[$langcode][0][value]" => $value
+ "{$field_name}[0][value]" => $value
);
$this->drupalPost('entity_test/manage/' . $id . '/edit', $edit, t('Save'));
$this->assertText(t('entity_test @id has been updated.', array('@id' => $id)), 'Entity was updated');
@@ -185,18 +181,17 @@ function testFieldFormDefaultValue() {
entity_get_form_display($this->instance['entity_type'], $this->instance['bundle'], 'default')
->setComponent($field_name)
->save();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
// Display creation form.
$this->drupalGet('entity_test/add');
// Test that the default value is displayed correctly.
- $this->assertFieldByXpath("//input[@name='{$field_name}[$langcode][0][value]' and @value='$default']");
+ $this->assertFieldByXpath("//input[@name='{$field_name}[0][value]' and @value='$default']");
// Try to submit an empty value.
$edit = array(
'user_id' => 1,
'name' => $this->randomName(),
- "{$field_name}[$langcode][0][value]" => '',
+ "{$field_name}[0][value]" => '',
);
$this->drupalPost(NULL, $edit, t('Save'));
preg_match('|entity_test/manage/(\d+)/edit|', $this->url, $match);
@@ -216,7 +211,6 @@ function testFieldFormSingleRequired() {
entity_get_form_display($this->instance['entity_type'], $this->instance['bundle'], 'default')
->setComponent($field_name)
->save();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
// Submit with missing required value.
$edit = array();
@@ -228,7 +222,7 @@ function testFieldFormSingleRequired() {
$edit = array(
'user_id' => 1,
'name' => $this->randomName(),
- "{$field_name}[$langcode][0][value]" => $value,
+ "{$field_name}[0][value]" => $value,
);
$this->drupalPost(NULL, $edit, t('Save'));
preg_match('|entity_test/manage/(\d+)/edit|', $this->url, $match);
@@ -242,7 +236,7 @@ function testFieldFormSingleRequired() {
$edit = array(
'user_id' => 1,
'name' => $this->randomName(),
- "{$field_name}[$langcode][0][value]" => $value,
+ "{$field_name}[0][value]" => $value,
);
$this->drupalPost('entity_test/manage/' . $id . '/edit', $edit, t('Save'));
$this->assertRaw(t('!name field is required.', array('!name' => $this->instance['label'])), 'Required field with no value fails validation');
@@ -265,18 +259,17 @@ function testFieldFormUnlimited() {
entity_get_form_display($this->instance['entity_type'], $this->instance['bundle'], 'default')
->setComponent($field_name)
->save();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
// Display creation form -> 1 widget.
$this->drupalGet('entity_test/add');
- $this->assertFieldByName("{$field_name}[$langcode][0][value]", '', 'Widget 1 is displayed');
- $this->assertNoField("{$field_name}[$langcode][1][value]", 'No extraneous widget is displayed');
+ $this->assertFieldByName("{$field_name}[0][value]", '', 'Widget 1 is displayed');
+ $this->assertNoField("{$field_name}[1][value]", 'No extraneous widget is displayed');
// Press 'add more' button -> 2 widgets.
$this->drupalPost(NULL, array(), t('Add another item'));
- $this->assertFieldByName("{$field_name}[$langcode][0][value]", '', 'Widget 1 is displayed');
- $this->assertFieldByName("{$field_name}[$langcode][1][value]", '', 'New widget is displayed');
- $this->assertNoField("{$field_name}[$langcode][2][value]", 'No extraneous widget is displayed');
+ $this->assertFieldByName("{$field_name}[0][value]", '', 'Widget 1 is displayed');
+ $this->assertFieldByName("{$field_name}[1][value]", '', 'New widget is displayed');
+ $this->assertNoField("{$field_name}[2][value]", 'No extraneous widget is displayed');
// TODO : check that non-field inpurs are preserved ('title')...
// Yet another time so that we can play with more values -> 3 widgets.
@@ -298,8 +291,8 @@ function testFieldFormUnlimited() {
do {
$weight = mt_rand(-$delta_range, $delta_range);
} while (in_array($weight, $weights));
- $edit["{$field_name}[$langcode][$delta][value]"] = $value;
- $edit["{$field_name}[$langcode][$delta][_weight]"] = $weight;
+ $edit["{$field_name}[$delta][value]"] = $value;
+ $edit["{$field_name}[$delta][_weight]"] = $weight;
// We'll need three slightly different formats to check the values.
$values[$delta] = $value;
$weights[$delta] = $weight;
@@ -310,15 +303,15 @@ function testFieldFormUnlimited() {
// Press 'add more' button -> 4 widgets
$this->drupalPost(NULL, $edit, t('Add another item'));
for ($delta = 0; $delta <= $delta_range; $delta++) {
- $this->assertFieldByName("{$field_name}[$langcode][$delta][value]", $values[$delta], "Widget $delta is displayed and has the right value");
- $this->assertFieldByName("{$field_name}[$langcode][$delta][_weight]", $weights[$delta], "Widget $delta has the right weight");
+ $this->assertFieldByName("{$field_name}[$delta][value]", $values[$delta], "Widget $delta is displayed and has the right value");
+ $this->assertFieldByName("{$field_name}[$delta][_weight]", $weights[$delta], "Widget $delta has the right weight");
}
ksort($pattern);
$pattern = implode('.*', array_values($pattern));
$this->assertPattern("|$pattern|s", 'Widgets are displayed in the correct order');
- $this->assertFieldByName("{$field_name}[$langcode][$delta][value]", '', "New widget is displayed");
- $this->assertFieldByName("{$field_name}[$langcode][$delta][_weight]", $delta, "New widget has the right weight");
- $this->assertNoField("{$field_name}[$langcode][" . ($delta + 1) . '][value]', 'No extraneous widget is displayed');
+ $this->assertFieldByName("{$field_name}[$delta][value]", '', "New widget is displayed");
+ $this->assertFieldByName("{$field_name}[$delta][_weight]", $delta, "New widget has the right weight");
+ $this->assertNoField("{$field_name}[" . ($delta + 1) . '][value]', 'No extraneous widget is displayed');
// Submit the form and create the entity.
$this->drupalPost(NULL, $edit, t('Save'));
@@ -352,7 +345,6 @@ function testFieldFormMultivalueWithRequiredRadio() {
entity_get_form_display($this->instance['entity_type'], $this->instance['bundle'], 'default')
->setComponent($field_name)
->save();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
// Add a required radio field.
entity_create('field_entity', array(
@@ -386,9 +378,9 @@ function testFieldFormMultivalueWithRequiredRadio() {
$this->assertNoFieldByXpath('//div[contains(@class, "error")]', FALSE, 'No error message is displayed.');
// Verify that the widget is added.
- $this->assertFieldByName("{$field_name}[$langcode][0][value]", '', 'Widget 1 is displayed');
- $this->assertFieldByName("{$field_name}[$langcode][1][value]", '', 'New widget is displayed');
- $this->assertNoField("{$field_name}[$langcode][2][value]", 'No extraneous widget is displayed');
+ $this->assertFieldByName("{$field_name}[0][value]", '', 'Widget 1 is displayed');
+ $this->assertFieldByName("{$field_name}[1][value]", '', 'New widget is displayed');
+ $this->assertNoField("{$field_name}[2][value]", 'No extraneous widget is displayed');
}
function testFieldFormJSAddMore() {
@@ -400,7 +392,6 @@ function testFieldFormJSAddMore() {
entity_get_form_display($this->instance['entity_type'], $this->instance['bundle'], 'default')
->setComponent($field_name)
->save();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
// Display creation form -> 1 widget.
$this->drupalGet('entity_test/add');
@@ -423,8 +414,8 @@ function testFieldFormJSAddMore() {
do {
$weight = mt_rand(-$delta_range, $delta_range);
} while (in_array($weight, $weights));
- $edit["{$field_name}[$langcode][$delta][value]"] = $value;
- $edit["{$field_name}[$langcode][$delta][_weight]"] = $weight;
+ $edit["{$field_name}[$delta][value]"] = $value;
+ $edit["{$field_name}[$delta][_weight]"] = $weight;
// We'll need three slightly different formats to check the values.
$values[$delta] = $value;
$weights[$delta] = $weight;
@@ -437,15 +428,15 @@ function testFieldFormJSAddMore() {
$this->content = $commands[1]['data'];
for ($delta = 0; $delta <= $delta_range; $delta++) {
- $this->assertFieldByName("{$field_name}[$langcode][$delta][value]", $values[$delta], "Widget $delta is displayed and has the right value");
- $this->assertFieldByName("{$field_name}[$langcode][$delta][_weight]", $weights[$delta], "Widget $delta has the right weight");
+ $this->assertFieldByName("{$field_name}[$delta][value]", $values[$delta], "Widget $delta is displayed and has the right value");
+ $this->assertFieldByName("{$field_name}[$delta][_weight]", $weights[$delta], "Widget $delta has the right weight");
}
ksort($pattern);
$pattern = implode('.*', array_values($pattern));
$this->assertPattern("|$pattern|s", 'Widgets are displayed in the correct order');
- $this->assertFieldByName("{$field_name}[$langcode][$delta][value]", '', "New widget is displayed");
- $this->assertFieldByName("{$field_name}[$langcode][$delta][_weight]", $delta, "New widget has the right weight");
- $this->assertNoField("{$field_name}[$langcode][" . ($delta + 1) . '][value]', 'No extraneous widget is displayed');
+ $this->assertFieldByName("{$field_name}[$delta][value]", '', "New widget is displayed");
+ $this->assertFieldByName("{$field_name}[$delta][_weight]", $delta, "New widget has the right weight");
+ $this->assertNoField("{$field_name}[" . ($delta + 1) . '][value]', 'No extraneous widget is displayed');
}
/**
@@ -464,17 +455,16 @@ function testFieldFormMultipleWidget() {
'type' => 'test_field_widget_multiple',
))
->save();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
// Display creation form.
$this->drupalGet('entity_test/add');
- $this->assertFieldByName("{$field_name}[$langcode]", '', 'Widget is displayed.');
+ $this->assertFieldByName($field_name, '', 'Widget is displayed.');
// Create entity with three values.
$edit = array(
'user_id' => 1,
'name' => $this->randomName(),
- "{$field_name}[$langcode]" => '1, 2, 3',
+ $field_name => '1, 2, 3',
);
$this->drupalPost(NULL, $edit, t('Save'));
preg_match('|entity_test/manage/(\d+)/edit|', $this->url, $match);
@@ -482,18 +472,18 @@ function testFieldFormMultipleWidget() {
// Check that the values were saved.
$entity_init = entity_load('entity_test', $id);
- $this->assertFieldValues($entity_init, $field_name, $langcode, array(1, 2, 3));
+ $this->assertFieldValues($entity_init, $field_name, array(1, 2, 3));
// Display the form, check that the values are correctly filled in.
$this->drupalGet('entity_test/manage/' . $id . '/edit');
- $this->assertFieldByName("{$field_name}[$langcode]", '1, 2, 3', 'Widget is displayed.');
+ $this->assertFieldByName($field_name, '1, 2, 3', 'Widget is displayed.');
// Submit the form with more values than the field accepts.
- $edit = array("{$field_name}[$langcode]" => '1, 2, 3, 4, 5');
+ $edit = array($field_name => '1, 2, 3, 4, 5');
$this->drupalPost(NULL, $edit, t('Save'));
$this->assertRaw('this field cannot hold more than 4 values', 'Form validation failed.');
// Check that the field values were not submitted.
- $this->assertFieldValues($entity_init, $field_name, $langcode, array(1, 2, 3));
+ $this->assertFieldValues($entity_init, $field_name, array(1, 2, 3));
}
/**
@@ -534,8 +524,6 @@ function testFieldFormAccess() {
->setComponent($field_name_no_access)
->save();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
-
// Test that the form structure includes full information for each delta
// apart from #access.
$entity = entity_create($entity_type, array('id' => 0, 'revision_id' => 0));
@@ -545,18 +533,18 @@ function testFieldFormAccess() {
$form_state['form_display'] = entity_get_form_display($entity_type, $entity_type, 'default');
field_attach_form($entity, $form, $form_state);
- $this->assertEqual($form[$field_name_no_access][$langcode][0]['value']['#entity_type'], $entity_type, 'The correct entity type is set in the field structure.');
- $this->assertFalse($form[$field_name_no_access]['#access'], 'Field #access is FALSE for the field without edit access.');
+ $this->assertEqual($form[$field_name_no_access]['wrapper'][0]['value']['#entity_type'], $entity_type, 'The correct entity type is set in the field structure.');
+ $this->assertFalse($form[$field_name_no_access]['wrapper']['#access'], 'Field #access is FALSE for the field without edit access.');
// Display creation form.
$this->drupalGet($entity_type . '/add');
- $this->assertNoFieldByName("{$field_name_no_access}[$langcode][0][value]", '', 'Widget is not displayed if field access is denied.');
+ $this->assertNoFieldByName("{$field_name_no_access}[0][value]", '', 'Widget is not displayed if field access is denied.');
// Create entity.
$edit = array(
'user_id' => 1,
'name' => $this->randomName(),
- "{$field_name}[$langcode][0][value]" => 1,
+ "{$field_name}[0][value]" => 1,
);
$this->drupalPost(NULL, $edit, t('Save'));
preg_match("|$entity_type/manage/(\d+)/edit|", $this->url, $match);
@@ -571,7 +559,7 @@ function testFieldFormAccess() {
$edit = array(
'user_id' => 1,
'name' => $this->randomName(),
- "{$field_name}[$langcode][0][value]" => 2,
+ "{$field_name}[0][value]" => 2,
'revision' => TRUE,
);
$this->drupalPost($entity_type . '/manage/' . $id . '/edit', $edit, t('Save'));
@@ -608,14 +596,13 @@ function testFieldFormHiddenWidget() {
'type' => 'hidden',
))
->save();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
// Display the entity creation form.
$this->drupalGet($entity_type . '/add');
// Create an entity and test that the default value is assigned correctly to
// the field that uses the hidden widget.
- $this->assertNoField("{$field_name}[$langcode][0][value]", 'The hidden widget is not displayed');
+ $this->assertNoField("{$field_name}[0][value]", 'The hidden widget is not displayed');
$this->drupalPost(NULL, array('user_id' => 1, 'name' => $this->randomName()), t('Save'));
preg_match('|' . $entity_type . '/manage/(\d+)/edit|', $this->url, $match);
$id = $match[1];
@@ -635,11 +622,11 @@ function testFieldFormHiddenWidget() {
// Display edit form.
$this->drupalGet($entity_type . '/manage/' . $id . '/edit');
- $this->assertFieldByName("{$field_name}[$langcode][0][value]", 99, 'Widget is displayed with the correct default value');
+ $this->assertFieldByName("{$field_name}[0][value]", 99, 'Widget is displayed with the correct default value');
// Update the entity.
$value = mt_rand(1, 127);
- $edit = array("{$field_name}[$langcode][0][value]" => $value);
+ $edit = array("{$field_name}[0][value]" => $value);
$this->drupalPost(NULL, $edit, t('Save'));
$this->assertText(t('entity_test_rev @id has been updated.', array('@id' => $id)), 'Entity was updated');
entity_get_controller($entity_type)->resetCache(array($id));
diff --git a/core/modules/field/lib/Drupal/field/Tests/NestedFormTest.php b/core/modules/field/lib/Drupal/field/Tests/NestedFormTest.php
index e812ff5..c9cc2b5 100644
--- a/core/modules/field/lib/Drupal/field/Tests/NestedFormTest.php
+++ b/core/modules/field/lib/Drupal/field/Tests/NestedFormTest.php
@@ -7,9 +7,6 @@
namespace Drupal\field\Tests;
-use Drupal\Core\Language\Language;
-use Drupal\Core\Entity\EntityInterface;
-
class NestedFormTest extends FieldTestBase {
/**
@@ -93,57 +90,57 @@ function testNestedFieldForm() {
// Display the 'combined form'.
$this->drupalGet('test-entity/nested/1/2');
- $this->assertFieldByName('field_single[und][0][value]', 0, 'Entity 1: field_single value appears correctly is the form.');
- $this->assertFieldByName('field_unlimited[und][0][value]', 1, 'Entity 1: field_unlimited value 0 appears correctly is the form.');
- $this->assertFieldByName('entity_2[field_single][und][0][value]', 10, 'Entity 2: field_single value appears correctly is the form.');
- $this->assertFieldByName('entity_2[field_unlimited][und][0][value]', 11, 'Entity 2: field_unlimited value 0 appears correctly is the form.');
+ $this->assertFieldByName('field_single[0][value]', 0, 'Entity 1: field_single value appears correctly is the form.');
+ $this->assertFieldByName('field_unlimited[0][value]', 1, 'Entity 1: field_unlimited value 0 appears correctly is the form.');
+ $this->assertFieldByName('entity_2[field_single][0][value]', 10, 'Entity 2: field_single value appears correctly is the form.');
+ $this->assertFieldByName('entity_2[field_unlimited][0][value]', 11, 'Entity 2: field_unlimited value 0 appears correctly is the form.');
// Submit the form and check that the entities are updated accordingly.
$edit = array(
- 'field_single[und][0][value]' => 1,
- 'field_unlimited[und][0][value]' => 2,
- 'field_unlimited[und][1][value]' => 3,
- 'entity_2[field_single][und][0][value]' => 11,
- 'entity_2[field_unlimited][und][0][value]' => 12,
- 'entity_2[field_unlimited][und][1][value]' => 13,
+ 'field_single[0][value]' => 1,
+ 'field_unlimited[0][value]' => 2,
+ 'field_unlimited[1][value]' => 3,
+ 'entity_2[field_single][0][value]' => 11,
+ 'entity_2[field_unlimited][0][value]' => 12,
+ 'entity_2[field_unlimited][1][value]' => 13,
);
$this->drupalPost(NULL, $edit, t('Save'));
field_cache_clear();
$entity_1 = entity_load($entity_type, 1);
$entity_2 = entity_load($entity_type, 2);
- $this->assertFieldValues($entity_1, 'field_single', Language::LANGCODE_NOT_SPECIFIED, array(1));
- $this->assertFieldValues($entity_1, 'field_unlimited', Language::LANGCODE_NOT_SPECIFIED, array(2, 3));
- $this->assertFieldValues($entity_2, 'field_single', Language::LANGCODE_NOT_SPECIFIED, array(11));
- $this->assertFieldValues($entity_2, 'field_unlimited', Language::LANGCODE_NOT_SPECIFIED, array(12, 13));
+ $this->assertFieldValues($entity_1, 'field_single', array(1));
+ $this->assertFieldValues($entity_1, 'field_unlimited', array(2, 3));
+ $this->assertFieldValues($entity_2, 'field_single', array(11));
+ $this->assertFieldValues($entity_2, 'field_unlimited', array(12, 13));
// Submit invalid values and check that errors are reported on the
// correct widgets.
$edit = array(
- 'field_unlimited[und][1][value]' => -1,
+ 'field_unlimited[1][value]' => -1,
);
$this->drupalPost('test-entity/nested/1/2', $edit, t('Save'));
$this->assertRaw(t('%label does not accept the value -1', array('%label' => 'Unlimited field')), 'Entity 1: the field validation error was reported.');
- $error_field = $this->xpath('//input[@id=:id and contains(@class, "error")]', array(':id' => 'edit-field-unlimited-und-1-value'));
+ $error_field = $this->xpath('//input[@id=:id and contains(@class, "error")]', array(':id' => 'edit-field-unlimited-1-value'));
$this->assertTrue($error_field, 'Entity 1: the error was flagged on the correct element.');
$edit = array(
- 'entity_2[field_unlimited][und][1][value]' => -1,
+ 'entity_2[field_unlimited][1][value]' => -1,
);
$this->drupalPost('test-entity/nested/1/2', $edit, t('Save'));
$this->assertRaw(t('%label does not accept the value -1', array('%label' => 'Unlimited field')), 'Entity 2: the field validation error was reported.');
- $error_field = $this->xpath('//input[@id=:id and contains(@class, "error")]', array(':id' => 'edit-entity-2-field-unlimited-und-1-value'));
+ $error_field = $this->xpath('//input[@id=:id and contains(@class, "error")]', array(':id' => 'edit-entity-2-field-unlimited-1-value'));
$this->assertTrue($error_field, 'Entity 2: the error was flagged on the correct element.');
// Test that reordering works on both entities.
$edit = array(
- 'field_unlimited[und][0][_weight]' => 0,
- 'field_unlimited[und][1][_weight]' => -1,
- 'entity_2[field_unlimited][und][0][_weight]' => 0,
- 'entity_2[field_unlimited][und][1][_weight]' => -1,
+ 'field_unlimited[0][_weight]' => 0,
+ 'field_unlimited[1][_weight]' => -1,
+ 'entity_2[field_unlimited][0][_weight]' => 0,
+ 'entity_2[field_unlimited][1][_weight]' => -1,
);
$this->drupalPost('test-entity/nested/1/2', $edit, t('Save'));
field_cache_clear();
- $this->assertFieldValues($entity_1, 'field_unlimited', Language::LANGCODE_NOT_SPECIFIED, array(3, 2));
- $this->assertFieldValues($entity_2, 'field_unlimited', Language::LANGCODE_NOT_SPECIFIED, array(13, 12));
+ $this->assertFieldValues($entity_1, 'field_unlimited', array(3, 2));
+ $this->assertFieldValues($entity_2, 'field_unlimited', array(13, 12));
// Test the 'add more' buttons. Only Ajax submission is tested, because
// the two 'add more' buttons present in the form have the same #value,
@@ -151,56 +148,26 @@ function testNestedFieldForm() {
// 'Add more' button in the first entity:
$this->drupalGet('test-entity/nested/1/2');
$this->drupalPostAJAX(NULL, array(), 'field_unlimited_add_more');
- $this->assertFieldByName('field_unlimited[und][0][value]', 3, 'Entity 1: field_unlimited value 0 appears correctly is the form.');
- $this->assertFieldByName('field_unlimited[und][1][value]', 2, 'Entity 1: field_unlimited value 1 appears correctly is the form.');
- $this->assertFieldByName('field_unlimited[und][2][value]', '', 'Entity 1: field_unlimited value 2 appears correctly is the form.');
- $this->assertFieldByName('field_unlimited[und][3][value]', '', 'Entity 1: an empty widget was added for field_unlimited value 3.');
+ $this->assertFieldByName('field_unlimited[0][value]', 3, 'Entity 1: field_unlimited value 0 appears correctly is the form.');
+ $this->assertFieldByName('field_unlimited[1][value]', 2, 'Entity 1: field_unlimited value 1 appears correctly is the form.');
+ $this->assertFieldByName('field_unlimited[2][value]', '', 'Entity 1: field_unlimited value 2 appears correctly is the form.');
+ $this->assertFieldByName('field_unlimited[3][value]', '', 'Entity 1: an empty widget was added for field_unlimited value 3.');
// 'Add more' button in the first entity (changing field values):
$edit = array(
- 'entity_2[field_unlimited][und][0][value]' => 13,
- 'entity_2[field_unlimited][und][1][value]' => 14,
- 'entity_2[field_unlimited][und][2][value]' => 15,
+ 'entity_2[field_unlimited][0][value]' => 13,
+ 'entity_2[field_unlimited][1][value]' => 14,
+ 'entity_2[field_unlimited][2][value]' => 15,
);
$this->drupalPostAJAX(NULL, $edit, 'entity_2_field_unlimited_add_more');
- $this->assertFieldByName('entity_2[field_unlimited][und][0][value]', 13, 'Entity 2: field_unlimited value 0 appears correctly is the form.');
- $this->assertFieldByName('entity_2[field_unlimited][und][1][value]', 14, 'Entity 2: field_unlimited value 1 appears correctly is the form.');
- $this->assertFieldByName('entity_2[field_unlimited][und][2][value]', 15, 'Entity 2: field_unlimited value 2 appears correctly is the form.');
- $this->assertFieldByName('entity_2[field_unlimited][und][3][value]', '', 'Entity 2: an empty widget was added for field_unlimited value 3.');
+ $this->assertFieldByName('entity_2[field_unlimited][0][value]', 13, 'Entity 2: field_unlimited value 0 appears correctly is the form.');
+ $this->assertFieldByName('entity_2[field_unlimited][1][value]', 14, 'Entity 2: field_unlimited value 1 appears correctly is the form.');
+ $this->assertFieldByName('entity_2[field_unlimited][2][value]', 15, 'Entity 2: field_unlimited value 2 appears correctly is the form.');
+ $this->assertFieldByName('entity_2[field_unlimited][3][value]', '', 'Entity 2: an empty widget was added for field_unlimited value 3.');
// Save the form and check values are saved correctly.
$this->drupalPost(NULL, array(), t('Save'));
field_cache_clear();
- $this->assertFieldValues($entity_1, 'field_unlimited', Language::LANGCODE_NOT_SPECIFIED, array(3, 2));
- $this->assertFieldValues($entity_2, 'field_unlimited', Language::LANGCODE_NOT_SPECIFIED, array(13, 14, 15));
- }
-
- /**
- * Assert that a field has the expected values in an entity.
- *
- * This function only checks a single column in the field values.
- *
- * @param \Drupal\Core\Entity\EntityInterface $entity
- * The entity to test.
- * @param string $field_name
- * The name of the field to test.
- * @param string $langcode
- * The language code for the values.
- * @param array $expected_values
- * The array of expected values.
- * @param string $column
- * (Optional) the name of the column to check.
- */
- function assertFieldValues(EntityInterface $entity, $field_name, $langcode, $expected_values, $column = 'value') {
- // Re-load the entity to make sure we have the latest changes.
- entity_get_controller($entity->entityType())->resetCache(array($entity->id()));
- $e = entity_load($entity->entityType(), $entity->id());
- $field = $values = $e->getTranslation($langcode, FALSE)->$field_name;
- // Filter out empty values so that they don't mess with the assertions.
- $field->filterEmptyValues();
- $values = $field->getValue();
- $this->assertEqual(count($values), count($expected_values), 'Expected number of values were saved.');
- foreach ($expected_values as $key => $value) {
- $this->assertEqual($values[$key][$column], $value, format_string('Value @value was saved correctly.', array('@value' => $value)));
- }
+ $this->assertFieldValues($entity_1, 'field_unlimited', array(3, 2));
+ $this->assertFieldValues($entity_2, 'field_unlimited', array(13, 14, 15));
}
}
diff --git a/core/modules/field/lib/Drupal/field/Tests/TranslationWebTest.php b/core/modules/field/lib/Drupal/field/Tests/TranslationWebTest.php
index d4b95da..1d4d8b6 100644
--- a/core/modules/field/lib/Drupal/field/Tests/TranslationWebTest.php
+++ b/core/modules/field/lib/Drupal/field/Tests/TranslationWebTest.php
@@ -120,7 +120,7 @@ function testFieldFormTranslationRevisions() {
$edit = array(
'user_id' => 1,
'name' => $this->randomName(),
- "{$field_name}[$langcode][0][value]" => $entity->{$field_name}->value,
+ "{$field_name}[0][value]" => $entity->{$field_name}->value,
'revision' => TRUE,
);
$this->drupalPost($this->entity_type . '/manage/' . $entity->id() . '/edit', $edit, t('Save'));
diff --git a/core/modules/field/lib/Drupal/field/Tests/reEnableModuleFieldTest.php b/core/modules/field/lib/Drupal/field/Tests/reEnableModuleFieldTest.php
index 0b5400d..2a3b539 100644
--- a/core/modules/field/lib/Drupal/field/Tests/reEnableModuleFieldTest.php
+++ b/core/modules/field/lib/Drupal/field/Tests/reEnableModuleFieldTest.php
@@ -80,13 +80,13 @@ function testReEnabledField() {
// Display the article node form and verify the telephone widget is present.
$this->drupalGet('node/add/article');
- $this->assertFieldByName("field_telephone[und][0][value]", '', 'Widget found.');
+ $this->assertFieldByName("field_telephone[0][value]", '', 'Widget found.');
// Submit an article node with a telephone field so data exist for the
// field.
$edit = array(
"title" => $this->randomName(),
- "field_telephone[und][0][value]" => "123456789",
+ "field_telephone[0][value]" => "123456789",
);
$this->drupalPost(NULL, $edit, t('Save'));
$this->assertRaw('');
@@ -97,7 +97,7 @@ function testReEnabledField() {
// Display the article creation form and verify the widget still exists.
$this->drupalGet('node/add/article');
- $this->assertFieldByName("field_telephone[und][0][value]", '', 'Widget found.');
+ $this->assertFieldByName("field_telephone[0][value]", '', 'Widget found.');
// Test that the module can't be disabled from the UI while there is data
// for it's fields.
diff --git a/core/modules/field/tests/modules/field_test/field_test.entity.inc b/core/modules/field/tests/modules/field_test/field_test.entity.inc
index fded178..8f140e3 100644
--- a/core/modules/field/tests/modules/field_test/field_test.entity.inc
+++ b/core/modules/field/tests/modules/field_test/field_test.entity.inc
@@ -85,11 +85,17 @@ function field_test_entity_nested_form($form, &$form_state, $entity_1, $entity_2
* Validate handler for field_test_entity_nested_form().
*/
function field_test_entity_nested_form_validate($form, &$form_state) {
- $entity_1 = entity_create('entity_test', $form_state['values']);
+ $entity_1 = entity_create('entity_test', array(
+ 'id' => $form_state['values']['id'],
+ 'type' => $form_state['values']['type'],
+ ));
field_attach_extract_form_values($entity_1, $form, $form_state);
field_attach_form_validate($entity_1, $form, $form_state);
- $entity_2 = entity_create('entity_test', $form_state['values']['entity_2']);
+ $entity_2 = entity_create('entity_test', array(
+ 'id' => $form_state['values']['entity_2']['id'],
+ 'type' => $form_state['values']['entity_2']['type'],
+ ));
field_attach_extract_form_values($entity_2, $form['entity_2'], $form_state);
field_attach_form_validate($entity_2, $form['entity_2'], $form_state);
}
@@ -98,11 +104,17 @@ function field_test_entity_nested_form_validate($form, &$form_state) {
* Submit handler for field_test_entity_nested_form().
*/
function field_test_entity_nested_form_submit($form, &$form_state) {
- $entity_1 = entity_create('entity_test', $form_state['values']);
+ $entity_1 = entity_create('entity_test', array(
+ 'id' => $form_state['values']['id'],
+ 'type' => $form_state['values']['type'],
+ ));
field_attach_extract_form_values($entity_1, $form, $form_state);
$entity_1->save();
- $entity_2 = entity_create('entity_test', $form_state['values']['entity_2']);
+ $entity_2 = entity_create('entity_test', array(
+ 'id' => $form_state['values']['entity_2']['id'],
+ 'type' => $form_state['values']['entity_2']['type'],
+ ));
field_attach_extract_form_values($entity_2, $form['entity_2'], $form_state);
$entity_2->save();
diff --git a/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php b/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php
index 3e09d8f..b858d2d 100644
--- a/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php
+++ b/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php
@@ -284,10 +284,9 @@ function testDefaultValue() {
->setComponent($field_name)
->save();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
$admin_path = 'admin/structure/types/manage/' . $this->type . '/fields/' . $instance->id();
- $element_id = "edit-default-value-input-$field_name-$langcode-0-value";
- $element_name = "default_value_input[{$field_name}][$langcode][0][value]";
+ $element_id = "edit-default-value-input-$field_name-0-value";
+ $element_name = "default_value_input[{$field_name}][0][value]";
$this->drupalGet($admin_path);
$this->assertFieldById($element_id, '', 'The default value widget was empty.');
diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldDisplayTest.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldDisplayTest.php
index 11d8322..a62dcec 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FileFieldDisplayTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldDisplayTest.php
@@ -7,8 +7,6 @@
namespace Drupal\file\Tests;
-use Drupal\Core\Language\Language;
-
/**
* Tests that formatters are working properly.
*/
@@ -69,7 +67,7 @@ function testNodeDisplay() {
$this->assertRaw($default_output, 'Default formatter displaying correctly on full node view.');
// Turn the "display" option off and check that the file is no longer displayed.
- $edit = array($field_name . '[' . Language::LANGCODE_NOT_SPECIFIED . '][0][display]' => FALSE);
+ $edit = array($field_name . '[0][display]' => FALSE);
$this->drupalPost('node/' . $nid . '/edit', $edit, t('Save and keep published'));
$this->assertNoRaw($default_output, 'Field is hidden when "display" option is unchecked.');
@@ -77,8 +75,8 @@ function testNodeDisplay() {
// Add a description and make sure that it is displayed.
$description = $this->randomName();
$edit = array(
- $field_name . '[' . Language::LANGCODE_NOT_SPECIFIED . '][0][description]' => $description,
- $field_name . '[' . Language::LANGCODE_NOT_SPECIFIED . '][0][display]' => TRUE,
+ $field_name . '[0][description]' => $description,
+ $field_name . '[0][display]' => TRUE,
);
$this->drupalPost('node/' . $nid . '/edit', $edit, t('Save and keep published'));
$this->assertText($description);
diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldTestBase.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldTestBase.php
index 866da45..8497334 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FileFieldTestBase.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldTestBase.php
@@ -7,7 +7,6 @@
namespace Drupal\file\Tests;
-use Drupal\Core\Language\Language;
use Drupal\file\FileInterface;
use Drupal\simpletest\WebTestBase;
@@ -140,7 +139,6 @@ function updateFileField($name, $type_name, $instance_settings = array(), $widge
* Uploads a file to a node.
*/
function uploadNodeFile($file, $field_name, $nid_or_type, $new_revision = TRUE, $extras = array()) {
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
$edit = array(
"title" => $this->randomName(),
'revision' => (string) (int) $new_revision,
@@ -163,7 +161,7 @@ function uploadNodeFile($file, $field_name, $nid_or_type, $new_revision = TRUE,
// Attach a file to the node.
$field = field_info_field('node', $field_name);
- $name = 'files[' . $field_name . '_' . $langcode . '_0]';
+ $name = 'files[' . $field_name . '_0]';
if ($field['cardinality'] != 1) {
$name .= '[]';
}
@@ -192,7 +190,7 @@ function removeNodeFile($nid, $new_revision = TRUE) {
*/
function replaceNodeFile($file, $field_name, $nid, $new_revision = TRUE) {
$edit = array(
- 'files[' . $field_name . '_' . Language::LANGCODE_NOT_SPECIFIED . '_0]' => drupal_realpath($file->getFileUri()),
+ 'files[' . $field_name . '_0]' => drupal_realpath($file->getFileUri()),
'revision' => (string) (int) $new_revision,
);
diff --git a/core/modules/file/lib/Drupal/file/Tests/FileListingTest.php b/core/modules/file/lib/Drupal/file/Tests/FileListingTest.php
index 8321cf1..65bdb27 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FileListingTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileListingTest.php
@@ -7,8 +7,6 @@
namespace Drupal\file\Tests;
-use Drupal\Core\Language\Language;
-
/**
* Tests file listing page functionality.
*/
@@ -79,7 +77,7 @@ function testFileListingPages() {
$file = $this->getTestFile('image');
$edit = array(
- 'files[file_' . Language::LANGCODE_NOT_SPECIFIED . '_' . 0 . ']' => drupal_realpath($file->getFileUri()),
+ 'files[file_0]' => drupal_realpath($file->getFileUri()),
);
$this->drupalPost(NULL, $edit, t('Save'));
$node = entity_load('node', $node->id());
diff --git a/core/modules/filter/lib/Drupal/filter/Tests/FilterAdminTest.php b/core/modules/filter/lib/Drupal/filter/Tests/FilterAdminTest.php
index 0788fb5..5977889 100644
--- a/core/modules/filter/lib/Drupal/filter/Tests/FilterAdminTest.php
+++ b/core/modules/filter/lib/Drupal/filter/Tests/FilterAdminTest.php
@@ -7,7 +7,6 @@
namespace Drupal\filter\Tests;
-use Drupal\Core\Language\Language;
use Drupal\simpletest\WebTestBase;
/**
@@ -233,10 +232,9 @@ function testFilterAdmin() {
$text = $body . '' . $extra_text . '';
$edit = array();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
$edit["title"] = $this->randomName();
- $edit["body[$langcode][0][value]"] = $text;
- $edit["body[$langcode][0][format]"] = $basic;
+ $edit['body[0][value]'] = $text;
+ $edit['body[0][format]'] = $basic;
$this->drupalPost('node/add/page', $edit, t('Save'));
$this->assertRaw(t('Basic page %title has been created.', array('%title' => $edit["title"])), 'Filtered node created.');
@@ -253,7 +251,7 @@ function testFilterAdmin() {
->set('always_show_fallback_choice', TRUE)
->save();
$edit = array();
- $edit["body[$langcode][0][format]"] = $plain;
+ $edit['body[0][format]'] = $plain;
$this->drupalPost('node/' . $node->id() . '/edit', $edit, t('Save'));
$this->drupalGet('node/' . $node->id());
$this->assertText(check_plain($text), 'The "Plain text" text format escapes all HTML tags.');
diff --git a/core/modules/filter/lib/Drupal/filter/Tests/FilterFormatAccessTest.php b/core/modules/filter/lib/Drupal/filter/Tests/FilterFormatAccessTest.php
index b99b8ce..2bdcf9c 100644
--- a/core/modules/filter/lib/Drupal/filter/Tests/FilterFormatAccessTest.php
+++ b/core/modules/filter/lib/Drupal/filter/Tests/FilterFormatAccessTest.php
@@ -7,7 +7,6 @@
namespace Drupal\filter\Tests;
-use Drupal\Core\Language\Language;
use Drupal\simpletest\WebTestBase;
/**
@@ -138,9 +137,8 @@ function testFormatPermissions() {
// the disallowed format does not.
$this->drupalLogin($this->web_user);
$this->drupalGet('node/add/page');
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
$elements = $this->xpath('//select[@name=:name]/option', array(
- ':name' => "body[$langcode][0][format]",
+ ':name' => 'body[0][format]',
':option' => $this->allowed_format->format,
));
$options = array();
@@ -207,10 +205,8 @@ function testFormatRoles() {
* choose a new format before saving the page.
*/
function testFormatWidgetPermissions() {
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
- $title_key = "title";
- $body_value_key = "body[$langcode][0][value]";
- $body_format_key = "body[$langcode][0][format]";
+ $body_value_key = 'body[0][value]';
+ $body_format_key = 'body[0][format]';
// Create node to edit.
$this->drupalLogin($this->admin_user);
diff --git a/core/modules/filter/lib/Drupal/filter/Tests/FilterHooksTest.php b/core/modules/filter/lib/Drupal/filter/Tests/FilterHooksTest.php
index 3d86beb..c96e4d0 100644
--- a/core/modules/filter/lib/Drupal/filter/Tests/FilterHooksTest.php
+++ b/core/modules/filter/lib/Drupal/filter/Tests/FilterHooksTest.php
@@ -7,7 +7,6 @@
namespace Drupal\filter\Tests;
-use Drupal\Core\Language\Language;
use Drupal\simpletest\WebTestBase;
/**
@@ -65,12 +64,11 @@ function testFilterHooks() {
$this->assertText('hook_filter_format_update invoked.');
// Use the format created.
- $language_not_specified = Language::LANGCODE_NOT_SPECIFIED;
$title = $this->randomName(8);
$edit = array(
"title" => $title,
- "body[$language_not_specified][0][value]" => $this->randomName(32),
- "body[$language_not_specified][0][format]" => $format_id,
+ "body[0][value]" => $this->randomName(32),
+ "body[0][format]" => $format_id,
);
$this->drupalPost("node/add/{$type->type}", $edit, t('Save and publish'));
$this->assertText(t('@type @title has been created.', array('@type' => $type_name, '@title' => $title)));
diff --git a/core/modules/filter/lib/Drupal/filter/Tests/FilterHtmlImageSecureTest.php b/core/modules/filter/lib/Drupal/filter/Tests/FilterHtmlImageSecureTest.php
index 90aaf1c..47e3ac1 100644
--- a/core/modules/filter/lib/Drupal/filter/Tests/FilterHtmlImageSecureTest.php
+++ b/core/modules/filter/lib/Drupal/filter/Tests/FilterHtmlImageSecureTest.php
@@ -117,7 +117,7 @@ function testImageSource() {
$comment[] = '';
}
$edit = array(
- 'comment_body[und][0][value]' => implode("\n", $comment),
+ 'comment_body[0][value]' => implode("\n", $comment),
);
$this->drupalPost('node/' . $this->node->id(), $edit, t('Save'));
foreach ($images as $image => $converted) {
diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module
index 0f076c4..eb2502a 100644
--- a/core/modules/forum/forum.module
+++ b/core/modules/forum/forum.module
@@ -263,7 +263,6 @@ function forum_uri($forum) {
*/
function forum_node_validate(EntityInterface $node, $form) {
if (Drupal::service('forum_manager')->checkNodeType($node)) {
- $langcode = $form['taxonomy_forums']['#language'];
// vocabulary is selected, not a "container" term.
if (!$node->taxonomy_forums->isEmpty()) {
// Extract the node's proper topic ID.
@@ -565,16 +564,15 @@ function forum_form_node_form_alter(&$form, &$form_state, $form_id) {
}
if (isset($form['taxonomy_forums'])) {
- $langcode = $form['taxonomy_forums']['#language'];
// Make the vocabulary required for 'real' forum-nodes.
- $form['taxonomy_forums'][$langcode]['#required'] = TRUE;
- $form['taxonomy_forums'][$langcode]['#multiple'] = FALSE;
- if (empty($form['taxonomy_forums'][$langcode]['#default_value'])) {
+ $form['taxonomy_forums']['#required'] = TRUE;
+ $form['taxonomy_forums']['#multiple'] = FALSE;
+ if (empty($form['taxonomy_forums']['#default_value'])) {
// If there is no default forum already selected, try to get the forum
// ID from the URL (e.g., if we are on a page like node/add/forum/2, we
// expect "2" to be the ID of the forum that was requested).
$requested_forum_id = arg(3);
- $form['taxonomy_forums'][$langcode]['#default_value'] = is_numeric($requested_forum_id) ? $requested_forum_id : '';
+ $form['taxonomy_forums']['#default_value'] = is_numeric($requested_forum_id) ? $requested_forum_id : '';
}
}
}
diff --git a/core/modules/forum/lib/Drupal/forum/Tests/ForumBlockTest.php b/core/modules/forum/lib/Drupal/forum/Tests/ForumBlockTest.php
index 2ba2d86..355ad89 100644
--- a/core/modules/forum/lib/Drupal/forum/Tests/ForumBlockTest.php
+++ b/core/modules/forum/lib/Drupal/forum/Tests/ForumBlockTest.php
@@ -7,7 +7,6 @@
namespace Drupal\forum\Tests;
-use Drupal\Core\Language\Language;
use Drupal\simpletest\WebTestBase;
use Drupal\Core\Datetime\DrupalDateTime;
@@ -99,7 +98,6 @@ public function testActiveForumTopicsBlock() {
// Comment on the first 5 topics.
$date = new DrupalDateTime();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
for ($index = 0; $index < 5; $index++) {
// Get the node from the topic title.
$node = $this->drupalGetNodeByTitle($topics[$index]);
@@ -169,10 +167,9 @@ protected function createForumTopics($count = 5) {
// changing the date.
$date->modify('+1 minute');
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
$edit = array(
'title' => $title,
- "body[$langcode][0][value]" => $body,
+ 'body[0][value]' => $body,
// Forum posts are ordered by timestamp, so force a unique timestamp by
// adding the index.
'date[date]' => $date->format('Y-m-d'),
diff --git a/core/modules/forum/lib/Drupal/forum/Tests/ForumIndexTest.php b/core/modules/forum/lib/Drupal/forum/Tests/ForumIndexTest.php
index d772adb..d08e2b1 100644
--- a/core/modules/forum/lib/Drupal/forum/Tests/ForumIndexTest.php
+++ b/core/modules/forum/lib/Drupal/forum/Tests/ForumIndexTest.php
@@ -7,7 +7,6 @@
namespace Drupal\forum\Tests;
-use Drupal\Core\Language\Language;
use Drupal\simpletest\WebTestBase;
/**
@@ -42,9 +41,6 @@ function setUp() {
* Tests the forum index for published and unpublished nodes.
*/
function testForumIndexStatus() {
-
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
-
// The forum ID to use.
$tid = 1;
@@ -52,7 +48,7 @@ function testForumIndexStatus() {
$title = $this->randomName(20);
$edit = array(
"title" => $title,
- "body[$langcode][0][value]" => $this->randomName(200),
+ 'body[0][value]' => $this->randomName(200),
);
// Create the forum topic, preselecting the forum ID via a URL parameter.
diff --git a/core/modules/forum/lib/Drupal/forum/Tests/ForumNodeAccessTest.php b/core/modules/forum/lib/Drupal/forum/Tests/ForumNodeAccessTest.php
index dde4701..d76a1f6 100644
--- a/core/modules/forum/lib/Drupal/forum/Tests/ForumNodeAccessTest.php
+++ b/core/modules/forum/lib/Drupal/forum/Tests/ForumNodeAccessTest.php
@@ -7,7 +7,6 @@
namespace Drupal\forum\Tests;
-use Drupal\Core\Language\Language;
use Drupal\simpletest\WebTestBase;
/**
@@ -51,11 +50,10 @@ function testForumNodeAccess() {
$this->drupalLogin($admin_user);
// Create a private node.
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
$private_node_title = $this->randomName(20);
$edit = array(
'title' => $private_node_title,
- "body[$langcode][0][value]" => $this->randomName(200),
+ 'body[0][value]' => $this->randomName(200),
'private' => TRUE,
);
$this->drupalPost('node/add/forum/1', $edit, t('Save'));
@@ -66,7 +64,7 @@ function testForumNodeAccess() {
$public_node_title = $this->randomName(20);
$edit = array(
'title' => $public_node_title,
- "body[$langcode][0][value]" => $this->randomName(200),
+ 'body[0][value]' => $this->randomName(200),
);
$this->drupalPost('node/add/forum/1', $edit, t('Save'));
$public_node = $this->drupalGetNodeByTitle($public_node_title);
diff --git a/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php
index ff4d712..2984532 100644
--- a/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php
+++ b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php
@@ -7,7 +7,6 @@
namespace Drupal\forum\Tests;
-use Drupal\Core\Language\Language;
use Drupal\Core\Entity\EntityInterface;
use Drupal\simpletest\WebTestBase;
@@ -212,7 +211,7 @@ function testForum() {
// Test adding a comment to a forum topic.
$node = $this->createForumTopic($this->forum, FALSE);
$edit = array();
- $edit['comment_body[' . Language::LANGCODE_NOT_SPECIFIED . '][0][value]'] = $this->randomName();
+ $edit['comment_body[0][value]'] = $this->randomName();
$this->drupalPost('node/' . $node->id(), $edit, t('Save'));
$this->assertResponse(200);
@@ -248,7 +247,7 @@ function testAddOrphanTopic() {
// Create an orphan forum item.
$this->drupalLogin($this->admin_user);
- $this->drupalPost('node/add/forum', array('title' => $this->randomName(10), 'body[' . Language::LANGCODE_NOT_SPECIFIED .'][0][value]' => $this->randomName(120)), t('Save'));
+ $this->drupalPost('node/add/forum', array('title' => $this->randomName(10), 'body[0][value]' => $this->randomName(120)), t('Save'));
$nid_count = db_query('SELECT COUNT(nid) FROM {node}')->fetchField();
$this->assertEqual(0, $nid_count, 'A forum node was not created when missing a forum vocabulary.');
@@ -478,7 +477,7 @@ function testForumWithNewPost() {
// Post a reply to the topic.
$edit = array();
$edit['subject'] = $this->randomName();
- $edit['comment_body[' . Language::LANGCODE_NOT_SPECIFIED . '][0][value]'] = $this->randomName();
+ $edit['comment_body[0][value]'] = $this->randomName();
$this->drupalPost('node/' . $node->id(), $edit, t('Save'));
$this->assertResponse(200);
@@ -505,10 +504,9 @@ function createForumTopic($forum, $container = FALSE) {
$title = $this->randomName(20);
$body = $this->randomName(200);
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
$edit = array(
- "title" => $title,
- "body[$langcode][0][value]" => $body,
+ 'title' => $title,
+ 'body[0][value]' => $body,
);
$tid = $forum['tid'];
@@ -595,11 +593,10 @@ private function verifyForums($node_user, EntityInterface $node, $admin, $respon
if ($response == 200) {
// Edit forum node (including moving it to another forum).
$edit = array();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
- $edit["title"] = 'node/' . $node->id();
- $edit["body[$langcode][0][value]"] = $this->randomName(256);
+ $edit['title'] = 'node/' . $node->id();
+ $edit['body[0][value]'] = $this->randomName(256);
// Assume the topic is initially associated with $forum.
- $edit["taxonomy_forums[$langcode]"] = $this->root_forum['tid'];
+ $edit['taxonomy_forums'] = $this->root_forum['tid'];
$edit['shadow'] = TRUE;
$this->drupalPost('node/' . $node->id() . '/edit', $edit, t('Save'));
$this->assertRaw(t('Forum topic %title has been updated.', array('%title' => $edit["title"])), 'Forum node was edited');
diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageFieldTestBase.php b/core/modules/image/lib/Drupal/image/Tests/ImageFieldTestBase.php
index 5dc38f3..7dd9370 100644
--- a/core/modules/image/lib/Drupal/image/Tests/ImageFieldTestBase.php
+++ b/core/modules/image/lib/Drupal/image/Tests/ImageFieldTestBase.php
@@ -7,7 +7,6 @@
namespace Drupal\image\Tests;
-use Drupal\Core\Language\Language;
use Drupal\simpletest\WebTestBase;
/**
@@ -117,7 +116,7 @@ function uploadNodeImage($image, $field_name, $type) {
$edit = array(
'title' => $this->randomName(),
);
- $edit['files[' . $field_name . '_' . Language::LANGCODE_NOT_SPECIFIED . '_0]'] = drupal_realpath($image->uri);
+ $edit['files[' . $field_name . '_0]'] = drupal_realpath($image->uri);
$this->drupalPost('node/add/' . $type, $edit, t('Save and publish'));
// Retrieve ID of the newly created node from the current URL.
diff --git a/core/modules/link/lib/Drupal/link/Tests/LinkFieldTest.php b/core/modules/link/lib/Drupal/link/Tests/LinkFieldTest.php
index 8b61f63..47db3d1 100644
--- a/core/modules/link/lib/Drupal/link/Tests/LinkFieldTest.php
+++ b/core/modules/link/lib/Drupal/link/Tests/LinkFieldTest.php
@@ -7,7 +7,6 @@
namespace Drupal\link\Tests;
-use Drupal\Core\Language\Language;
use Drupal\simpletest\WebTestBase;
/**
@@ -95,11 +94,9 @@ function testURLValidation() {
))
->save();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
-
// Display creation form.
$this->drupalGet('entity_test/add');
- $this->assertFieldByName("{$field_name}[$langcode][0][url]", '', 'Link URL field is displayed');
+ $this->assertFieldByName("{$field_name}[0][url]", '', 'Link URL field is displayed');
$this->assertRaw('placeholder="http://example.com"');
// Verify that a valid URL can be submitted.
@@ -107,7 +104,7 @@ function testURLValidation() {
$edit = array(
'user_id' => 1,
'name' => $this->randomName(),
- "{$field_name}[$langcode][0][url]" => $value,
+ "{$field_name}[0][url]" => $value,
);
$this->drupalPost(NULL, $edit, t('Save'));
preg_match('|entity_test/manage/(\d+)/edit|', $this->url, $match);
@@ -129,7 +126,7 @@ function testURLValidation() {
$edit = array(
'user_id' => 1,
'name' => $this->randomName(),
- "{$field_name}[$langcode][0][url]" => $invalid_value,
+ "{$field_name}[0][url]" => $invalid_value,
);
$this->drupalPost(NULL, $edit, t('Save'));
$this->assertText(t('The URL @url is not valid.', array('@url' => $invalid_value)));
@@ -174,8 +171,6 @@ function testLinkTitle() {
))
->save();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
-
// Verify that the link text field works according to the field setting.
foreach (array(DRUPAL_DISABLED, DRUPAL_REQUIRED, DRUPAL_OPTIONAL) as $title_setting) {
// Update the link title field setting.
@@ -186,28 +181,28 @@ function testLinkTitle() {
$this->drupalGet('entity_test/add');
// Assert label is shown.
$this->assertText('Read more about this entity');
- $this->assertFieldByName("{$field_name}[$langcode][0][url]", '', 'URL field found.');
+ $this->assertFieldByName("{$field_name}[0][url]", '', 'URL field found.');
$this->assertRaw('placeholder="http://example.com"');
if ($title_setting === DRUPAL_DISABLED) {
- $this->assertNoFieldByName("{$field_name}[$langcode][0][title]", '', 'Link text field not found.');
+ $this->assertNoFieldByName("{$field_name}[0][title]", '', 'Link text field not found.');
$this->assertNoRaw('placeholder="Enter the text for this link"');
}
else {
$this->assertRaw('placeholder="Enter the text for this link"');
- $this->assertFieldByName("{$field_name}[$langcode][0][title]", '', 'Link text field found.');
+ $this->assertFieldByName("{$field_name}[0][title]", '', 'Link text field found.');
if ($title_setting === DRUPAL_REQUIRED) {
// Verify that the link text is required, if the URL is non-empty.
$edit = array(
- "{$field_name}[$langcode][0][url]" => 'http://www.example.com',
+ "{$field_name}[0][url]" => 'http://www.example.com',
);
$this->drupalPost(NULL, $edit, t('Save'));
$this->assertText(t('!name field is required.', array('!name' => t('Link text'))));
// Verify that the link text is not required, if the URL is empty.
$edit = array(
- "{$field_name}[$langcode][0][url]" => '',
+ "{$field_name}[0][url]" => '',
);
$this->drupalPost(NULL, $edit, t('Save'));
$this->assertNoText(t('!name field is required.', array('!name' => t('Link text'))));
@@ -215,8 +210,8 @@ function testLinkTitle() {
// Verify that a URL and link text meets requirements.
$this->drupalGet('entity_test/add');
$edit = array(
- "{$field_name}[$langcode][0][url]" => 'http://www.example.com',
- "{$field_name}[$langcode][0][title]" => 'Example',
+ "{$field_name}[0][url]" => 'http://www.example.com',
+ "{$field_name}[0][title]" => 'Example',
);
$this->drupalPost(NULL, $edit, t('Save'));
$this->assertNoText(t('!name field is required.', array('!name' => t('Link text'))));
@@ -229,8 +224,8 @@ function testLinkTitle() {
$edit = array(
'user_id' => 1,
'name' => $this->randomName(),
- "{$field_name}[$langcode][0][url]" => $value,
- "{$field_name}[$langcode][0][title]" => '',
+ "{$field_name}[0][url]" => $value,
+ "{$field_name}[0][title]" => '',
);
$this->drupalPost(NULL, $edit, t('Save'));
preg_match('|entity_test/manage/(\d+)/edit|', $this->url, $match);
@@ -246,7 +241,7 @@ function testLinkTitle() {
$edit = array(
'user_id' => 1,
'name' => $this->randomName(),
- "{$field_name}[$langcode][0][title]" => $title,
+ "{$field_name}[0][title]" => $title,
);
$this->drupalPost("entity_test/manage/$id/edit", $edit, t('Save'));
$this->assertText(t('entity_test @id has been updated.', array('@id' => $id)));
@@ -291,8 +286,6 @@ function testLinkFormatter() {
->setComponent($field_name, $display_options)
->save();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
-
// Create an entity with two link field values:
// - The first field item uses a URL only.
// - The second field item uses a URL and link text.
@@ -307,11 +300,11 @@ function testLinkFormatter() {
$edit = array(
'user_id' => 1,
'name' => $this->randomName(),
- "{$field_name}[$langcode][0][url]" => $url1,
+ "{$field_name}[0][url]" => $url1,
// Note that $title1 is not submitted.
- "{$field_name}[$langcode][0][title]" => '',
- "{$field_name}[$langcode][1][url]" => $url2,
- "{$field_name}[$langcode][1][title]" => $title2,
+ "{$field_name}[0][title]" => '',
+ "{$field_name}[1][url]" => $url2,
+ "{$field_name}[1][title]" => $title2,
);
// Assert label is shown.
$this->assertText('Read more about this entity');
@@ -434,8 +427,6 @@ function testLinkSeparateFormatter() {
->setComponent($field_name, $display_options)
->save();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
-
// Create an entity with two link field values:
// - The first field item uses a URL only.
// - The second field item uses a URL and link text.
@@ -449,9 +440,9 @@ function testLinkSeparateFormatter() {
$edit = array(
'user_id' => 1,
'name' => $this->randomName(),
- "{$field_name}[$langcode][0][url]" => $url1,
- "{$field_name}[$langcode][1][url]" => $url2,
- "{$field_name}[$langcode][1][title]" => $title2,
+ "{$field_name}[0][url]" => $url1,
+ "{$field_name}[1][url]" => $url2,
+ "{$field_name}[1][title]" => $title2,
);
$this->drupalPost(NULL, $edit, t('Save'));
preg_match('|entity_test/manage/(\d+)/edit|', $this->url, $match);
diff --git a/core/modules/menu/lib/Drupal/menu/Tests/MenuNodeTest.php b/core/modules/menu/lib/Drupal/menu/Tests/MenuNodeTest.php
index 29d0223..1e585b4 100644
--- a/core/modules/menu/lib/Drupal/menu/Tests/MenuNodeTest.php
+++ b/core/modules/menu/lib/Drupal/menu/Tests/MenuNodeTest.php
@@ -7,7 +7,6 @@
namespace Drupal\menu\Tests;
-use Drupal\Core\Language\Language;
use Drupal\simpletest\WebTestBase;
/**
@@ -62,10 +61,9 @@ function testMenuNodeFormWidget() {
// Create a node.
$node_title = $this->randomName();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
$edit = array(
- "title" => $node_title,
- "body[$langcode][0][value]" => $this->randomString(),
+ 'title' => $node_title,
+ 'body[0][value]' => $this->randomString(),
);
$this->drupalPost('node/add/page', $edit, t('Save'));
$node = $this->drupalGetNodeByTitle($node_title);
diff --git a/core/modules/node/lib/Drupal/node/Tests/MultiStepNodeFormBasicOptionsTest.php b/core/modules/node/lib/Drupal/node/Tests/MultiStepNodeFormBasicOptionsTest.php
index 4fc3f7b..9b11906 100644
--- a/core/modules/node/lib/Drupal/node/Tests/MultiStepNodeFormBasicOptionsTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/MultiStepNodeFormBasicOptionsTest.php
@@ -7,9 +7,6 @@
namespace Drupal\node\Tests;
-use Drupal\Core\Language\Language;
-use Drupal\simpletest\WebTestBase;
-
/**
* Tests basic options of multi-step node forms.
*/
@@ -63,13 +60,11 @@ function testMultiStepNodeFormBasicOptions() {
))
->save();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
-
$edit = array(
'title' => 'a',
'promote' => FALSE,
'sticky' => 1,
- "{$this->field_name}[$langcode][0][value]" => $this->randomString(32),
+ "{$this->field_name}[0][value]" => $this->randomString(32),
);
$this->drupalPost('node/add/page', $edit, t('Add another item'));
$this->assertNoFieldChecked('edit-promote', 'promote stayed unchecked');
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeAccessBaseTableTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeAccessBaseTableTest.php
index ee55eb9..fb59b79 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeAccessBaseTableTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeAccessBaseTableTest.php
@@ -76,12 +76,12 @@ function testNodeAccessBasic() {
);
if ($is_private) {
$edit['private'] = TRUE;
- $edit['body[und][0][value]'] = 'private node';
- $edit['field_tags[und]'] = 'private';
+ $edit['body[0][value]'] = 'private node';
+ $edit['field_tags'] = 'private';
}
else {
- $edit['body[und][0][value]'] = 'public node';
- $edit['field_tags[und]'] = 'public';
+ $edit['body[0][value]'] = 'public node';
+ $edit['field_tags'] = 'public';
}
$this->drupalPost('node/add/article', $edit, t('Save'));
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeAccessFieldTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeAccessFieldTest.php
index 5b67854..4828f72 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeAccessFieldTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeAccessFieldTest.php
@@ -7,8 +7,6 @@
namespace Drupal\node\Tests;
-use Drupal\Core\Language\Language;
-
/**
* Tests the interaction of the node access system with fields.
*/
@@ -84,7 +82,6 @@ public function setUp() {
*/
function testNodeAccessAdministerField() {
// Create a page node.
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
$field_data = array();
$value = $field_data[0]['value'] = $this->randomName();
$node = $this->drupalCreateNode(array($this->field_name => $field_data));
@@ -102,7 +99,7 @@ function testNodeAccessAdministerField() {
// Modify the field default as the content admin.
$edit = array();
$default = 'Sometimes words have two meanings';
- $edit["default_value_input[{$this->field_name}][$langcode][0][value]"] = $default;
+ $edit["default_value_input[{$this->field_name}][0][value]"] = $default;
$this->drupalPost(
"admin/structure/types/manage/page/fields/node.page.{$this->field_name}",
$edit,
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeCreationTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeCreationTest.php
index 09e78a2..04d8c9a 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeCreationTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeCreationTest.php
@@ -45,9 +45,8 @@ function setUp() {
function testNodeCreation() {
// Create a node.
$edit = array();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
$edit["title"] = $this->randomName(8);
- $edit["body[$langcode][0][value]"] = $this->randomName(16);
+ $edit["body[0][value]"] = $this->randomName(16);
$this->drupalPost('node/add/page', $edit, t('Save'));
// Check that the Basic page has been created.
@@ -111,8 +110,8 @@ function testUnpublishedNodeCreation() {
// Create a node.
$edit = array();
- $edit["title"] = $this->randomName(8);
- $edit["body[" . Language::LANGCODE_NOT_SPECIFIED . "][0][value]"] = $this->randomName(16);
+ $edit['title'] = $this->randomName(8);
+ $edit['body[0][value]'] = $this->randomName(16);
$this->drupalPost('node/add/page', $edit, t('Save'));
// Check that the user was redirected to the home page.
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeEntityViewModeAlterTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeEntityViewModeAlterTest.php
index 6494b40..1140d4b 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeEntityViewModeAlterTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeEntityViewModeAlterTest.php
@@ -7,8 +7,6 @@
namespace Drupal\node\Tests;
-use Drupal\Core\Language\Language;
-
/**
* Tests changing view modes for nodes.
*/
@@ -36,10 +34,9 @@ function testNodeViewModeChange() {
// Create a node.
$edit = array();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
- $edit["title"] = $this->randomName(8);
- $edit["body[$langcode][0][value]"] = t('Data that should appear only in the body for the node.');
- $edit["body[$langcode][0][summary]"] = t('Extra data that should appear only in the teaser for the node.');
+ $edit['title'] = $this->randomName(8);
+ $edit['body[0][value]'] = t('Data that should appear only in the body for the node.');
+ $edit['body[0][summary]'] = t('Extra data that should appear only in the teaser for the node.');
$this->drupalPost('node/add/page', $edit, t('Save'));
$node = $this->drupalGetNodeByTitle($edit["title"]);
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeFieldMultilingualTestCase.php b/core/modules/node/lib/Drupal/node/Tests/NodeFieldMultilingualTestCase.php
index e1a64a6..aaf8ffd 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeFieldMultilingualTestCase.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeFieldMultilingualTestCase.php
@@ -72,7 +72,7 @@ function testMultilingualNodeForm() {
$langcode = language_get_default_langcode('node', 'page');
$title_key = "title";
$title_value = $this->randomName(8);
- $body_key = "body[$langcode][0][value]";
+ $body_key = 'body[0][value]';
$body_value = $this->randomName(16);
// Create node to edit.
@@ -114,10 +114,9 @@ function testMultilingualNodeForm() {
*/
function testMultilingualDisplaySettings() {
// Create "Basic page" content.
- $langcode = language_get_default_langcode('node', 'page');
$title_key = "title";
$title_value = $this->randomName(8);
- $body_key = "body[$langcode][0][value]";
+ $body_key = 'body[0][value]';
$body_value = $this->randomName(16);
// Create node to edit.
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodePostSettingsTest.php b/core/modules/node/lib/Drupal/node/Tests/NodePostSettingsTest.php
index 035c083..0434779 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodePostSettingsTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodePostSettingsTest.php
@@ -7,8 +7,6 @@
namespace Drupal\node\Tests;
-use Drupal\Core\Language\Language;
-
/**
* Checks that the post information displays when enabled for a content type.
*/
@@ -41,9 +39,8 @@ function testPagePostInfo() {
// Create a node.
$edit = array();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
- $edit["title"] = $this->randomName(8);
- $edit["body[$langcode][0][value]"] = $this->randomName(16);
+ $edit['title'] = $this->randomName(8);
+ $edit['body[0][value]'] = $this->randomName(16);
$this->drupalPost('node/add/page', $edit, t('Save'));
// Check that the post information is displayed.
@@ -59,9 +56,8 @@ function testPagePostInfo() {
// Create a node.
$edit = array();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
- $edit["title"] = $this->randomName(8);
- $edit["body[$langcode][0][value]"] = $this->randomName(16);
+ $edit['title'] = $this->randomName(8);
+ $edit['body[0][value]'] = $this->randomName(16);
$this->drupalPost('node/add/page', $edit, t('Save'));
// Check that the post information is displayed.
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeTypeInitialLanguageTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeTypeInitialLanguageTest.php
index b54aef0..a82723b 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeTypeInitialLanguageTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeTypeInitialLanguageTest.php
@@ -7,8 +7,6 @@
namespace Drupal\node\Tests;
-use Drupal\Core\Language\Language;
-
/**
* Tests related to node type initial language.
*/
@@ -101,12 +99,10 @@ function testNodeTypeInitialLanguageDefaults() {
* Tests language field visibility features.
*/
function testLanguageFieldVisibility() {
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
-
// Creates a node to test Language field visibility feature.
$edit = array(
'title' => $this->randomName(8),
- "body[$langcode][0][value]" => $this->randomName(16),
+ 'body[0][value]' => $this->randomName(16),
);
$this->drupalPost('node/add/article', $edit, t('Save'));
$node = $this->drupalGetNodeByTitle($edit['title']);
diff --git a/core/modules/node/lib/Drupal/node/Tests/PageEditTest.php b/core/modules/node/lib/Drupal/node/Tests/PageEditTest.php
index 43704b0..468ccf4 100644
--- a/core/modules/node/lib/Drupal/node/Tests/PageEditTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/PageEditTest.php
@@ -7,8 +7,6 @@
namespace Drupal\node\Tests;
-use Drupal\Core\Language\Language;
-
/**
* Tests the node edit functionality.
*/
@@ -37,9 +35,8 @@ function setUp() {
function testPageEdit() {
$this->drupalLogin($this->web_user);
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
- $title_key = "title";
- $body_key = "body[$langcode][0][value]";
+ $title_key = 'title';
+ $body_key = 'body[0][value]';
// Create node to edit.
$edit = array();
$edit[$title_key] = $this->randomName(8);
@@ -105,8 +102,7 @@ function testPageAuthoredBy() {
$this->drupalLogin($this->admin_user);
// Create node to edit.
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
- $body_key = "body[$langcode][0][value]";
+ $body_key = 'body[0][value]';
$edit = array();
$edit['title'] = $this->randomName(8);
$edit[$body_key] = $this->randomName(16);
diff --git a/core/modules/node/lib/Drupal/node/Tests/PagePreviewTest.php b/core/modules/node/lib/Drupal/node/Tests/PagePreviewTest.php
index f9e3670..d351096 100644
--- a/core/modules/node/lib/Drupal/node/Tests/PagePreviewTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/PagePreviewTest.php
@@ -110,10 +110,9 @@ function setUp() {
* Checks the node preview functionality.
*/
function testPagePreview() {
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
$title_key = "title";
- $body_key = "body[$langcode][0][value]";
- $term_key = "{$this->field_name}[$langcode]";
+ $body_key = 'body[0][value]';
+ $term_key = $this->field_name;
// Fill in node creation form and preview node.
$edit = array();
@@ -182,10 +181,9 @@ function testPagePreview() {
* Checks the node preview functionality, when using revisions.
*/
function testPagePreviewWithRevisions() {
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
- $title_key = "title";
- $body_key = "body[$langcode][0][value]";
- $term_key = "{$this->field_name}[$langcode]";
+ $title_key = 'title';
+ $body_key = 'body[0][value]';
+ $term_key = $this->field_name;
// Force revision on "Basic page" content.
$this->container->get('config.factory')->get('node.type.page')->set('settings.node.options', array('status', 'revision'))->save();
diff --git a/core/modules/number/lib/Drupal/number/Tests/NumberFieldTest.php b/core/modules/number/lib/Drupal/number/Tests/NumberFieldTest.php
index f777f36..6635b0f 100644
--- a/core/modules/number/lib/Drupal/number/Tests/NumberFieldTest.php
+++ b/core/modules/number/lib/Drupal/number/Tests/NumberFieldTest.php
@@ -7,7 +7,6 @@
namespace Drupal\number\Tests;
-use Drupal\Core\Language\Language;
use Drupal\simpletest\WebTestBase;
/**
@@ -94,8 +93,7 @@ function testNumberDecimalField() {
// Display creation form.
$this->drupalGet('entity_test/add');
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
- $this->assertFieldByName("{$this->field['field_name']}[$langcode][0][value]", '', 'Widget is displayed');
+ $this->assertFieldByName("{$this->field['field_name']}[0][value]", '', 'Widget is displayed');
$this->assertRaw('placeholder="0.00"');
// Submit a signed decimal value within the allowed precision and scale.
@@ -103,7 +101,7 @@ function testNumberDecimalField() {
$edit = array(
'user_id' => 1,
'name' => $this->randomName(),
- "{$this->field['field_name']}[$langcode][0][value]" => $value,
+ "{$this->field['field_name']}[0][value]" => $value,
);
$this->drupalPost(NULL, $edit, t('Save'));
preg_match('|entity_test/manage/(\d+)/edit|', $this->url, $match);
@@ -123,7 +121,7 @@ function testNumberDecimalField() {
foreach ($wrong_entries as $wrong_entry) {
$this->drupalGet('entity_test/add');
$edit = array(
- "{$this->field['field_name']}[$langcode][0][value]" => $wrong_entry,
+ "{$this->field['field_name']}[0][value]" => $wrong_entry,
);
$this->drupalPost(NULL, $edit, t('Save'));
$this->assertRaw(t('%name must be a number.', array('%name' => $this->field['field_name'])), 'Correctly failed to save decimal value with more than one decimal point.');
@@ -141,7 +139,7 @@ function testNumberDecimalField() {
foreach ($wrong_entries as $wrong_entry) {
$this->drupalGet('entity_test/add');
$edit = array(
- "{$this->field['field_name']}[$langcode][0][value]" => $wrong_entry,
+ "{$this->field['field_name']}[0][value]" => $wrong_entry,
);
$this->drupalPost(NULL, $edit, t('Save'));
$this->assertRaw(t('%name must be a number.', array('%name' => $this->field['field_name'])), 'Correctly failed to save decimal value with minus sign in the wrong position.');
@@ -202,7 +200,7 @@ function testNumberIntegerField() {
$rand_number = rand();
$edit = array(
'title' => $this->randomName(),
- 'field_' .$field_name . '[und][0][value]' => $rand_number,
+ 'field_' .$field_name . '[0][value]' => $rand_number,
);
$this->drupalPost("node/add/$type", $edit, t('Save'));
diff --git a/core/modules/options/lib/Drupal/options/Tests/OptionsFieldTest.php b/core/modules/options/lib/Drupal/options/Tests/OptionsFieldTest.php
index 2a8c1a6..11da831 100644
--- a/core/modules/options/lib/Drupal/options/Tests/OptionsFieldTest.php
+++ b/core/modules/options/lib/Drupal/options/Tests/OptionsFieldTest.php
@@ -7,7 +7,6 @@
namespace Drupal\options\Tests;
-use Drupal\Core\Language\Language;
use Drupal\field\FieldException;
/**
@@ -34,14 +33,12 @@ public static function getInfo() {
* Test that allowed values can be updated.
*/
function testUpdateAllowedValues() {
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
-
// All three options appear.
$entity = entity_create('entity_test', array());
$form = \Drupal::entityManager()->getForm($entity);
- $this->assertTrue(!empty($form[$this->fieldName][$langcode][1]), 'Option 1 exists');
- $this->assertTrue(!empty($form[$this->fieldName][$langcode][2]), 'Option 2 exists');
- $this->assertTrue(!empty($form[$this->fieldName][$langcode][3]), 'Option 3 exists');
+ $this->assertTrue(!empty($form[$this->fieldName]['wrapper'][1]), 'Option 1 exists');
+ $this->assertTrue(!empty($form[$this->fieldName]['wrapper'][2]), 'Option 2 exists');
+ $this->assertTrue(!empty($form[$this->fieldName]['wrapper'][3]), 'Option 3 exists');
// Use one of the values in an actual entity, and check that this value
// cannot be removed from the list.
@@ -65,9 +62,9 @@ function testUpdateAllowedValues() {
$this->field->save();
$entity = entity_create('entity_test', array());
$form = \Drupal::entityManager()->getForm($entity);
- $this->assertTrue(empty($form[$this->fieldName][$langcode][1]), 'Option 1 does not exist');
- $this->assertTrue(!empty($form[$this->fieldName][$langcode][2]), 'Option 2 exists');
- $this->assertTrue(empty($form[$this->fieldName][$langcode][3]), 'Option 3 does not exist');
+ $this->assertTrue(empty($form[$this->fieldName]['wrapper'][1]), 'Option 1 does not exist');
+ $this->assertTrue(!empty($form[$this->fieldName]['wrapper'][2]), 'Option 2 exists');
+ $this->assertTrue(empty($form[$this->fieldName]['wrapper'][3]), 'Option 3 does not exist');
// Completely new options appear.
$this->field->settings['allowed_values'] = array(10 => 'Update', 20 => 'Twenty');
@@ -76,11 +73,11 @@ function testUpdateAllowedValues() {
// setting, so we need to reintialize the entity object.
$entity = entity_create('entity_test', array());
$form = \Drupal::entityManager()->getForm($entity);
- $this->assertTrue(empty($form[$this->fieldName][$langcode][1]), 'Option 1 does not exist');
- $this->assertTrue(empty($form[$this->fieldName][$langcode][2]), 'Option 2 does not exist');
- $this->assertTrue(empty($form[$this->fieldName][$langcode][3]), 'Option 3 does not exist');
- $this->assertTrue(!empty($form[$this->fieldName][$langcode][10]), 'Option 10 exists');
- $this->assertTrue(!empty($form[$this->fieldName][$langcode][20]), 'Option 20 exists');
+ $this->assertTrue(empty($form[$this->fieldName]['wrapper'][1]), 'Option 1 does not exist');
+ $this->assertTrue(empty($form[$this->fieldName]['wrapper'][2]), 'Option 2 does not exist');
+ $this->assertTrue(empty($form[$this->fieldName]['wrapper'][3]), 'Option 3 does not exist');
+ $this->assertTrue(!empty($form[$this->fieldName]['wrapper'][10]), 'Option 10 exists');
+ $this->assertTrue(!empty($form[$this->fieldName]['wrapper'][20]), 'Option 20 exists');
// Options are reset when a new field with the same name is created.
$this->field->delete();
@@ -97,8 +94,8 @@ function testUpdateAllowedValues() {
->save();
$entity = entity_create('entity_test', array());
$form = \Drupal::entityManager()->getForm($entity);
- $this->assertTrue(!empty($form[$this->fieldName][$langcode][1]), 'Option 1 exists');
- $this->assertTrue(!empty($form[$this->fieldName][$langcode][2]), 'Option 2 exists');
- $this->assertTrue(!empty($form[$this->fieldName][$langcode][3]), 'Option 3 exists');
+ $this->assertTrue(!empty($form[$this->fieldName]['wrapper'][1]), 'Option 1 exists');
+ $this->assertTrue(!empty($form[$this->fieldName]['wrapper'][2]), 'Option 2 exists');
+ $this->assertTrue(!empty($form[$this->fieldName]['wrapper'][3]), 'Option 3 exists');
}
}
diff --git a/core/modules/options/lib/Drupal/options/Tests/OptionsFieldUITest.php b/core/modules/options/lib/Drupal/options/Tests/OptionsFieldUITest.php
index 34f0a87..c7e8d44 100644
--- a/core/modules/options/lib/Drupal/options/Tests/OptionsFieldUITest.php
+++ b/core/modules/options/lib/Drupal/options/Tests/OptionsFieldUITest.php
@@ -321,7 +321,7 @@ function testNodeDisplay() {
// Select a default value.
$edit = array(
- $this->field_name . '[und]' => '1',
+ $this->field_name => '1',
);
$this->drupalPost('node/' . $node->id() . '/edit', $edit, t('Save and keep published'));
diff --git a/core/modules/options/lib/Drupal/options/Tests/OptionsSelectDynamicValuesTest.php b/core/modules/options/lib/Drupal/options/Tests/OptionsSelectDynamicValuesTest.php
index 0237546..f31fd9b 100644
--- a/core/modules/options/lib/Drupal/options/Tests/OptionsSelectDynamicValuesTest.php
+++ b/core/modules/options/lib/Drupal/options/Tests/OptionsSelectDynamicValuesTest.php
@@ -32,7 +32,7 @@ function testSelectListDynamic() {
// Display form.
$this->drupalGet('entity_test_rev/manage/' . $this->entity->id() . '/edit');
- $options = $this->xpath('//select[@id="edit-test-options-und"]/option');
+ $options = $this->xpath('//select[@id="edit-test-options"]/option');
$this->assertEqual(count($options), count($this->test) + 1);
foreach ($options as $option) {
$value = (string) $option['value'];
diff --git a/core/modules/options/lib/Drupal/options/Tests/OptionsWidgetsTest.php b/core/modules/options/lib/Drupal/options/Tests/OptionsWidgetsTest.php
index bf76dc7..a9b730f 100644
--- a/core/modules/options/lib/Drupal/options/Tests/OptionsWidgetsTest.php
+++ b/core/modules/options/lib/Drupal/options/Tests/OptionsWidgetsTest.php
@@ -7,7 +7,6 @@
namespace Drupal\options\Tests;
-use Drupal\Core\Language\Language;
use Drupal\field\Tests\FieldTestBase;
/**
@@ -122,8 +121,6 @@ function testRadioButtons() {
))
->save();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
-
// Create an entity.
$entity = entity_create('entity_test', array(
'user_id' => 1,
@@ -134,26 +131,26 @@ function testRadioButtons() {
// With no field data, no buttons are checked.
$this->drupalGet('entity_test/manage/' . $entity->id() . '/edit');
- $this->assertNoFieldChecked("edit-card-1-$langcode-0");
- $this->assertNoFieldChecked("edit-card-1-$langcode-1");
- $this->assertNoFieldChecked("edit-card-1-$langcode-2");
+ $this->assertNoFieldChecked('edit-card-1-0');
+ $this->assertNoFieldChecked('edit-card-1-1');
+ $this->assertNoFieldChecked('edit-card-1-2');
$this->assertRaw('Some dangerous & unescaped markup', 'Option text was properly filtered.');
// Select first option.
- $edit = array("card_1[$langcode]" => 0);
+ $edit = array('card_1' => 0);
$this->drupalPost(NULL, $edit, t('Save'));
- $this->assertFieldValues($entity_init, 'card_1', $langcode, array(0));
+ $this->assertFieldValues($entity_init, 'card_1', array(0));
// Check that the selected button is checked.
$this->drupalGet('entity_test/manage/' . $entity->id() . '/edit');
- $this->assertFieldChecked("edit-card-1-$langcode-0");
- $this->assertNoFieldChecked("edit-card-1-$langcode-1");
- $this->assertNoFieldChecked("edit-card-1-$langcode-2");
+ $this->assertFieldChecked('edit-card-1-0');
+ $this->assertNoFieldChecked('edit-card-1-1');
+ $this->assertNoFieldChecked('edit-card-1-2');
// Unselect option.
- $edit = array("card_1[$langcode]" => '_none');
+ $edit = array('card_1' => '_none');
$this->drupalPost(NULL, $edit, t('Save'));
- $this->assertFieldValues($entity_init, 'card_1', $langcode, array());
+ $this->assertFieldValues($entity_init, 'card_1', array());
// Check that required radios with one option is auto-selected.
$this->card_1->settings['allowed_values'] = array(99 => 'Only allowed value');
@@ -161,7 +158,7 @@ function testRadioButtons() {
$instance->required = TRUE;
$instance->save();
$this->drupalGet('entity_test/manage/' . $entity->id() . '/edit');
- $this->assertFieldChecked("edit-card-1-$langcode-99");
+ $this->assertFieldChecked('edit-card-1-99');
}
/**
@@ -181,8 +178,6 @@ function testCheckBoxes() {
))
->save();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
-
// Create an entity.
$entity = entity_create('entity_test', array(
'user_id' => 1,
@@ -193,59 +188,59 @@ function testCheckBoxes() {
// Display form: with no field data, nothing is checked.
$this->drupalGet('entity_test/manage/' . $entity->id() . '/edit');
- $this->assertNoFieldChecked("edit-card-2-$langcode-0");
- $this->assertNoFieldChecked("edit-card-2-$langcode-1");
- $this->assertNoFieldChecked("edit-card-2-$langcode-2");
+ $this->assertNoFieldChecked('edit-card-2-0');
+ $this->assertNoFieldChecked('edit-card-2-1');
+ $this->assertNoFieldChecked('edit-card-2-2');
$this->assertRaw('Some dangerous & unescaped markup', 'Option text was properly filtered.');
// Submit form: select first and third options.
$edit = array(
- "card_2[$langcode][0]" => TRUE,
- "card_2[$langcode][1]" => FALSE,
- "card_2[$langcode][2]" => TRUE,
+ 'card_2[0]' => TRUE,
+ 'card_2[1]' => FALSE,
+ 'card_2[2]' => TRUE,
);
$this->drupalPost(NULL, $edit, t('Save'));
- $this->assertFieldValues($entity_init, 'card_2', $langcode, array(0, 2));
+ $this->assertFieldValues($entity_init, 'card_2', array(0, 2));
// Display form: check that the right options are selected.
$this->drupalGet('entity_test/manage/' . $entity->id() . '/edit');
- $this->assertFieldChecked("edit-card-2-$langcode-0");
- $this->assertNoFieldChecked("edit-card-2-$langcode-1");
- $this->assertFieldChecked("edit-card-2-$langcode-2");
+ $this->assertFieldChecked('edit-card-2-0');
+ $this->assertNoFieldChecked('edit-card-2-1');
+ $this->assertFieldChecked('edit-card-2-2');
// Submit form: select only first option.
$edit = array(
- "card_2[$langcode][0]" => TRUE,
- "card_2[$langcode][1]" => FALSE,
- "card_2[$langcode][2]" => FALSE,
+ 'card_2[0]' => TRUE,
+ 'card_2[1]' => FALSE,
+ 'card_2[2]' => FALSE,
);
$this->drupalPost(NULL, $edit, t('Save'));
- $this->assertFieldValues($entity_init, 'card_2', $langcode, array(0));
+ $this->assertFieldValues($entity_init, 'card_2', array(0));
// Display form: check that the right options are selected.
$this->drupalGet('entity_test/manage/' . $entity->id() . '/edit');
- $this->assertFieldChecked("edit-card-2-$langcode-0");
- $this->assertNoFieldChecked("edit-card-2-$langcode-1");
- $this->assertNoFieldChecked("edit-card-2-$langcode-2");
+ $this->assertFieldChecked('edit-card-2-0');
+ $this->assertNoFieldChecked('edit-card-2-1');
+ $this->assertNoFieldChecked('edit-card-2-2');
// Submit form: select the three options while the field accepts only 2.
$edit = array(
- "card_2[$langcode][0]" => TRUE,
- "card_2[$langcode][1]" => TRUE,
- "card_2[$langcode][2]" => TRUE,
+ 'card_2[0]' => TRUE,
+ 'card_2[1]' => TRUE,
+ 'card_2[2]' => TRUE,
);
$this->drupalPost(NULL, $edit, t('Save'));
$this->assertText('this field cannot hold more than 2 values', 'Validation error was displayed.');
// Submit form: uncheck all options.
$edit = array(
- "card_2[$langcode][0]" => FALSE,
- "card_2[$langcode][1]" => FALSE,
- "card_2[$langcode][2]" => FALSE,
+ 'card_2[0]' => FALSE,
+ 'card_2[1]' => FALSE,
+ 'card_2[2]' => FALSE,
);
$this->drupalPost(NULL, $edit, t('Save'));
// Check that the value was saved.
- $this->assertFieldValues($entity_init, 'card_2', $langcode, array());
+ $this->assertFieldValues($entity_init, 'card_2', array());
// Required checkbox with one option is auto-selected.
$this->card_2->settings['allowed_values'] = array(99 => 'Only allowed value');
@@ -253,7 +248,7 @@ function testCheckBoxes() {
$instance->required = TRUE;
$instance->save();
$this->drupalGet('entity_test/manage/' . $entity->id() . '/edit');
- $this->assertFieldChecked("edit-card-2-$langcode-99");
+ $this->assertFieldChecked('edit-card-2-99');
}
/**
@@ -274,8 +269,6 @@ function testSelectListSingle() {
))
->save();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
-
// Create an entity.
$entity = entity_create('entity_test', array(
'user_id' => 1,
@@ -287,32 +280,32 @@ function testSelectListSingle() {
// Display form.
$this->drupalGet('entity_test/manage/' . $entity->id() . '/edit');
// A required field without any value has a "none" option.
- $this->assertTrue($this->xpath('//select[@id=:id]//option[@value="_none" and text()=:label]', array(':id' => 'edit-card-1-' . $langcode, ':label' => t('- Select a value -'))), 'A required select list has a "Select a value" choice.');
+ $this->assertTrue($this->xpath('//select[@id=:id]//option[@value="_none" and text()=:label]', array(':id' => 'edit-card-1', ':label' => t('- Select a value -'))), 'A required select list has a "Select a value" choice.');
// With no field data, nothing is selected.
- $this->assertNoOptionSelected("edit-card-1-$langcode", '_none');
- $this->assertNoOptionSelected("edit-card-1-$langcode", 0);
- $this->assertNoOptionSelected("edit-card-1-$langcode", 1);
- $this->assertNoOptionSelected("edit-card-1-$langcode", 2);
+ $this->assertNoOptionSelected('edit-card-1', '_none');
+ $this->assertNoOptionSelected('edit-card-1', 0);
+ $this->assertNoOptionSelected('edit-card-1', 1);
+ $this->assertNoOptionSelected('edit-card-1', 2);
$this->assertRaw('Some dangerous & unescaped markup', 'Option text was properly filtered.');
// Submit form: select invalid 'none' option.
- $edit = array("card_1[$langcode]" => '_none');
+ $edit = array('card_1' => '_none');
$this->drupalPost(NULL, $edit, t('Save'));
$this->assertRaw(t('!title field is required.', array('!title' => $instance['field_name'])), 'Cannot save a required field when selecting "none" from the select list.');
// Submit form: select first option.
- $edit = array("card_1[$langcode]" => 0);
+ $edit = array('card_1' => 0);
$this->drupalPost(NULL, $edit, t('Save'));
- $this->assertFieldValues($entity_init, 'card_1', $langcode, array(0));
+ $this->assertFieldValues($entity_init, 'card_1', array(0));
// Display form: check that the right options are selected.
$this->drupalGet('entity_test/manage/' . $entity->id() . '/edit');
// A required field with a value has no 'none' option.
- $this->assertFalse($this->xpath('//select[@id=:id]//option[@value="_none"]', array(':id' => 'edit-card-1-' . $langcode)), 'A required select list with an actual value has no "none" choice.');
- $this->assertOptionSelected("edit-card-1-$langcode", 0);
- $this->assertNoOptionSelected("edit-card-1-$langcode", 1);
- $this->assertNoOptionSelected("edit-card-1-$langcode", 2);
+ $this->assertFalse($this->xpath('//select[@id=:id]//option[@value="_none"]', array(':id' => 'edit-card-1')), 'A required select list with an actual value has no "none" choice.');
+ $this->assertOptionSelected('edit-card-1', 0);
+ $this->assertNoOptionSelected('edit-card-1', 1);
+ $this->assertNoOptionSelected('edit-card-1', 2);
// Make the field non required.
$instance->required = FALSE;
@@ -321,11 +314,11 @@ function testSelectListSingle() {
// Display form.
$this->drupalGet('entity_test/manage/' . $entity->id() . '/edit');
// A non-required field has a 'none' option.
- $this->assertTrue($this->xpath('//select[@id=:id]//option[@value="_none" and text()=:label]', array(':id' => 'edit-card-1-' . $langcode, ':label' => t('- None -'))), 'A non-required select list has a "None" choice.');
+ $this->assertTrue($this->xpath('//select[@id=:id]//option[@value="_none" and text()=:label]', array(':id' => 'edit-card-1', ':label' => t('- None -'))), 'A non-required select list has a "None" choice.');
// Submit form: Unselect the option.
- $edit = array("card_1[$langcode]" => '_none');
+ $edit = array('card_1' => '_none');
$this->drupalPost('entity_test/manage/' . $entity->id() . '/edit', $edit, t('Save'));
- $this->assertFieldValues($entity_init, 'card_1', $langcode, array());
+ $this->assertFieldValues($entity_init, 'card_1', array());
// Test optgroups.
@@ -335,27 +328,27 @@ function testSelectListSingle() {
// Display form: with no field data, nothing is selected
$this->drupalGet('entity_test/manage/' . $entity->id() . '/edit');
- $this->assertNoOptionSelected("edit-card-1-$langcode", 0);
- $this->assertNoOptionSelected("edit-card-1-$langcode", 1);
- $this->assertNoOptionSelected("edit-card-1-$langcode", 2);
+ $this->assertNoOptionSelected('edit-card-1', 0);
+ $this->assertNoOptionSelected('edit-card-1', 1);
+ $this->assertNoOptionSelected('edit-card-1', 2);
$this->assertRaw('Some dangerous & unescaped markup', 'Option text was properly filtered.');
$this->assertRaw('Group 1', 'Option groups are displayed.');
// Submit form: select first option.
- $edit = array("card_1[$langcode]" => 0);
+ $edit = array('card_1' => 0);
$this->drupalPost(NULL, $edit, t('Save'));
- $this->assertFieldValues($entity_init, 'card_1', $langcode, array(0));
+ $this->assertFieldValues($entity_init, 'card_1', array(0));
// Display form: check that the right options are selected.
$this->drupalGet('entity_test/manage/' . $entity->id() . '/edit');
- $this->assertOptionSelected("edit-card-1-$langcode", 0);
- $this->assertNoOptionSelected("edit-card-1-$langcode", 1);
- $this->assertNoOptionSelected("edit-card-1-$langcode", 2);
+ $this->assertOptionSelected('edit-card-1', 0);
+ $this->assertNoOptionSelected('edit-card-1', 1);
+ $this->assertNoOptionSelected('edit-card-1', 2);
// Submit form: Unselect the option.
- $edit = array("card_1[$langcode]" => '_none');
+ $edit = array('card_1' => '_none');
$this->drupalPost('entity_test/manage/' . $entity->id() . '/edit', $edit, t('Save'));
- $this->assertFieldValues($entity_init, 'card_1', $langcode, array());
+ $this->assertFieldValues($entity_init, 'card_1', array());
}
/**
@@ -375,8 +368,6 @@ function testSelectListMultiple() {
))
->save();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
-
// Create an entity.
$entity = entity_create('entity_test', array(
'user_id' => 1,
@@ -387,61 +378,61 @@ function testSelectListMultiple() {
// Display form: with no field data, nothing is selected.
$this->drupalGet('entity_test/manage/' . $entity->id() . '/edit');
- $this->assertNoOptionSelected("edit-card-2-$langcode", 0);
- $this->assertNoOptionSelected("edit-card-2-$langcode", 1);
- $this->assertNoOptionSelected("edit-card-2-$langcode", 2);
+ $this->assertNoOptionSelected('edit-card-2', 0);
+ $this->assertNoOptionSelected('edit-card-2', 1);
+ $this->assertNoOptionSelected('edit-card-2', 2);
$this->assertRaw('Some dangerous & unescaped markup', 'Option text was properly filtered.');
// Submit form: select first and third options.
- $edit = array("card_2[$langcode][]" => array(0 => 0, 2 => 2));
+ $edit = array('card_2[]' => array(0 => 0, 2 => 2));
$this->drupalPost(NULL, $edit, t('Save'));
- $this->assertFieldValues($entity_init, 'card_2', $langcode, array(0, 2));
+ $this->assertFieldValues($entity_init, 'card_2', array(0, 2));
// Display form: check that the right options are selected.
$this->drupalGet('entity_test/manage/' . $entity->id() . '/edit');
- $this->assertOptionSelected("edit-card-2-$langcode", 0);
- $this->assertNoOptionSelected("edit-card-2-$langcode", 1);
- $this->assertOptionSelected("edit-card-2-$langcode", 2);
+ $this->assertOptionSelected('edit-card-2', 0);
+ $this->assertNoOptionSelected('edit-card-2', 1);
+ $this->assertOptionSelected('edit-card-2', 2);
// Submit form: select only first option.
- $edit = array("card_2[$langcode][]" => array(0 => 0));
+ $edit = array('card_2[]' => array(0 => 0));
$this->drupalPost(NULL, $edit, t('Save'));
- $this->assertFieldValues($entity_init, 'card_2', $langcode, array(0));
+ $this->assertFieldValues($entity_init, 'card_2', array(0));
// Display form: check that the right options are selected.
$this->drupalGet('entity_test/manage/' . $entity->id() . '/edit');
- $this->assertOptionSelected("edit-card-2-$langcode", 0);
- $this->assertNoOptionSelected("edit-card-2-$langcode", 1);
- $this->assertNoOptionSelected("edit-card-2-$langcode", 2);
+ $this->assertOptionSelected('edit-card-2', 0);
+ $this->assertNoOptionSelected('edit-card-2', 1);
+ $this->assertNoOptionSelected('edit-card-2', 2);
// Submit form: select the three options while the field accepts only 2.
- $edit = array("card_2[$langcode][]" => array(0 => 0, 1 => 1, 2 => 2));
+ $edit = array('card_2[]' => array(0 => 0, 1 => 1, 2 => 2));
$this->drupalPost(NULL, $edit, t('Save'));
$this->assertText('this field cannot hold more than 2 values', 'Validation error was displayed.');
// Submit form: uncheck all options.
- $edit = array("card_2[$langcode][]" => array());
+ $edit = array('card_2[]' => array());
$this->drupalPost(NULL, $edit, t('Save'));
- $this->assertFieldValues($entity_init, 'card_2', $langcode, array());
+ $this->assertFieldValues($entity_init, 'card_2', array());
// Test the 'None' option.
// Check that the 'none' option has no efect if actual options are selected
// as well.
- $edit = array("card_2[$langcode][]" => array('_none' => '_none', 0 => 0));
+ $edit = array('card_2[]' => array('_none' => '_none', 0 => 0));
$this->drupalPost('entity_test/manage/' . $entity->id() . '/edit', $edit, t('Save'));
- $this->assertFieldValues($entity_init, 'card_2', $langcode, array(0));
+ $this->assertFieldValues($entity_init, 'card_2', array(0));
// Check that selecting the 'none' option empties the field.
- $edit = array("card_2[$langcode][]" => array('_none' => '_none'));
+ $edit = array('card_2[]' => array('_none' => '_none'));
$this->drupalPost('entity_test/manage/' . $entity->id() . '/edit', $edit, t('Save'));
- $this->assertFieldValues($entity_init, 'card_2', $langcode, array());
+ $this->assertFieldValues($entity_init, 'card_2', array());
// A required select list does not have an empty key.
$instance->required = TRUE;
$instance->save();
$this->drupalGet('entity_test/manage/' . $entity->id() . '/edit');
- $this->assertFalse($this->xpath('//select[@id=:id]//option[@value=""]', array(':id' => 'edit-card-2-' . $langcode)), 'A required select list does not have an empty key.');
+ $this->assertFalse($this->xpath('//select[@id=:id]//option[@value=""]', array(':id' => 'edit-card-2')), 'A required select list does not have an empty key.');
// We do not have to test that a required select list with one option is
// auto-selected because the browser does it for us.
@@ -457,27 +448,27 @@ function testSelectListMultiple() {
// Display form: with no field data, nothing is selected.
$this->drupalGet('entity_test/manage/' . $entity->id() . '/edit');
- $this->assertNoOptionSelected("edit-card-2-$langcode", 0);
- $this->assertNoOptionSelected("edit-card-2-$langcode", 1);
- $this->assertNoOptionSelected("edit-card-2-$langcode", 2);
+ $this->assertNoOptionSelected('edit-card-2', 0);
+ $this->assertNoOptionSelected('edit-card-2', 1);
+ $this->assertNoOptionSelected('edit-card-2', 2);
$this->assertRaw('Some dangerous & unescaped markup', 'Option text was properly filtered.');
$this->assertRaw('Group 1', 'Option groups are displayed.');
// Submit form: select first option.
- $edit = array("card_2[$langcode][]" => array(0 => 0));
+ $edit = array('card_2[]' => array(0 => 0));
$this->drupalPost(NULL, $edit, t('Save'));
- $this->assertFieldValues($entity_init, 'card_2', $langcode, array(0));
+ $this->assertFieldValues($entity_init, 'card_2', array(0));
// Display form: check that the right options are selected.
$this->drupalGet('entity_test/manage/' . $entity->id() . '/edit');
- $this->assertOptionSelected("edit-card-2-$langcode", 0);
- $this->assertNoOptionSelected("edit-card-2-$langcode", 1);
- $this->assertNoOptionSelected("edit-card-2-$langcode", 2);
+ $this->assertOptionSelected('edit-card-2', 0);
+ $this->assertNoOptionSelected('edit-card-2', 1);
+ $this->assertNoOptionSelected('edit-card-2', 2);
// Submit form: Unselect the option.
- $edit = array("card_2[$langcode][]" => array('_none' => '_none'));
+ $edit = array('card_2[]' => array('_none' => '_none'));
$this->drupalPost('entity_test/manage/' . $entity->id() . '/edit', $edit, t('Save'));
- $this->assertFieldValues($entity_init, 'card_2', $langcode, array());
+ $this->assertFieldValues($entity_init, 'card_2', array());
}
/**
@@ -496,8 +487,6 @@ function testOnOffCheckbox() {
))
->save();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
-
// Create an entity.
$entity = entity_create('entity_test', array(
'user_id' => 1,
@@ -508,26 +497,26 @@ function testOnOffCheckbox() {
// Display form: with no field data, option is unchecked.
$this->drupalGet('entity_test/manage/' . $entity->id() . '/edit');
- $this->assertNoFieldChecked("edit-bool-$langcode");
+ $this->assertNoFieldChecked('edit-bool');
$this->assertRaw('Some dangerous & unescaped markup', 'Option text was properly filtered.');
// Submit form: check the option.
- $edit = array("bool[$langcode]" => TRUE);
+ $edit = array('bool' => TRUE);
$this->drupalPost(NULL, $edit, t('Save'));
- $this->assertFieldValues($entity_init, 'bool', $langcode, array(1));
+ $this->assertFieldValues($entity_init, 'bool', array(1));
// Display form: check that the right options are selected.
$this->drupalGet('entity_test/manage/' . $entity->id() . '/edit');
- $this->assertFieldChecked("edit-bool-$langcode");
+ $this->assertFieldChecked('edit-bool');
// Submit form: uncheck the option.
- $edit = array("bool[$langcode]" => FALSE);
+ $edit = array('bool' => FALSE);
$this->drupalPost(NULL, $edit, t('Save'));
- $this->assertFieldValues($entity_init, 'bool', $langcode, array(0));
+ $this->assertFieldValues($entity_init, 'bool', array(0));
// Display form: with 'off' value, option is unchecked.
$this->drupalGet('entity_test/manage/' . $entity->id() . '/edit');
- $this->assertNoFieldChecked("edit-bool-$langcode");
+ $this->assertNoFieldChecked('edit-bool');
}
/**
diff --git a/core/modules/path/lib/Drupal/path/Tests/PathLanguageTest.php b/core/modules/path/lib/Drupal/path/Tests/PathLanguageTest.php
index 1724a4a..92ea19b 100644
--- a/core/modules/path/lib/Drupal/path/Tests/PathLanguageTest.php
+++ b/core/modules/path/lib/Drupal/path/Tests/PathLanguageTest.php
@@ -7,8 +7,6 @@
namespace Drupal\path\Tests;
-use Drupal\Core\Language\Language;
-
/**
* Tests URL aliases for translated nodes.
*/
@@ -76,9 +74,8 @@ function testAliasTranslation() {
$this->drupalGet('node/' . $english_node->id() . '/translate');
$this->clickLink(t('Add translation'));
$edit = array();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
- $edit["title"] = $this->randomName();
- $edit["body[$langcode][0][value]"] = $this->randomName();
+ $edit['title'] = $this->randomName();
+ $edit['body[0][value]'] = $this->randomName();
$french_alias = $this->randomName();
$edit['path[alias]'] = $french_alias;
$this->drupalPost(NULL, $edit, t('Save'));
diff --git a/core/modules/php/lib/Drupal/php/Tests/PhpFilterTest.php b/core/modules/php/lib/Drupal/php/Tests/PhpFilterTest.php
index 49e03b2..ea10aa7 100644
--- a/core/modules/php/lib/Drupal/php/Tests/PhpFilterTest.php
+++ b/core/modules/php/lib/Drupal/php/Tests/PhpFilterTest.php
@@ -7,8 +7,6 @@
namespace Drupal\php\Tests;
-use Drupal\Core\Language\Language;
-
/**
* Tests to make sure the PHP filter actually evaluates PHP code when used.
*/
@@ -39,8 +37,7 @@ function testPhpFilter() {
// Change filter to PHP filter and see that PHP code is evaluated.
$edit = array();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
- $edit["body[$langcode][0][format]"] = $this->php_code_format->format;
+ $edit['body[0][format]'] = $this->php_code_format->format;
$this->drupalPost('node/' . $node->id() . '/edit', $edit, t('Save'));
$this->assertRaw(t('Basic page %title has been updated.', array('%title' => $node->label())), 'PHP code filter turned on.');
diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/TrackerAttributesTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/TrackerAttributesTest.php
index 072fcc5..fd9b380 100644
--- a/core/modules/rdf/lib/Drupal/rdf/Tests/TrackerAttributesTest.php
+++ b/core/modules/rdf/lib/Drupal/rdf/Tests/TrackerAttributesTest.php
@@ -7,7 +7,6 @@
namespace Drupal\rdf\Tests;
-use Drupal\Core\Language\Language;
use Drupal\Core\Entity\EntityInterface;
use Drupal\simpletest\WebTestBase;
@@ -168,7 +167,7 @@ function _testBasicTrackerRdfaMarkup(EntityInterface $node) {
// Adds new comment to ensure the tracker is updated accordingly.
$comment = array(
'subject' => $this->randomName(),
- 'comment_body[' . Language::LANGCODE_NOT_SPECIFIED . '][0][value]' => $this->randomName(),
+ 'comment_body[0][value]' => $this->randomName(),
);
$this->drupalPost('comment/reply/' . $node->id(), $comment, t('Save'));
diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchCommentCountToggleTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchCommentCountToggleTest.php
index aab4c13..1f8d7d0 100644
--- a/core/modules/search/lib/Drupal/search/Tests/SearchCommentCountToggleTest.php
+++ b/core/modules/search/lib/Drupal/search/Tests/SearchCommentCountToggleTest.php
@@ -7,8 +7,6 @@
namespace Drupal\search\Tests;
-use Drupal\Core\Language\Language;
-
/**
* Tests that comment count display toggles properly on comment status of node
*
@@ -60,7 +58,7 @@ function setUp() {
// Create a comment array
$edit_comment = array();
$edit_comment['subject'] = $this->randomName();
- $edit_comment['comment_body[' . Language::LANGCODE_NOT_SPECIFIED . '][0][value]'] = $this->randomName();
+ $edit_comment['comment_body[0][value]'] = $this->randomName();
// Post comment to the test node with comment
$this->drupalPost('comment/reply/' . $this->searchable_nodes['1 comment']->id(), $edit_comment, t('Save'));
diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchCommentTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchCommentTest.php
index 2b256a2..d8cf4d4 100644
--- a/core/modules/search/lib/Drupal/search/Tests/SearchCommentTest.php
+++ b/core/modules/search/lib/Drupal/search/Tests/SearchCommentTest.php
@@ -7,8 +7,6 @@
namespace Drupal\search\Tests;
-use Drupal\Core\Language\Language;
-
/**
* Test integration searching comments.
*/
@@ -77,9 +75,9 @@ function testSearchResultsComment() {
// Post a comment using 'Full HTML' text format.
$edit_comment = array();
$edit_comment['subject'] = 'Test comment subject';
- $edit_comment['comment_body[' . Language::LANGCODE_NOT_SPECIFIED . '][0][value]'] = '' . $comment_body . '
';
+ $edit_comment['comment_body[0][value]'] = '' . $comment_body . '
';
$full_html_format_id = 'full_html';
- $edit_comment['comment_body[' . Language::LANGCODE_NOT_SPECIFIED . '][0][format]'] = $full_html_format_id;
+ $edit_comment['comment_body[0][format]'] = $full_html_format_id;
$this->drupalPost('comment/reply/' . $node->id(), $edit_comment, t('Save'));
// Invoke search index update.
@@ -105,7 +103,7 @@ function testSearchResultsComment() {
// Verify that comment is rendered using proper format.
$this->assertText($comment_body, 'Comment body text found in search results.');
$this->assertNoRaw(t('n/a'), 'HTML in comment body is not hidden.');
- $this->assertNoRaw(check_plain($edit_comment['comment_body[' . Language::LANGCODE_NOT_SPECIFIED . '][0][value]']), 'HTML in comment body is not escaped.');
+ $this->assertNoRaw(check_plain($edit_comment['comment_body[0][value]']), 'HTML in comment body is not escaped.');
// Hide comments.
$this->drupalLogin($this->admin_user);
@@ -137,7 +135,7 @@ function testSearchResultsCommentAccess() {
// Post a comment using 'Full HTML' text format.
$edit_comment = array();
$edit_comment['subject'] = $this->comment_subject;
- $edit_comment['comment_body[' . Language::LANGCODE_NOT_SPECIFIED . '][0][value]'] = '' . $comment_body . '
';
+ $edit_comment['comment_body[0][value]'] = '' . $comment_body . '
';
$this->drupalPost('comment/reply/' . $this->node->id(), $edit_comment, t('Save'));
$this->drupalLogout();
diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchConfigSettingsFormTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchConfigSettingsFormTest.php
index 7142b08..26f3ff0 100644
--- a/core/modules/search/lib/Drupal/search/Tests/SearchConfigSettingsFormTest.php
+++ b/core/modules/search/lib/Drupal/search/Tests/SearchConfigSettingsFormTest.php
@@ -7,8 +7,6 @@
namespace Drupal\search\Tests;
-use Drupal\Core\Language\Language;
-
/**
* Test config page.
*/
@@ -44,8 +42,7 @@ function setUp() {
$this->search_node = $node;
// Link the node to itself to test that it's only indexed once. The content
// also needs the word "pizza" so we can use it as the search keyword.
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
- $body_key = "body[$langcode][0][value]";
+ $body_key = 'body[0][value]';
$edit[$body_key] = l($node->label(), 'node/' . $node->id()) . ' pizza sandwich';
$this->drupalPost('node/' . $node->id() . '/edit', $edit, t('Save and keep published'));
diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchRankingTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchRankingTest.php
index c7055f3..6c18926 100644
--- a/core/modules/search/lib/Drupal/search/Tests/SearchRankingTest.php
+++ b/core/modules/search/lib/Drupal/search/Tests/SearchRankingTest.php
@@ -7,8 +7,6 @@
namespace Drupal\search\Tests;
-use Drupal\Core\Language\Language;
-
class SearchRankingTest extends SearchTestBase {
/**
@@ -86,7 +84,7 @@ public function testRankings() {
// Add a comment to one of the nodes.
$edit = array();
$edit['subject'] = 'my comment title';
- $edit['comment_body[' . Language::LANGCODE_NOT_SPECIFIED . '][0][value]'] = 'some random comment';
+ $edit['comment_body[0][value]'] = 'some random comment';
$this->drupalGet('comment/reply/' . $nodes['comments'][1]->id());
$this->drupalPost(NULL, $edit, t('Preview'));
$this->drupalPost(NULL, $edit, t('Save'));
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
index 1ebccca..c937ffa 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
@@ -1344,11 +1344,11 @@ protected function drupalGetAJAX($path, array $options = array(), array $headers
* @code
*
+ * name="body[0][value]">
* @endcode
* When testing this field using an $edit parameter, the code becomes:
* @code
- * $edit["body[und][0][value]"] = 'My test value';
+ * $edit["body[0][value]"] = 'My test value';
* @endcode
*
* A checkbox can be set to TRUE to be checked and should be set to FALSE to
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFormTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFormTest.php
index 3180909..576a163 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFormTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFormTest.php
@@ -7,7 +7,6 @@
namespace Drupal\system\Tests\Entity;
-use Drupal\Core\Language\Language;
use Drupal\simpletest\WebTestBase;
/**
@@ -53,7 +52,7 @@ function testFormCRUD() {
*/
function testEntityFormDisplayAlter() {
$this->drupalGet('entity_test/add');
- $altered_field = $this->xpath('//input[@name="field_test_text[und][0][value]" and @size="42"]');
+ $altered_field = $this->xpath('//input[@name="field_test_text[0][value]" and @size="42"]');
$this->assertTrue(count($altered_field) === 1, 'The altered field has the correct size value.');
}
@@ -64,14 +63,13 @@ function testEntityFormDisplayAlter() {
* The entity type to run the tests with.
*/
protected function assertFormCRUD($entity_type) {
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
$name1 = $this->randomName(8);
$name2 = $this->randomName(10);
$edit = array(
'name' => $name1,
'user_id' => mt_rand(0, 128),
- "field_test_text[$langcode][0][value]" => $this->randomName(16),
+ 'field_test_text[0][value]' => $this->randomName(16),
);
$this->drupalPost($entity_type . '/add', $edit, t('Save'));
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityRevisionsTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityRevisionsTest.php
index e2d31ab..6173cda 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityRevisionsTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityRevisionsTest.php
@@ -108,6 +108,6 @@ protected function assertRevisions($entity_type) {
$entity = entity_load($entity_type, $entity->id->value);
$this->drupalGet($entity_type . '/manage/' . $entity->id->value);
$this->assertFieldById('edit-name', $entity->name->value, format_string('%entity_type: Name matches in UI.', array('%entity_type' => $entity_type)));
- $this->assertFieldById('edit-field-test-text-und-0-value', $entity->field_test_text->value, format_string('%entity_type: Text matches in UI.', array('%entity_type' => $entity_type)));
+ $this->assertFieldById('edit-field-test-text-0-value', $entity->field_test_text->value, format_string('%entity_type: Text matches in UI.', array('%entity_type' => $entity_type)));
}
}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationFormTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationFormTest.php
index 68206a7..29f409b 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationFormTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationFormTest.php
@@ -60,9 +60,8 @@ function testEntityFormLanguage() {
// Create a node with language Language::LANGCODE_NOT_SPECIFIED.
$edit = array();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
$edit["title"] = $this->randomName(8);
- $edit["body[$langcode][0][value]"] = $this->randomName(16);
+ $edit['body[0][value]'] = $this->randomName(16);
$this->drupalGet('node/add/page');
$form_langcode = \Drupal::state()->get('entity_test.form_langcode') ?: FALSE;
@@ -92,9 +91,8 @@ function testEntityFormLanguage() {
// Create a node with language.
$edit = array();
$langcode = $this->langcodes[0];
- $field_langcode = Language::LANGCODE_NOT_SPECIFIED;
- $edit["title"] = $this->randomName(8);
- $edit["body[$field_langcode][0][value]"] = $this->randomName(16);
+ $edit['title'] = $this->randomName(8);
+ $edit['body[0][value]'] = $this->randomName(16);
$edit['langcode'] = $langcode;
$this->drupalPost('node/add/page', $edit, t('Save'));
$this->assertRaw(t('Basic page %title has been created.', array('%title' => $edit["title"])), 'Basic page created.');
diff --git a/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php b/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php
index 7d1814e..aa21621 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php
@@ -7,8 +7,6 @@
namespace Drupal\system\Tests\Menu;
-use Drupal\Core\Language\Language;
-
/**
* Menu breadcrumbs related tests.
*/
@@ -62,7 +60,6 @@ function testBreadCrumbs() {
$admin = $home + array('admin' => t('Administration'));
$config = $admin + array('admin/config' => t('Configuration'));
$type = 'article';
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
// Verify breadcrumbs for default local tasks.
$expected = array(
@@ -304,7 +301,7 @@ function testBreadCrumbs() {
'Breadcrumbs' => array(),
);
$edit = array(
- "field_tags[$langcode]" => implode(',', array_keys($tags)),
+ 'field_tags' => implode(',', array_keys($tags)),
);
$this->drupalPost('node/' . $parent->id() . '/edit', $edit, t('Save and keep published'));
diff --git a/core/modules/system/lib/Drupal/system/Tests/System/PageTitleTest.php b/core/modules/system/lib/Drupal/system/Tests/System/PageTitleTest.php
index d5fead5..2e45fd4 100644
--- a/core/modules/system/lib/Drupal/system/Tests/System/PageTitleTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/System/PageTitleTest.php
@@ -7,8 +7,6 @@
namespace Drupal\system\Tests\System;
-use Drupal\Component\Utility\String;
-use Drupal\Core\Language\Language;
use Drupal\Core\Utility\Title;
use Drupal\simpletest\WebTestBase;
@@ -72,10 +70,9 @@ function testTitleTags() {
drupal_set_title($title, PASS_THROUGH);
$this->assertTrue(strpos(drupal_get_title(), '') !== FALSE, 'Tags in title are not converted to entities when $output is PASS_THROUGH.');
// Generate node content.
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
$edit = array(
- "title" => '!SimpleTest! ' . $title . $this->randomName(20),
- "body[$langcode][0][value]" => '!SimpleTest! test body' . $this->randomName(200),
+ 'title' => '!SimpleTest! ' . $title . $this->randomName(20),
+ 'body[0][value]' => '!SimpleTest! test body' . $this->randomName(200),
);
// Create the node with HTML in the title.
$this->drupalPost('node/add/page', $edit, t('Save'));
diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/FieldUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/FieldUpgradePathTest.php
index 13793c6..32acf9a 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/FieldUpgradePathTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Upgrade/FieldUpgradePathTest.php
@@ -279,7 +279,7 @@ function testFieldUpgradeToConfig() {
$value = $this->randomName();
$edit = array(
'title' => 'Node after CMI conversion',
- 'body[und][0][value]' => $value,
+ 'body[0][value]' => $value,
);
$this->drupalPost('node/add/article', $edit, 'Save and publish');
$this->assertText($value);
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/LegacyTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/LegacyTest.php
index 3758df7..1397720 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/LegacyTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/LegacyTest.php
@@ -9,8 +9,6 @@
use Drupal\Core\Datetime\DrupalDateTime;
-use Drupal\Core\Language\Language;
-
/**
* Test for legacy node bug.
*/
@@ -37,14 +35,13 @@ function setUp() {
*/
function testTaxonomyLegacyNode() {
// Posts an article with a taxonomy term and a date prior to 1970.
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
$date = new DrupalDateTime('1969-01-01 00:00:00');
$edit = array();
$edit['title'] = $this->randomName();
$edit['date[date]'] = $date->format('Y-m-d');
$edit['date[time]'] = $date->format('H:i:s');
- $edit["body[$langcode][0][value]"] = $this->randomName();
- $edit["field_tags[$langcode]"] = $this->randomName();
+ $edit['body[0][value]'] = $this->randomName();
+ $edit['field_tags'] = $this->randomName();
$this->drupalPost('node/add/article', $edit, t('Save and publish'));
// Checks that the node has been saved.
$node = $this->drupalGetNodeByTitle($edit['title']);
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/RssTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/RssTest.php
index 905cc14..8e7cfa8 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/RssTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/RssTest.php
@@ -7,8 +7,6 @@
namespace Drupal\taxonomy\Tests;
-use Drupal\Core\Language\Language;
-
/**
* Tests the rendering of term reference fields in RSS feeds.
*/
@@ -94,9 +92,8 @@ function testTaxonomyRss() {
// Post an article.
$edit = array();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
$edit["title"] = $this->randomName();
- $edit[$this->field_name . '[' . $langcode . '][]'] = $term1->id();
+ $edit[$this->field_name . '[]'] = $term1->id();
$this->drupalPost('node/add/article', $edit, t('Save'));
// Check that the term is displayed when the RSS feed is viewed.
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldMultipleVocabularyTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldMultipleVocabularyTest.php
index 4cfb173..74f4cc8 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldMultipleVocabularyTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldMultipleVocabularyTest.php
@@ -7,8 +7,6 @@
namespace Drupal\taxonomy\Tests;
-use Drupal\Core\Language\Language;
-
/**
* Tests a taxonomy term reference field that allows multiple vocabularies.
*/
@@ -86,13 +84,12 @@ function testTaxonomyTermFieldMultipleVocabularies() {
$term2 = $this->createTerm($this->vocabulary2);
// Submit an entity with both terms.
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
$this->drupalGet('entity_test/add');
- $this->assertFieldByName("{$this->field_name}[$langcode][]", '', 'Widget is displayed');
+ $this->assertFieldByName("{$this->field_name}[]", '', 'Widget is displayed');
$edit = array(
'user_id' => mt_rand(0, 10),
'name' => $this->randomName(),
- "{$this->field_name}[$langcode][]" => array($term1->id(), $term2->id()),
+ "{$this->field_name}[]" => array($term1->id(), $term2->id()),
);
$this->drupalPost(NULL, $edit, t('Save'));
preg_match('|entity_test/manage/(\d+)/edit|', $this->url, $match);
@@ -131,13 +128,13 @@ function testTaxonomyTermFieldMultipleVocabularies() {
// The widget should still be displayed.
$this->drupalGet('entity_test/add');
- $this->assertFieldByName("{$this->field_name}[$langcode][]", '', 'Widget is still displayed');
+ $this->assertFieldByName("{$this->field_name}[]", '', 'Widget is still displayed');
// Term 1 should still pass validation.
$edit = array(
'user_id' => mt_rand(0, 10),
'name' => $this->randomName(),
- "{$this->field_name}[$langcode][]" => array($term1->id()),
+ "{$this->field_name}[]" => array($term1->id()),
);
$this->drupalPost(NULL, $edit, t('Save'));
}
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldTest.php
index 1fee5c3..a054d52 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldTest.php
@@ -7,8 +7,6 @@
namespace Drupal\taxonomy\Tests;
-use Drupal\Core\Language\Language;
-
/**
* Tests for taxonomy term field and formatter.
*/
@@ -103,15 +101,14 @@ function testTaxonomyTermFieldWidgets() {
$term = $this->createTerm($this->vocabulary);
// Display creation form.
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
$this->drupalGet('entity_test/add');
- $this->assertFieldByName("{$this->field_name}[$langcode]", '', 'Widget is displayed.');
+ $this->assertFieldByName($this->field_name, '', 'Widget is displayed.');
// Submit with some value.
$edit = array(
'user_id' => 1,
'name' => $this->randomName(),
- "{$this->field_name}[$langcode]" => array($term->id()),
+ $this->field_name => array($term->id()),
);
$this->drupalPost(NULL, $edit, t('Save'));
preg_match('|entity_test/manage/(\d+)/edit|', $this->url, $match);
@@ -130,7 +127,7 @@ function testTaxonomyTermFieldWidgets() {
// Delete the vocabulary and verify that the widget is gone.
$this->vocabulary->delete();
$this->drupalGet('entity_test/add');
- $this->assertNoFieldByName("{$this->field_name}[$langcode]", '', 'Widget is not displayed');
+ $this->assertNoFieldByName($this->field_name, '', 'Widget is not displayed');
}
/**
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermIndexTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermIndexTest.php
index 240b19c..ad8a869 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermIndexTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermIndexTest.php
@@ -7,8 +7,6 @@
namespace Drupal\taxonomy\Tests;
-use Drupal\Core\Language\Language;
-
/**
* Tests the hook implementations that maintain the taxonomy index.
*/
@@ -105,11 +103,10 @@ function testTaxonomyIndex() {
// Post an article.
$edit = array();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
$edit["title"] = $this->randomName();
- $edit["body[$langcode][0][value]"] = $this->randomName();
- $edit["{$this->field_name_1}[$langcode][]"] = $term_1->id();
- $edit["{$this->field_name_2}[$langcode][]"] = $term_1->id();
+ $edit['body[0][value]'] = $this->randomName();
+ $edit["{$this->field_name_1}[]"] = $term_1->id();
+ $edit["{$this->field_name_2}[]"] = $term_1->id();
$this->drupalPost('node/add/article', $edit, t('Save'));
// Check that the term is indexed, and only once.
@@ -121,7 +118,7 @@ function testTaxonomyIndex() {
$this->assertEqual(1, $index_count, 'Term 1 is indexed once.');
// Update the article to change one term.
- $edit["{$this->field_name_1}[$langcode][]"] = $term_2->id();
+ $edit["{$this->field_name_1}[]"] = $term_2->id();
$this->drupalPost('node/' . $node->id() . '/edit', $edit, t('Save'));
// Check that both terms are indexed.
@@ -137,7 +134,7 @@ function testTaxonomyIndex() {
$this->assertEqual(1, $index_count, 'Term 2 is indexed.');
// Update the article to change another term.
- $edit["{$this->field_name_2}[$langcode][]"] = $term_2->id();
+ $edit["{$this->field_name_2}[]"] = $term_2->id();
$this->drupalPost('node/' . $node->id() . '/edit', $edit, t('Save'));
// Check that only one term is indexed.
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php
index 53e65b4..fa17877 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php
@@ -7,8 +7,6 @@
namespace Drupal\taxonomy\Tests;
-use Drupal\Core\Language\Language;
-
/**
* Tests for taxonomy term functions.
*/
@@ -111,10 +109,9 @@ function testTaxonomyNode() {
// Post an article.
$edit = array();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
- $edit["title"] = $this->randomName();
- $edit["body[$langcode][0][value]"] = $this->randomName();
- $edit[$this->instance['field_name'] . '[' . $langcode . '][]'] = $term1->id();
+ $edit['title'] = $this->randomName();
+ $edit['body[0][value]'] = $this->randomName();
+ $edit[$this->instance['field_name'] . '[]'] = $term1->id();
$this->drupalPost('node/add/article', $edit, t('Save'));
// Check that the term is displayed when the node is viewed.
@@ -128,7 +125,7 @@ function testTaxonomyNode() {
$this->assertText($term1->label(), 'Term is displayed after saving the node with no changes.');
// Edit the node with a different term.
- $edit[$this->instance['field_name'] . '[' . $langcode . '][]'] = $term2->id();
+ $edit[$this->instance['field_name'] . '[]'] = $term2->id();
$this->drupalPost('node/' . $node->id() . '/edit', $edit, t('Save'));
$this->drupalGet('node/' . $node->id());
@@ -163,12 +160,11 @@ function testNodeTermCreationAndDeletion() {
);
$edit = array();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
- $edit["title"] = $this->randomName();
- $edit["body[$langcode][0][value]"] = $this->randomName();
+ $edit['title'] = $this->randomName();
+ $edit['body[0][value]'] = $this->randomName();
// Insert the terms in a comma separated list. Vocabulary 1 is a
// free-tagging field created by the default profile.
- $edit[$instance['field_name'] . "[$langcode]"] = drupal_implode_tags($terms);
+ $edit[$instance['field_name']] = drupal_implode_tags($terms);
// Verify the placeholder is there.
$this->drupalGet('node/add/article');
@@ -520,11 +516,10 @@ function testReSavingTags() {
// Create a term and a node using it.
$term = $this->createTerm($this->vocabulary);
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
$edit = array();
- $edit["title"] = $this->randomName(8);
- $edit["body[$langcode][0][value]"] = $this->randomName(16);
- $edit[$this->instance['field_name'] . '[' . $langcode . ']'] = $term->label();
+ $edit['title'] = $this->randomName(8);
+ $edit['body[0][value]'] = $this->randomName(16);
+ $edit[$this->instance['field_name']] = $term->label();
$this->drupalPost('node/add/article', $edit, t('Save'));
// Check that the term is displayed when editing and saving the node with no
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php
index d785f2f..3dbae42 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php
@@ -27,7 +27,6 @@ function setUp() {
$this->admin_user = $this->drupalCreateUser(array('administer taxonomy', 'bypass node access'));
$this->drupalLogin($this->admin_user);
$this->vocabulary = $this->createVocabulary();
- $this->langcode = Language::LANGCODE_NOT_SPECIFIED;
$this->field_name = 'taxonomy_' . $this->vocabulary->id();
entity_create('field_entity', array(
'name' => $this->field_name,
@@ -81,7 +80,7 @@ function testTaxonomyTokenReplacement() {
// Create node with term2.
$edit = array();
$node = $this->drupalCreateNode(array('type' => 'article'));
- $edit[$this->field_name . '[' . $this->langcode . '][]'] = $term2->id();
+ $edit[$this->field_name . '[]'] = $term2->id();
$this->drupalPost('node/' . $node->id() . '/edit', $edit, t('Save'));
// Generate and test sanitized tokens for term1.
diff --git a/core/modules/telephone/lib/Drupal/telephone/Tests/TelephoneFieldTest.php b/core/modules/telephone/lib/Drupal/telephone/Tests/TelephoneFieldTest.php
index 8e290ba..73add51 100644
--- a/core/modules/telephone/lib/Drupal/telephone/Tests/TelephoneFieldTest.php
+++ b/core/modules/telephone/lib/Drupal/telephone/Tests/TelephoneFieldTest.php
@@ -82,13 +82,13 @@ function testTelephoneField() {
// Display creation form.
$this->drupalGet('node/add/article');
- $this->assertFieldByName("field_telephone[und][0][value]", '', 'Widget found.');
+ $this->assertFieldByName("field_telephone[0][value]", '', 'Widget found.');
$this->assertRaw('placeholder="123-456-7890"');
// Test basic entery of telephone field.
$edit = array(
"title" => $this->randomName(),
- "field_telephone[und][0][value]" => "123456789",
+ "field_telephone[0][value]" => "123456789",
);
$this->drupalPost(NULL, $edit, t('Save'));
@@ -97,7 +97,7 @@ function testTelephoneField() {
// Add number with a space in it. Need to ensure it is stripped on output.
$edit = array(
"title" => $this->randomName(),
- "field_telephone[und][0][value]" => "1234 56789",
+ "field_telephone[0][value]" => "1234 56789",
);
$this->drupalPost('node/add/article', $edit, t('Save'));
diff --git a/core/modules/text/lib/Drupal/text/Tests/TextFieldTest.php b/core/modules/text/lib/Drupal/text/Tests/TextFieldTest.php
index 229615f..b5d6501 100644
--- a/core/modules/text/lib/Drupal/text/Tests/TextFieldTest.php
+++ b/core/modules/text/lib/Drupal/text/Tests/TextFieldTest.php
@@ -7,7 +7,6 @@
namespace Drupal\text\Tests;
-use Drupal\Core\Language\Language;
use Drupal\simpletest\WebTestBase;
/**
@@ -119,12 +118,10 @@ function _testTextfieldWidgets($field_type, $widget_type) {
->setComponent($this->field_name)
->save();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
-
// Display creation form.
$this->drupalGet('entity_test/add');
- $this->assertFieldByName("{$this->field_name}[$langcode][0][value]", '', 'Widget is displayed');
- $this->assertNoFieldByName("{$this->field_name}[$langcode][0][format]", '1', 'Format selector is not displayed');
+ $this->assertFieldByName("{$this->field_name}[0][value]", '', 'Widget is displayed');
+ $this->assertNoFieldByName("{$this->field_name}[0][format]", '1', 'Format selector is not displayed');
$this->assertRaw(format_string('placeholder="A placeholder on !widget_type"', array('!widget_type' => $widget_type)));
// Submit with some value.
@@ -132,7 +129,7 @@ function _testTextfieldWidgets($field_type, $widget_type) {
$edit = array(
'user_id' => 1,
'name' => $this->randomName(),
- "{$this->field_name}[$langcode][0][value]" => $value,
+ "{$this->field_name}[0][value]" => $value,
);
$this->drupalPost(NULL, $edit, t('Save'));
preg_match('|entity_test/manage/(\d+)/edit|', $this->url, $match);
@@ -185,8 +182,6 @@ function _testTextfieldWidgetsFormatted($field_type, $widget_type) {
->setComponent($this->field_name)
->save();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
-
// Disable all text formats besides the plain text fallback format.
$this->drupalLogin($this->admin_user);
foreach (filter_formats() as $format) {
@@ -199,15 +194,15 @@ function _testTextfieldWidgetsFormatted($field_type, $widget_type) {
// Display the creation form. Since the user only has access to one format,
// no format selector will be displayed.
$this->drupalGet('entity_test/add');
- $this->assertFieldByName("{$this->field_name}[$langcode][0][value]", '', 'Widget is displayed');
- $this->assertNoFieldByName("{$this->field_name}[$langcode][0][format]", '', 'Format selector is not displayed');
+ $this->assertFieldByName("{$this->field_name}[0][value]", '', 'Widget is displayed');
+ $this->assertNoFieldByName("{$this->field_name}[0][format]", '', 'Format selector is not displayed');
// Submit with data that should be filtered.
$value = '' . $this->randomName() . '';
$edit = array(
'user_id' => 1,
'name' => $this->randomName(),
- "{$this->field_name}[$langcode][0][value]" => $value,
+ "{$this->field_name}[0][value]" => $value,
);
$this->drupalPost(NULL, $edit, t('Save'));
preg_match('|entity_test/manage/(\d+)/edit|', $this->url, $match);
@@ -243,14 +238,14 @@ function _testTextfieldWidgetsFormatted($field_type, $widget_type) {
// Display edition form.
// We should now have a 'text format' selector.
$this->drupalGet('entity_test/manage/' . $id . '/edit');
- $this->assertFieldByName("{$this->field_name}[$langcode][0][value]", NULL, 'Widget is displayed');
- $this->assertFieldByName("{$this->field_name}[$langcode][0][format]", NULL, 'Format selector is displayed');
+ $this->assertFieldByName("{$this->field_name}[0][value]", NULL, 'Widget is displayed');
+ $this->assertFieldByName("{$this->field_name}[0][format]", NULL, 'Format selector is displayed');
// Edit and change the text format to the new one that was created.
$edit = array(
'user_id' => 1,
'name' => $this->randomName(),
- "{$this->field_name}[$langcode][0][format]" => $format_id,
+ "{$this->field_name}[0][format]" => $format_id,
);
$this->drupalPost(NULL, $edit, t('Save'));
$this->assertText(t('entity_test @id has been updated.', array('@id' => $id)), 'Entity was updated');
diff --git a/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php b/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php
index b11df97..f85f2de 100644
--- a/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php
+++ b/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php
@@ -7,7 +7,6 @@
namespace Drupal\tracker\Tests;
-use Drupal\Core\Language\Language;
use Drupal\simpletest\WebTestBase;
/**
@@ -111,7 +110,7 @@ function testTrackerUser() {
));
$comment = array(
'subject' => $this->randomName(),
- 'comment_body[' . Language::LANGCODE_NOT_SPECIFIED . '][0][value]' => $this->randomName(20),
+ 'comment_body[0][value]' => $this->randomName(20),
);
$this->drupalPost('comment/reply/' . $other_published_my_comment->id(), $comment, t('Save'));
@@ -171,7 +170,7 @@ function testTrackerNewComments() {
// Add a comment to the page.
$comment = array(
'subject' => $this->randomName(),
- 'comment_body[' . Language::LANGCODE_NOT_SPECIFIED . '][0][value]' => $this->randomName(20),
+ 'comment_body[0][value]' => $this->randomName(20),
);
// The new comment is automatically viewed by the current user.
$this->drupalPost('comment/reply/' . $node->id(), $comment, t('Save'));
@@ -184,7 +183,7 @@ function testTrackerNewComments() {
// Add another comment as other_user.
$comment = array(
'subject' => $this->randomName(),
- 'comment_body[' . Language::LANGCODE_NOT_SPECIFIED . '][0][value]' => $this->randomName(20),
+ 'comment_body[0][value]' => $this->randomName(20),
);
// If the comment is posted in the same second as the last one then Drupal
// can't tell the difference, so we wait one second here.
@@ -217,7 +216,7 @@ function testTrackerCronIndexing() {
$this->drupalLogin($this->other_user);
$comment = array(
'subject' => $this->randomName(),
- 'comment_body[' . Language::LANGCODE_NOT_SPECIFIED . '][0][value]' => $this->randomName(20),
+ 'comment_body[0][value]' => $this->randomName(20),
);
$this->drupalPost('comment/reply/' . $nodes[3]->id(), $comment, t('Save'));
diff --git a/core/modules/translation/lib/Drupal/translation/Tests/TranslationTest.php b/core/modules/translation/lib/Drupal/translation/Tests/TranslationTest.php
index 072b3df..9e90b5c 100644
--- a/core/modules/translation/lib/Drupal/translation/Tests/TranslationTest.php
+++ b/core/modules/translation/lib/Drupal/translation/Tests/TranslationTest.php
@@ -107,9 +107,8 @@ function testContentTranslation() {
// Attempt a resubmission of the form - this emulates using the back button
// to return to the page then resubmitting the form without a refresh.
$edit = array();
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
$edit["title"] = $this->randomName();
- $edit["body[$langcode][0][value]"] = $this->randomName();
+ $edit['body[0][value]'] = $this->randomName();
$this->drupalPost('node/add/page', $edit, t('Save'), array('query' => array('translation' => $node->id(), 'language' => 'es')));
$duplicate = $this->drupalGetNodeByTitle($edit["title"]);
$this->assertEqual($duplicate->tnid->value, 0, 'The node does not have a tnid.');
@@ -118,7 +117,7 @@ function testContentTranslation() {
$node_body = $this->randomName();
$node->body->value = $node_body;
$edit = array();
- $edit["body[$langcode][0][value]"] = $node_body;
+ $edit['body[0][value]'] = $node_body;
$edit['translation[retranslate]'] = TRUE;
$this->drupalPost('node/' . $node->id() . '/edit', $edit, t('Save'));
$this->assertRaw(t('Basic page %title has been updated.', array('%title' => $node_title)), 'Original node updated.');
@@ -129,7 +128,7 @@ function testContentTranslation() {
// Update translation and mark as updated.
$edit = array();
- $edit["body[$langcode][0][value]"] = $this->randomName();
+ $edit['body[0][value]'] = $this->randomName();
$edit['translation[status]'] = FALSE;
$this->drupalPost('node/' . $node_translation->id() . '/edit', $edit, t('Save'));
$this->assertRaw(t('Basic page %title has been updated.', array('%title' => $node_translation_title)), 'Translated node updated.');
@@ -349,9 +348,8 @@ function addLanguage($langcode) {
*/
function createPage($title, $body, $langcode = NULL) {
$edit = array();
- $field_langcode = Language::LANGCODE_NOT_SPECIFIED;
- $edit["title"] = $title;
- $edit["body[$field_langcode][0][value]"] = $body;
+ $edit['title'] = $title;
+ $edit['body[0][value]'] = $body;
if (!empty($langcode)) {
$edit['langcode'] = $langcode;
}
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php b/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php
index af8d8c9..1a5c437 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php
@@ -7,7 +7,6 @@
namespace Drupal\user\Tests;
-use Drupal\Core\Language\Language;
use Drupal\simpletest\WebTestBase;
/**
@@ -289,10 +288,9 @@ function testUserDelete() {
$node = $this->drupalCreateNode(array('uid' => $account->id()));
// Create comment.
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
$edit = array();
$edit['subject'] = $this->randomName(8);
- $edit['comment_body[' . $langcode . '][0][value]'] = $this->randomName(16);
+ $edit['comment_body[0][value]'] = $this->randomName(16);
$this->drupalPost('comment/reply/' . $node->id(), $edit, t('Preview'));
$this->drupalPost(NULL, array(), t('Save'));
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserPictureTest.php b/core/modules/user/lib/Drupal/user/Tests/UserPictureTest.php
index 4b79760..928ead9 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserPictureTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserPictureTest.php
@@ -130,7 +130,7 @@ function testPictureOnNodeComment() {
* Edits the user picture for the test user.
*/
function saveUserPicture($image) {
- $edit = array('files[user_picture_und_0]' => drupal_realpath($image->uri));
+ $edit = array('files[user_picture_0]' => drupal_realpath($image->uri));
$this->drupalPost('user/' . $this->web_user->id() . '/edit', $edit, t('Save'));
// Load actual user data from database.
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserRegistrationTest.php b/core/modules/user/lib/Drupal/user/Tests/UserRegistrationTest.php
index 0318e74..458218c 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserRegistrationTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserRegistrationTest.php
@@ -231,17 +231,17 @@ function testRegistrationWithUserFields() {
$edit['name'] = $name = $this->randomName();
$edit['mail'] = $mail = $edit['name'] . '@example.com';
// Missing input in required field.
- $edit['test_user_field[und][0][value]'] = '';
+ $edit['test_user_field[0][value]'] = '';
$this->drupalPost(NULL, $edit, t('Create new account'));
$this->assertRaw(t('@name field is required.', array('@name' => $instance->label())), 'Field validation error was correctly reported.');
// Invalid input.
- $edit['test_user_field[und][0][value]'] = '-1';
+ $edit['test_user_field[0][value]'] = '-1';
$this->drupalPost(NULL, $edit, t('Create new account'));
$this->assertRaw(t('%name does not accept the value -1.', array('%name' => $instance->label())), 'Field validation error was correctly reported.');
// Submit with valid data.
$value = rand(1, 255);
- $edit['test_user_field[und][0][value]'] = $value;
+ $edit['test_user_field[0][value]'] = $value;
$this->drupalPost(NULL, $edit, t('Create new account'));
// Check user fields.
$accounts = entity_load_multiple_by_properties('user', array('name' => $name, 'mail' => $mail));
@@ -256,7 +256,7 @@ function testRegistrationWithUserFields() {
// Add two inputs.
$value = rand(1, 255);
$edit = array();
- $edit['test_user_field[und][0][value]'] = $value;
+ $edit['test_user_field[0][value]'] = $value;
if ($js == 'js') {
$this->drupalPostAJAX(NULL, $edit, 'test_user_field_add_more');
$this->drupalPostAJAX(NULL, $edit, 'test_user_field_add_more');
@@ -266,8 +266,8 @@ function testRegistrationWithUserFields() {
$this->drupalPost(NULL, $edit, t('Add another item'));
}
// Submit with three values.
- $edit['test_user_field[und][1][value]'] = $value + 1;
- $edit['test_user_field[und][2][value]'] = $value + 2;
+ $edit['test_user_field[1][value]'] = $value + 1;
+ $edit['test_user_field[2][value]'] = $value + 2;
$edit['name'] = $name = $this->randomName();
$edit['mail'] = $mail = $edit['name'] . '@example.com';
$this->drupalPost(NULL, $edit, t('Create new account'));
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserSignatureTest.php b/core/modules/user/lib/Drupal/user/Tests/UserSignatureTest.php
index 5a8cd0e..756999d 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserSignatureTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserSignatureTest.php
@@ -7,7 +7,6 @@
namespace Drupal\user\Tests;
-use Drupal\Core\Language\Language;
use Drupal\simpletest\WebTestBase;
/**
@@ -101,10 +100,9 @@ function testUserSignature() {
$this->assertFieldByName('signature[value]', $edit['signature[value]'], 'Submitted signature text found.');
// Create a comment.
- $langcode = Language::LANGCODE_NOT_SPECIFIED;
$edit = array();
$edit['subject'] = $this->randomName(8);
- $edit['comment_body[' . $langcode . '][0][value]'] = $this->randomName(16);
+ $edit['comment_body[0][value]'] = $this->randomName(16);
$this->drupalPost('comment/reply/' . $node->id(), $edit, t('Preview'));
$this->drupalPost(NULL, array(), t('Save'));
@@ -116,7 +114,7 @@ function testUserSignature() {
// Log in as an administrator and edit the comment to use Full HTML, so
// that the comment text itself is not filtered at all.
$this->drupalLogin($this->admin_user);
- $edit['comment_body[' . $langcode . '][0][format]'] = $this->full_html_format->format;
+ $edit['comment_body[0][format]'] = $this->full_html_format->format;
$this->drupalPost('comment/' . $comment_id . '/edit', $edit, t('Save'));
// Assert that the signature did not make it through unfiltered.
diff --git a/core/modules/views/lib/Drupal/views/Tests/Wizard/TaggedWithTest.php b/core/modules/views/lib/Drupal/views/Tests/Wizard/TaggedWithTest.php
index c7ec4e0..b6a3646 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Wizard/TaggedWithTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Wizard/TaggedWithTest.php
@@ -7,8 +7,6 @@
namespace Drupal\views\Tests\Wizard;
-use Drupal\Core\Language\Language;
-
/**
* Tests the ability of the views wizard to create views filtered by taxonomy.
*/
@@ -109,14 +107,13 @@ function testTaggedWith() {
$node_add_path = 'node/add/' . $this->node_type_with_tags->type;
// Create three nodes, with different tags.
- $tag_field = $this->tag_field->name . '[' . Language::LANGCODE_NOT_SPECIFIED . ']';
$edit = array();
$edit['title'] = $node_tag1_title = $this->randomName();
- $edit[$tag_field] = 'tag1';
+ $edit[$this->tag_field->name] = 'tag1';
$this->drupalPost($node_add_path, $edit, t('Save'));
$edit = array();
$edit['title'] = $node_tag1_tag2_title = $this->randomName();
- $edit[$tag_field] = 'tag1, tag2';
+ $edit[$this->tag_field->name] = 'tag1, tag2';
$this->drupalPost($node_add_path, $edit, t('Save'));
$edit = array();
$edit['title'] = $node_no_tags_title = $this->randomName();