You are here

class EnergyBelowCutoffTest in Radioactivity 4.0.x

Same name and namespace in other branches
  1. 8.3 tests/src/Unit/EnergyBelowCutoffTest.php \Drupal\Tests\radioactivity\Unit\EnergyBelowCutoffTest

Checks that the event "radioactivity_field_cutoff" is correctly defined.

@coversDefaultClass \Drupal\radioactivity\Event\EnergyBelowCutoffEvent @group radioactivity

@requires module rules

Hierarchy

  • class \Drupal\Tests\radioactivity\Unit\EventTestBase extends \Drupal\Tests\rules\Unit\Integration\Event\EventTestBase

Expanded class hierarchy of EnergyBelowCutoffTest

File

tests/src/Unit/EnergyBelowCutoffTest.php, line 13

Namespace

Drupal\Tests\radioactivity\Unit
View source
class EnergyBelowCutoffTest extends EventTestBase {

  /**
   * Tests the event metadata.
   */
  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());
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EnergyBelowCutoffTest::testBundleCreatedEvent public function Tests the event metadata.
EventTestBase::setUp protected function