function RngEventTypeMappingFormTest::testMappingFormDeleted in RNG - Events and Registrations 8
Same name and namespace in other branches
- 8.2 src/Tests/RngEventTypeMappingFormTest.php \Drupal\rng\Tests\RngEventTypeMappingFormTest::testMappingFormDeleted()
- 3.x src/Tests/RngEventTypeMappingFormTest.php \Drupal\rng\Tests\RngEventTypeMappingFormTest::testMappingFormDeleted()
Test mapping form when a field does not exist.
File
- src/
Tests/ RngEventTypeMappingFormTest.php, line 56
Class
- RngEventTypeMappingFormTest
- Tests RNG event type mapping form.
Namespace
Drupal\rng\TestsCode
function testMappingFormDeleted() {
// Delete the field since it was added automatically by EventType::postSave
$field = FieldConfig::loadByName('entity_test', 'entity_test', EventManagerInterface::FIELD_REGISTRATION_REGISTRANTS_MINIMUM);
$field
->delete();
$url = $this->eventType
->toUrl('field-mapping');
$this
->drupalGet($url);
$this
->removeWhiteSpace();
$this
->assertRaw('<td>Minimum registrants</td><td>Minimum number of registrants per registration.</td><td>Does not exist</td>');
$this
->assertFieldById('edit-table-rng-registrants-minimum-operations-create', 'Create', "Create button exists for 'minimum registrants' field");
// Test the field is added back.
$this
->drupalPostForm($url, [], t('Create'));
$this
->removeWhiteSpace();
$this
->assertRaw('<td>Minimum registrants</td><td>Minimum number of registrants per registration.</td><td>Exists</td>');
$this
->assertText('Field Minimum registrants added.');
}