You are here

public function NodeTypePreviewImageFormTest::testGetFormNoField in Acquia Content Hub 8

Tests the getForm() method, no field for this entity.

@covers ::getForm

File

tests/src/Unit/Form/NodeTypePreviewImageFormTest.php, line 78

Class

NodeTypePreviewImageFormTest
PHPUnit test for the NodeTypePreviewImageForm class.

Namespace

Drupal\Tests\acquia_contenthub\Unit\Form

Code

public function testGetFormNoField() {
  $preview_image_form = new NodeTypePreviewImageForm($this->contenthubEntityManager, $this->entityTypeManager, $this->entityFieldManager);
  $this->entityFieldManager
    ->expects($this
    ->once())
    ->method('getFieldDefinitions')
    ->with('node', 'article')
    ->willReturn([]);
  $preview_image_form
    ->setStringTranslation($this
    ->getStringTranslationStub());
  $form = $preview_image_form
    ->getForm('article');
  $this
    ->assertRegexp('/no image field/', $form['no_image_field']['#markup']);
}