function RegistrationStandardTestCase::testRegistrationFieldCreate in Entity Registration 8.2
Same name in this branch
- 8.2 tests/registration.test \RegistrationStandardTestCase::testRegistrationFieldCreate()
- 8.2 src/RegistrationStandardTestCase.php \Drupal\registration\RegistrationStandardTestCase::testRegistrationFieldCreate()
Tests if registration fields were created successfully, and associated with an entity.
File
- src/
RegistrationStandardTestCase.php, line 26
Class
- RegistrationStandardTestCase
- Creates a registration type Create node entity type ensure registration type exists
Namespace
Drupal\registrationCode
function testRegistrationFieldCreate() {
$field_name =& $this->field['field_name'];
$entity =& $this->host_entity;
// Field created.
$this
->assertTrue(isset($this->field['id']), t('Registration field created'), 'Registration');
// Instance created.
$read_instance = field_read_instance($this->host_entity_type, $field_name, $entity->type);
$this
->assertNotIdentical(FALSE, $read_instance, t('Create registration instance'), 'Registration');
// Get Instance.
$registration_instances = registration_get_registration_instances(array(
'entity_type' => $this->host_entity_type,
'bundle' => $entity->type,
));
$this
->assertTrue(count($registration_instances) == 1, t('Read registration field instances'), 'Registration');
$this
->assertTrue($registration_instances[0]['field_name'] == $field_name, t('Validate registration field instance data.'), 'Registration');
}