public function EnergyBelowCutoffTest::testBundleCreatedEvent in Radioactivity 4.0.x
Same name and namespace in other branches
- 8.3 tests/src/Unit/EnergyBelowCutoffTest.php \Drupal\Tests\radioactivity\Unit\EnergyBelowCutoffTest::testBundleCreatedEvent()
Tests the event metadata.
File
- tests/
src/ Unit/ EnergyBelowCutoffTest.php, line 18
Class
- EnergyBelowCutoffTest
- Checks that the event "radioactivity_field_cutoff" is correctly defined.
Namespace
Drupal\Tests\radioactivity\UnitCode
public function testBundleCreatedEvent() {
$plugin_definition = $this->eventManager
->getDefinition('radioactivity_field_cutoff');
$this
->assertSame('Energy is below the cutoff level', (string) $plugin_definition['label']);
$event = $this->eventManager
->createInstance('radioactivity_field_cutoff');
$entity_context_definition = $event
->getContextDefinition('entity');
$this
->assertSame('entity', $entity_context_definition
->getDataType());
$this
->assertSame('Entity', $entity_context_definition
->getLabel());
}