You are here

public function DateRecurModularAlphaTest::testWidget in Recurring Date Field Modular Widgets 8

Same name and namespace in other branches
  1. 3.x tests/src/Functional/DateRecurModularAlphaTest.php \Drupal\Tests\date_recur_modular\Functional\DateRecurModularAlphaTest::testWidget()
  2. 2.x tests/src/Functional/DateRecurModularAlphaTest.php \Drupal\Tests\date_recur_modular\Functional\DateRecurModularAlphaTest::testWidget()

Tests field widget input is converted to appropriate database values.

@dataProvider providerTestWidget

Parameters

array $values: Array of form fields to submit.

array $expected: Array of expected field normalized values.

File

tests/src/Functional/DateRecurModularAlphaTest.php, line 64

Class

DateRecurModularAlphaTest
Tests Alpha Widget.

Namespace

Drupal\Tests\date_recur_modular\Functional

Code

public function testWidget(array $values, array $expected) : void {
  $entity = DrEntityTest::create();
  $entity
    ->save();
  $this
    ->drupalGet($entity
    ->toUrl('edit-form'));
  $this
    ->drupalPostForm(NULL, $values, 'Save');
  $this
    ->assertSession()
    ->pageTextContains('has been updated.');
  $entity = DrEntityTest::load($entity
    ->id());
  $this
    ->assertEquals($expected, $entity->dr[0]
    ->getValue());
}