You are here

function RequiredByRoleImageFieldWebTestCase::testIsRequiredByRole in Required by role 7

Test for required and non-required roles

Return value

[type] [description]

File

tests/required_by_role_test/RequiredByRoleImageFieldWebTestCase.test, line 41
Tests for the Image field.

Class

RequiredByRoleImageFieldWebTestCase
@file Tests for the Image field.

Code

function testIsRequiredByRole() {
  $edit = array();
  $edit['title'] = $this
    ->randomName(8);
  $edit['body[und][0][value]'] = $this
    ->randomName(16);
  $this
    ->drupalLogin($this
    ->getRequiredUser());
  $this
    ->drupalPost('node/add/' . $this->entity_bundle, $edit, t('Save'));
  $this
    ->assertText('Image field is required.');
  $this
    ->drupalLogout();
  $this
    ->drupalLogin($this
    ->getNonRequiredUser());
  $this
    ->drupalPost('node/add/' . $this->entity_bundle, $edit, t('Save'));
  $this
    ->assertText($edit['title'], "Node has been created");
  $this
    ->drupalLogout();
}