You are here

public function RateWidgetSettingsTest::testSettingsFormDisableFontawesome in Rate 8.2

Tests the disable fontawesome settings.

File

tests/src/Functional/RateWidgetSettingsTest.php, line 90

Class

RateWidgetSettingsTest
Tests the SettingsForm form.

Namespace

Drupal\Tests\rate\Functional

Code

public function testSettingsFormDisableFontawesome() {
  $form_state = (new FormState())
    ->setValues([
    'disable_fontawesome' => FALSE,
  ]);
  $this->formBuilder
    ->submitForm(RateSettingsForm::class, $form_state);
  $this->settingsConfig = $this
    ->config('rate.settings');
  $this
    ->assertCount(0, $form_state
    ->getErrors());
  $this
    ->assertEmpty($this->settingsConfig
    ->get('disable_fontawesome'));
  $this
    ->drupalGet('node/1');
  $form_state = (new FormState())
    ->setValues([
    'disable_fontawesome' => TRUE,
  ]);
  $this->formBuilder
    ->submitForm(RateSettingsForm::class, $form_state);
  $this->settingsConfig = $this
    ->config('rate.settings');
  $this
    ->assertCount(0, $form_state
    ->getErrors());
  $this
    ->assertTrue($this->settingsConfig
    ->get('disable_fontawesome'));
  $this
    ->drupalGet('node/2');
}