You are here

public function StringTest::testFieldString in Field Defaults 8

Test updating a boolean.

File

src/Tests/StringTest.php, line 15

Class

StringTest
Tests that defaults are set on string fields.

Namespace

Drupal\field_defaults\Tests

Code

public function testFieldString() {
  $fieldName = $this
    ->createField('string');
  $this
    ->setDefaultValues($fieldName, 'string');

  // Ensure value is checked on any random node.
  $this
    ->drupalGet('node/' . rand(1, 20) . '/edit');
  $field_setup = $this
    ->setupFieldByType('string');
  $this
    ->assertFieldByName('field_' . $fieldName . $field_setup['structure'], $field_setup['value']);
}