You are here

public function EmitTest::testUnpublished in Radioactivity 8.3

Same name and namespace in other branches
  1. 4.0.x tests/src/FunctionalJavascript/EmitTest.php \Drupal\Tests\radioactivity\FunctionalJavascript\EmitTest::testUnpublished()

Validate that no energy is emitted if entity is unpublished.

File

tests/src/FunctionalJavascript/EmitTest.php, line 67

Class

EmitTest
Testing the energy emission of the radioactivity field.

Namespace

Drupal\Tests\radioactivity\FunctionalJavascript

Code

public function testUnpublished() {
  $this->fieldName = 'field_count_energy';
  $this
    ->setEntityType('entity_test_revpub');
  $this
    ->setEntityBundle('entity_test_revpub');
  $this
    ->addCountEnergyField($this->fieldName);
  $this
    ->createEnergyFormDisplay($this->fieldName);
  $this
    ->createEmitterViewDisplay($this->fieldName, 1, 'raw');

  /** @var \Drupal\entity_test\Entity\EntityTestRevPub $entity */
  $entity = $this
    ->createContent();
  $this
    ->assetIncidentCount(0);

  // No emit when unpublished.
  $entity
    ->setUnpublished();
  $entity
    ->save();
  $this
    ->drupalGet('/entity_test_rev/manage/' . $entity
    ->id());
  $this
    ->assertSession()
    ->assertWaitOnAjaxRequest();
  $this
    ->assetIncidentCount(0);
}