You are here

function RegistrationStandardTestCase::testRegistrationCreateAccess in Entity Registration 8.2

Same name in this branch
  1. 8.2 tests/registration.test \RegistrationStandardTestCase::testRegistrationCreateAccess()
  2. 8.2 src/RegistrationStandardTestCase.php \Drupal\registration\RegistrationStandardTestCase::testRegistrationCreateAccess()

File

src/RegistrationStandardTestCase.php, line 246

Class

RegistrationStandardTestCase
Creates a registration type Create node entity type ensure registration type exists

Namespace

Drupal\registration

Code

function testRegistrationCreateAccess() {

  // With permissions.
  $permissions = array(
    'create ' . $this->registration_type_name . ' registration',
    'create own ' . $this->registration_type_name . ' registration',
  );
  $this
    ->checkPermissions($permissions, TRUE);

  // Reset permission cache
  $user = $this
    ->drupalCreateUser($permissions);
  $this
    ->drupalLogin($user);
  $this
    ->drupalGet($this->host_entity_path . '/register');
  $this
    ->assertResponse(403, t('Close default host entity status (database).'), 'Registration');
  $this
    ->setHostEntitySettings(array(
    'status' => 1,
  ));
  $this
    ->drupalGet($this->host_entity_path . '/register');
  $this
    ->assertResponse(200, t('Open default host entity status (database).'), 'Registration');
  $this
    ->assertRaw(t('Save Registration'), t('User with create permissions access register tab.'), 'Registration');
  $this
    ->assertFieldByName('who_is_registering');
}