You are here

public function WebformContentCreatorEntityTest::testEntity in Webform Content Creator 8

Same name and namespace in other branches
  1. 3.x tests/src/Unit/Entity/WebformContentCreatorEntityTest.php \Drupal\Tests\webform_content_creator\Unit\Entity\WebformContentCreatorEntityTest::testEntity()
  2. 2.x tests/src/Unit/Entity/WebformContentCreatorEntityTest.php \Drupal\Tests\webform_content_creator\Unit\Entity\WebformContentCreatorEntityTest::testEntity()

Tests the Webform Content Creator entity functions.

File

tests/src/Unit/Entity/WebformContentCreatorEntityTest.php, line 22

Class

WebformContentCreatorEntityTest
Unit tests for WebformContentCreator class.

Namespace

Drupal\Tests\webform_content_creator\Unit\Entity

Code

public function testEntity() {

  // Mock a Webform Content Creator entity.
  $entity = new WebformContentCreatorEntity([], 'webform_content_creator');
  $this
    ->assertTrue($entity instanceof WebformContentCreatorEntity);

  // Test entity methods.
  $entity
    ->setTitle('testTitle');
  $this
    ->assertEquals($entity
    ->getTitle(), 'testTitle');
  $entity
    ->setContentType('ct1');
  $this
    ->assertEquals($entity
    ->getContentType(), 'ct1');
  $entity
    ->setWebform('webform_entity1');
  $this
    ->assertEquals($entity
    ->getWebform(), 'webform_entity1');
}