You are here

public function GridStackFormatterTest::testAdminOptions in GridStack 8

Same name and namespace in other branches
  1. 8.2 tests/src/Kernel/GridStackFormatterTest.php \Drupal\Tests\gridstack\Kernel\GridStackFormatterTest::testAdminOptions()

Tests for \Drupal\gridstack\Form\GridStackAdmin.

@covers \Drupal\gridstack\Form\GridStackAdmin::buildSettingsForm @covers \Drupal\gridstack\Form\GridStackAdmin::openingForm @covers \Drupal\gridstack\Form\GridStackAdmin::mainForm @covers \Drupal\gridstack\Form\GridStackAdmin::closingForm @covers \Drupal\gridstack\Form\GridStackAdmin::finalizeForm @covers \Drupal\gridstack\Form\GridStackAdmin::getLayoutOptions @covers \Drupal\gridstack\Form\GridStackAdmin::getSkinOptions @covers \Drupal\gridstack\Form\GridStackAdmin::getSettingsSummary @covers \Drupal\gridstack\Form\GridStackAdmin::getFieldOptions

File

tests/src/Kernel/GridStackFormatterTest.php, line 181

Class

GridStackFormatterTest
Tests the GridStack field rendering using the image field type.

Namespace

Drupal\Tests\gridstack\Kernel

Code

public function testAdminOptions() {
  $definition = $this
    ->getGridStackFormatterDefinition();
  $form['test'] = [
    '#type' => 'hidden',
  ];
  $this->gridstackAdmin
    ->buildSettingsForm($form, $definition);
  $this
    ->assertArrayHasKey('optionset', $form);
  $this->gridstackAdmin
    ->finalizeForm($form, $definition);
  $this
    ->assertArrayHasKey('closing', $form);
  $options = $this->gridstackAdmin
    ->getLayoutOptions();
  $this
    ->assertArrayHasKey('bottom', $options);
  $options = $this->gridstackAdmin
    ->getSkinOptions();
  $this
    ->assertArrayHasKey('selena', $options);
  $summary = $this->gridstackAdmin
    ->getSettingsSummary($definition);
  $this
    ->assertNotEmpty($summary);
  $options = $this->gridstackAdmin
    ->getFieldOptions([], [], 'node');
  $this
    ->assertArrayHasKey($this->testFieldName, $options);
}