You are here

function RegistrationStandardTestCase::testRegistrationHostDelete in Entity Registration 8.2

Same name in this branch
  1. 8.2 tests/registration.test \RegistrationStandardTestCase::testRegistrationHostDelete()
  2. 8.2 src/RegistrationStandardTestCase.php \Drupal\registration\RegistrationStandardTestCase::testRegistrationHostDelete()
Same name and namespace in other branches
  1. 7.2 tests/registration.test \RegistrationStandardTestCase::testRegistrationHostDelete()
  2. 7 tests/registration.test \RegistrationStandardTestCase::testRegistrationHostDelete()

File

tests/registration.test, line 512
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,
    'registrant_id' => $user_b->uid,
  ));
  $this->host_entity_id
    ->delete();
  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');
}