You are here

public function BlazyAdminExtendedUnitTest::testBuildSettingsForm in Blazy 8.2

Same name and namespace in other branches
  1. 8 tests/src/Unit/Form/BlazyAdminExtendedUnitTest.php \Drupal\Tests\blazy\Unit\Form\BlazyAdminExtendedUnitTest::testBuildSettingsForm()

Tests BlazyAdminExtended.

@covers ::openingForm @covers ::imageStyleForm @covers ::fieldableForm @covers ::mediaSwitchForm @covers ::gridForm @covers ::closingForm @covers ::finalizeForm @dataProvider providerTestBuildSettingsForm

File

tests/src/Unit/Form/BlazyAdminExtendedUnitTest.php, line 86

Class

BlazyAdminExtendedUnitTest
Tests the Blazy admin formatter form.

Namespace

Drupal\Tests\blazy\Unit\Form

Code

public function testBuildSettingsForm($id, $vanilla) {
  $form = [];
  $definition = $this
    ->getDefaulEntityFormatterDefinition() + $this
    ->getDefaultFormatterDefinition();
  $definition['settings'] += $this
    ->getDefaultFields(TRUE);
  $definition['id'] = $id;
  $definition['vanilla'] = $vanilla;
  $definition['_views'] = TRUE;
  $this->blazyAdminExtended
    ->openingForm($form, $definition);
  $this
    ->assertEquals($vanilla, !empty($form['vanilla']));
  $this->blazyAdminExtended
    ->fieldableForm($form, $definition);
  $this
    ->assertEquals($id, !empty($form['id']));
  $this->blazyAdminExtended
    ->closingForm($form, $definition);
  $this
    ->assertArrayHasKey('closing', $form);
}