You are here

protected function DurationFieldFunctionalTest::setFormatter in Duration Field 8.2

Same name and namespace in other branches
  1. 3.0.x tests/src/Functional/DurationFieldFunctionalTest.php \Drupal\Tests\duration_field\Functional\DurationFieldFunctionalTest::setFormatter()

Sets the formatter to be tested.

4 calls to DurationFieldFunctionalTest::setFormatter()
DurationFieldFunctionalTest::testRawValue in tests/src/Functional/DurationFieldFunctionalTest.php
Tests the raw value field formatter.
DurationFieldFunctionalTest::testTimeDate in tests/src/Functional/DurationFieldFunctionalTest.php
Tests the date part of the time formatter.
DurationFieldFunctionalTest::testTimeFull in tests/src/Functional/DurationFieldFunctionalTest.php
Tests full time for the Time Formatter.
DurationFieldFunctionalTest::testTimeTime in tests/src/Functional/DurationFieldFunctionalTest.php
Tests the time part of a time.

File

tests/src/Functional/DurationFieldFunctionalTest.php, line 289

Class

DurationFieldFunctionalTest
Functional tests for the Duration Field module.

Namespace

Drupal\Tests\duration_field\Functional

Code

protected function setFormatter($formatter) {
  $types = [
    'raw' => 'duration_string_display',
    'human' => 'duration_human_display',
    'time' => 'duration_time_display',
  ];
  $this
    ->drupalGet('/admin/structure/types/manage/test_type/display');
  $this
    ->assertStatusCodeEquals(200);
  $this
    ->selectSelectOption('#edit-fields-field-duration-type', $types[$formatter]);
  $this
    ->click('#edit-submit');
}