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 0185523..da5ac4f 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 @@ -25,14 +25,14 @@ class CustomBlockFieldTest extends CustomBlockTestBase { /** * The created field. * - * @var array + * @var \Drupal\field\Plugin\Core\Entity\Field */ protected $field; /** - * The created instance + * The created instance. * - * @var array + * @var \Drupal\field\Plugin\Core\Entity\FieldInstance */ protected $instance; diff --git a/core/modules/contact/lib/Drupal/contact/Tests/Views/ContactFieldsTest.php b/core/modules/contact/lib/Drupal/contact/Tests/Views/ContactFieldsTest.php index e7c7aa1..166a64b 100644 --- a/core/modules/contact/lib/Drupal/contact/Tests/Views/ContactFieldsTest.php +++ b/core/modules/contact/lib/Drupal/contact/Tests/Views/ContactFieldsTest.php @@ -24,7 +24,7 @@ class ContactFieldsTest extends ViewTestBase { /** * Contains the field definition array attached to contact used for this test. * - * @var array + * @var \Drupal\field\Plugin\Core\Entity\Field */ protected $field; diff --git a/core/modules/datetime/lib/Drupal/datetime/Tests/DatetimeFieldTest.php b/core/modules/datetime/lib/Drupal/datetime/Tests/DatetimeFieldTest.php index 7c56c3e..43ff047 100644 --- a/core/modules/datetime/lib/Drupal/datetime/Tests/DatetimeFieldTest.php +++ b/core/modules/datetime/lib/Drupal/datetime/Tests/DatetimeFieldTest.php @@ -26,10 +26,17 @@ class DatetimeFieldTest extends WebTestBase { /** * A field to use in this test class. * - * @var \Drupal\Core\Datetime\DrupalDateTime + * @var \Drupal\field\Plugin\Core\Entity\Field */ protected $field; + /** + * A field to use in this test class. + * + * @var \Drupal\field\Plugin\Core\Entity\FieldInstance + */ + protected $instance; + public static function getInfo() { return array( 'name' => 'Datetime Field', @@ -89,8 +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}[$langcode][0][value][date]", '', 'Date element found.'); + $this->assertNoFieldByName("{$field_name}[$langcode][0][value][time]", '', 'Time element not found.'); // Submit a valid date and ensure it is accepted. $value = '2012-12-31 00:00:00'; @@ -102,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}[$langcode][0][value][date]" => $date->format($date_format), ); $this->drupalPost(NULL, $edit, t('Save')); preg_match('|entity_test/manage/(\d+)/edit|', $this->url, $match); @@ -160,8 +167,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}[$langcode][0][value][date]", '', 'Date element found.'); + $this->assertFieldByName("{$field_name}[$langcode][0][value][time]", '', 'Time element found.'); // Submit a valid date and ensure it is accepted. $value = '2012-12-31 00:00:00'; @@ -173,8 +180,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}[$langcode][0][value][date]" => $date->format($date_format), + "{$field_name}[$langcode][0][value][time]" => $date->format($time_format), ); $this->drupalPost(NULL, $edit, t('Save')); preg_match('|entity_test/manage/(\d+)/edit|', $this->url, $match); @@ -267,7 +274,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}[$langcode][0][value][$part]"] = $value; } $this->drupalPost(NULL, $edit, t('Save')); @@ -308,8 +315,8 @@ function testDefaultValue() { // 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}[$langcode][0][value][date]", $date->format($date_format), 'Date element found.'); + $this->assertNoFieldByName("{$field_name}[$langcode][0][value][time]", '', 'Time element found.'); // Set the default value to 'blank'. $this->instance->settings['default_value'] = 'blank'; @@ -321,8 +328,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}[$langcode][0][value][date]", '', 'Date element found.'); + $this->assertFieldByName("{$field_name}[$langcode][0][value][time]", '', 'Time element found.'); } /** @@ -338,38 +345,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}[$langcode][0][value][date]", '', 'Date element found.'); + $this->assertFieldByName("{$field_name}[$langcode][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}[$langcode][0][value][date]" => $date_value, + "{$field_name}[$langcode][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}[$langcode][0][value][date]" => $date_value, + "{$field_name}[$langcode][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}[$langcode][0][value][date]" => $date_value, + "{$field_name}[$langcode][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}[$langcode][0][value][date]" => $date_value, + "{$field_name}[$langcode][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))); @@ -377,8 +384,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}[$langcode][0][value][date]" => $date_value, + "{$field_name}[$langcode][0][value][time]" => $time_value, ); $this->drupalPost(NULL, $edit, t('Save')); $this->assertText('date is invalid', 'Empty time value has been caught.'); @@ -386,8 +393,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}[$langcode][0][value][date]" => $date_value, + "{$field_name}[$langcode][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))); @@ -395,8 +402,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}[$langcode][0][value][date]" => $date_value, + "{$field_name}[$langcode][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))); @@ -404,8 +411,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}[$langcode][0][value][date]" => $date_value, + "{$field_name}[$langcode][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/email/lib/Drupal/email/Tests/EmailFieldTest.php b/core/modules/email/lib/Drupal/email/Tests/EmailFieldTest.php index 2192cf3..af75fdb 100644 --- a/core/modules/email/lib/Drupal/email/Tests/EmailFieldTest.php +++ b/core/modules/email/lib/Drupal/email/Tests/EmailFieldTest.php @@ -22,6 +22,20 @@ class EmailFieldTest extends WebTestBase { */ public static $modules = array('node', 'entity_test', 'email', 'field_ui'); + /** + * A field to use in this test class. + * + * @var \Drupal\field\Plugin\Core\Entity\Field + */ + protected $field; + + /** + * A field to use in this test class. + * + * @var \Drupal\field\Plugin\Core\Entity\FieldInstance + */ + protected $instance; + public static function getInfo() { return array( 'name' => 'E-mail field', @@ -78,7 +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}[$langcode][0][value]", '', 'Widget found.'); $this->assertRaw('placeholder="example@example.com"'); // Submit a valid e-mail address and ensure it is accepted. @@ -86,7 +100,7 @@ function testEmailField() { $edit = array( 'user_id' => 1, 'name' => $this->randomName(), - "$field_name[$langcode][0][value]" => $value, + "{$field_name}[$langcode][0][value]" => $value, ); $this->drupalPost(NULL, $edit, t('Save')); preg_match('|entity_test/manage/(\d+)/edit|', $this->url, $match);