You are here

public function RequiredByRoleCommonWebTestCase::DotestDefaultValueIsNotRequired in Required by role 7.2

Same name and namespace in other branches
  1. 7 tests/required_by_role_test/RequiredByRoleCommonWebTestCase.test \RequiredByRoleCommonWebTestCase::DotestDefaultValueIsNotRequired()

Check if the default_value_widget is always NOT required.

1 call to RequiredByRoleCommonWebTestCase::DotestDefaultValueIsNotRequired()
RequiredByRoleCommonWebTestCase::testCommonBehaviors in tests/required_by_role_test/RequiredByRoleCommonWebTestCase.test
Group the tests for better performance.

File

tests/required_by_role_test/RequiredByRoleCommonWebTestCase.test, line 179
Tests for the common cases.

Class

RequiredByRoleCommonWebTestCase
@file Tests for the common cases.

Code

public function DotestDefaultValueIsNotRequired() {
  $field_name = $this
    ->getFieldMachineName();
  $label = $this
    ->getFieldLabel();
  $edit = array();
  $this
    ->drupalPost('admin/structure/types/manage/' . $this->entity_bundle . '/fields/' . $field_name, $edit, t('Save settings'));

  // We shouldn´t get a field mandatory error message.
  $expected_error = t('@label field is required.', array(
    '@label' => $label,
  ));
  $this
    ->assertNoText($expected_error, 'Default value widget is not required.');

  // We should get a success message.
  $expected_success = t('Saved @label configuration.', array(
    '@label' => $label,
  ));
  $this
    ->assertText($expected_success, 'Default value widget is not required.');
}