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/CommentLanguageTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentLanguageTest.php
index 4064b22..ca6c4fd 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentLanguageTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentLanguageTest.php
@@ -109,7 +109,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/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..8f10392 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
@@ -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/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..f759e6d 100644
--- a/core/modules/field/field.deprecated.inc
+++ b/core/modules/field/field.deprecated.inc
@@ -491,46 +491,41 @@ function field_read_instances($conditions = array(), $include_additional = array
* '#tree' => TRUE,
* '#field_name' => The name of the field,
* '#language' => $langcode,
- * $langcode => array(
+ * '#field_parents' => The 'parents' space for the field in the form, equal
+ * to the #parents property of the $form parameter received by
+ * field_attach_form(),
+ * '#required' => Whether or not the field is required,
+ * '#title' => The label of the field instance,
+ * '#description' => The description text for the field instance,
+ *
+ * // Only for 'single' widgets:
+ * '#theme' => 'field_multiple_value_form',
+ * '#cardinality' => The field cardinality,
+ * // One sub-array per copy of the widget, keyed by delta.
+ * 0 => array(
+ * '#entity_type' => The name of the entity type,
+ * '#bundle' => The name of the bundle,
* '#field_name' => The name of the field,
- * '#language' => $langcode,
* '#field_parents' => The 'parents' space for the field in the form,
* equal to the #parents property of the $form parameter received by
* field_attach_form(),
- * '#required' => Whether or not the field is required,
- * '#title' => The label of the field instance,
- * '#description' => The description text for the field instance,
- *
- * // Only for 'single' widgets:
- * '#theme' => 'field_multiple_value_form',
- * '#cardinality' => The field cardinality,
- * // One sub-array per copy of the widget, keyed by delta.
- * 0 => array(
- * '#entity_type' => The name of the entity type,
- * '#bundle' => The name of the bundle,
- * '#field_name' => The name of the field,
- * '#field_parents' => The 'parents' space for the field in the form,
- * equal to the #parents property of the $form parameter received by
- * field_attach_form(),
- * '#title' => The title to be displayed by the widget,
- * '#default_value' => The field value for delta 0,
- * '#required' => Whether the widget should be marked required,
- * '#delta' => 0,
- * // The remaining elements in the sub-array depend on the widget.
- * '#type' => The type of the widget,
- * ...
- * ),
- * 1 => array(
- * ...
- * ),
- *
- * // Only for multiple widgets:
- * '#entity_type' => The name of the entity type,
- * '#bundle' => $instance['bundle'],
+ * '#title' => The title to be displayed by the widget,
+ * '#default_value' => The field value for delta 0,
+ * '#required' => Whether the widget should be marked required,
+ * '#delta' => 0,
* // The remaining elements in the sub-array depend on the widget.
* '#type' => The type of the widget,
* ...
* ),
+ * 1 => array(
+ * ...
+ * ),
+ *
+ * // Only for multiple widgets:
+ * '#entity_type' => The name of the entity type,
+ * '#bundle' => $instance['bundle'],
+ * // The remaining elements in the sub-array depend on the widget.
+ * '#type' => The type of the widget,
* ...
* ),
* )
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..8bcb803 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,30 @@ 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),
+ // Force field access.
+ $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()),
+ ),
+ ),
+ 'widget' => $elements,
+ ),
);
- return $addition;
+ return $return;
}
/**
@@ -285,7 +280,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/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..e0183af 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->assertEqual($form[$field_name_no_access][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.');
// 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..8da0809 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,40 +90,40 @@ 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'));
$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.');
@@ -135,15 +132,15 @@ function testNestedFieldForm() {
// 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_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/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/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/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/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..a6e643d 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/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/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/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/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/EntityTranslationFormTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationFormTest.php
index 68206a7..4bf58bc 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;
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/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..364c636 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/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/translation/lib/Drupal/translation/Tests/TranslationTest.php b/core/modules/translation/lib/Drupal/translation/Tests/TranslationTest.php
index 072b3df..f60806a 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.');
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'));