You are here

function RegistrationStandardTestCase::testRegistrationHostDelete in Entity Registration 7

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

File

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

Class

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

Code

function testRegistrationHostDelete() {
  $user_a = $this
    ->drupalCreateUser();
  $this
    ->drupalLogin($user_a);

  // Delete the host entity.
  $user_b = $this
    ->drupalCreateUser();
  $registration_a = $this
    ->createRegistration(array(
    'author_uid' => $user_a->uid,
    'user_uid' => $user_b->uid,
  ));
  entity_delete($this->host_entity_type, $this->host_entity_id);
  entity_get_controller($this->host_entity_type)
    ->resetCache();
  $this
    ->resetRegistration();
  $this
    ->assertFalse(entity_load_single($this->host_entity_type, $this->host_entity_id), t('Delete host entity.'), 'Registration');
  $this
    ->assertFalse(entity_load_single('registration', $registration_a->registration_id), t('Delete registration when host entity is deleted.'), 'Registration');
}