You are here

function RegistrationStandardTestCase::testRegistrationType in Entity Registration 7.2

Same name and namespace in other branches
  1. 8.2 tests/registration.test \RegistrationStandardTestCase::testRegistrationType()
  2. 7 tests/registration.test \RegistrationStandardTestCase::testRegistrationType()

Tests if registration type is set.

File

tests/registration.test, line 150
Tests for the Registration module

Class

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

Code

function testRegistrationType() {

  // Save.
  $this
    ->assertTrue(is_numeric($this->registration_type->id), t('registration bundle has ID'), 'Registration');

  // Load.
  $registration_type_load = entity_load_single('registration_type', $this->registration_type->id);
  $this
    ->assertNotIdentical(FALSE, $registration_type_load, t('registration bundle loaded'), 'Registration');
  $this
    ->assertEqual($this->registration_type->id, $registration_type_load->id, t('registration bundle matches previously saved bundle.'), 'Registration');

  // Get all types.
  $types = registration_get_types();
  $this
    ->assertTrue(isset($types[$this->registration_type_name]), t('Load all registration types'), 'Registration');

  // Ensure value on field saves.
  $this
    ->resetRegistration();
  $entity2 = entity_load_single($this->host_entity_type, $this->host_entity_id);
  $this
    ->assertEqual(registration_get_entity_registration_type($this->host_entity_type, $entity2), $this->registration_type_name, t('Saved registration type in registration field.'), 'Registration');

  // Ensure permissions exist for registration type.
  $this
    ->checkPermissions(array(
    'administer ' . $this->registration_type_name . ' registration',
  ), TRUE);
}