public function NodeTypePreviewImageFormTest::testGetFormWithNoStyle in Acquia Content Hub 8
Tests the getForm() method, no style.
@covers ::getForm
File
- tests/
src/ Unit/ Form/ NodeTypePreviewImageFormTest.php, line 95
Class
- NodeTypePreviewImageFormTest
- PHPUnit test for the NodeTypePreviewImageForm class.
Namespace
Drupal\Tests\acquia_contenthub\Unit\FormCode
public function testGetFormWithNoStyle() {
$preview_image_form = new NodeTypePreviewImageForm($this->contenthubEntityManager, $this->entityTypeManager, $this->entityFieldManager);
$preview_image_form
->setStringTranslation($this
->getStringTranslationStub());
$field_definitions = [
'field_description' => $this
->getFieldDefinition('description'),
'field_image' => $this
->getFieldDefinition('image'),
];
$this->entityFieldManager
->expects($this
->once())
->method('getFieldDefinitions')
->with('node', 'article')
->willReturn($field_definitions);
acquia_polyfill_controller_set_return('image_style_options', []);
$form = $preview_image_form
->getForm('article');
$this
->assertEquals(1, count($form['style']['#options']));
$this
->assertEquals('Acquia Content Hub Preview Image (150×150)', $form['style']['#options']['acquia_contenthub_preview_image_add']);
}