public function RequiredByRoleDateFieldWebTestCase::DotestIsNonRequiredRole in Required by role 7
Test for non-required role.
1 call to RequiredByRoleDateFieldWebTestCase::DotestIsNonRequiredRole()
- RequiredByRoleDateFieldWebTestCase::testDoTests in tests/
required_by_role_test/ RequiredByRoleDateFieldWebTestCase.test - Grouping testing method.
File
- tests/
required_by_role_test/ RequiredByRoleDateFieldWebTestCase.test, line 120 - Tests for the Email field.
Class
- RequiredByRoleDateFieldWebTestCase
- @file Tests for the Email field.
Code
public function DotestIsNonRequiredRole() {
$this
->drupalLogin($this
->getNonRequiredUser());
$edit = array();
$edit['title'] = $this
->randomName(8);
$edit['body[und][0][value]'] = $this
->randomName(16);
$rid = (int) $this->required_fields_rid;
$required_by_role_settings = array(
$rid => $rid,
);
// Create a date fields with simple values.
foreach (array(
'date',
'datestamp',
'datetime',
) as $field_type) {
foreach (array(
'date_select',
'date_popup',
'date_text',
) as $widget_type) {
$field_name = "field_test_{$widget_type}";
$label = 'Test';
$options = array(
'label' => $label,
'widget_type' => $widget_type,
'field_name' => $field_name,
'field_type' => $field_type,
'input_format' => 'm/d/Y - H:i',
);
$this
->createDateField($options, $required_by_role_settings);
$this
->drupalPost('node/add/' . $this->entity_bundle, $edit, t('Save'));
$this
->assertText($edit['title'], "Node has been created");
$this
->deleteDateField($label);
}
}
$this
->drupalLogout();
}