function RngRegistrationTypeTest::testRegistrationTypeAPIDelete in RNG - Events and Registrations 8
Same name and namespace in other branches
- 8.2 src/Tests/RngRegistrationTypeTest.php \Drupal\rng\Tests\RngRegistrationTypeTest::testRegistrationTypeAPIDelete()
- 3.x src/Tests/RngRegistrationTypeTest.php \Drupal\rng\Tests\RngRegistrationTypeTest::testRegistrationTypeAPIDelete()
Test registration type deletion.
File
- src/
Tests/ RngRegistrationTypeTest.php, line 105
Class
- RngRegistrationTypeTest
- Tests registration types.
Namespace
Drupal\rng\TestsCode
function testRegistrationTypeAPIDelete() {
// Associate event with registration type.
$this->event->{EventManagerInterface::FIELD_REGISTRATION_TYPE}
->appendItem([
'target_id' => $this->registration_type
->id(),
]);
$this->event
->save();
$this
->assertEqual(1, $this
->countEventRegistrationTypeReferences($this->event
->getEntityTypeId(), $this->registration_type
->id()), 'One reference exists to this registration type');
$registration[0] = $this
->createRegistration($this->event, $this->registration_type
->id());
$this->registration_type
->delete();
$this
->assertIdentical(0, count(Registration::loadMultiple()), 'Registrations no longer exist');
$this
->assertEqual(0, $this
->countEventRegistrationTypeReferences($this->event
->getEntityTypeId(), $this->registration_type
->id()), 'No references from event entities to this registration type');
}