function RegistrationAPITestCase::testHookStatus in Entity Registration 8.2
Same name in this branch
- 8.2 tests/registration.test \RegistrationAPITestCase::testHookStatus()
- 8.2 src/RegistrationAPITestCase.php \Drupal\registration\RegistrationAPITestCase::testHookStatus()
Test hook_registration_status().
File
- src/
RegistrationAPITestCase.php, line 49
Class
Namespace
Drupal\registrationCode
function testHookStatus() {
// Testing host status, no hook.
$this
->setHostEntitySettings(array(
'status' => 1,
));
$this
->assertTrue(registration_status($this->host_entity_type, $this->host_entity_id, TRUE), t('Host entity status is open.'), 'Registration');
// Host main status is opened, hook closes.
\Drupal::configFactory()
->getEditable('registration.settings')
->set('registration_test_api_registration_status_alter', FALSE)
->save();
$this
->assertFalse(registration_status($this->host_entity_type, $this->host_entity_id, TRUE), t('Host entity status is open, hook overrides'), 'Registration');
// Hook should still be invoked if main status is closed.
$this
->setHostEntitySettings(array(
'status' => 0,
));
\Drupal::configFactory()
->getEditable('registration.settings')
->set('registration_test_api_registration_status_alter', TRUE)
->save();
$this
->assertTrue(registration_status($this->host_entity_type, $this->host_entity_id, TRUE), t('Host entity status is closed, hook overrides.'), 'Registration');
}