You are here

public function DurationFieldFunctionalTest::testTimeFormatter 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::testTimeFormatter()

Tests the Time Format duration field formatter outputs correct data.

File

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

Class

DurationFieldFunctionalTest
Functional tests for the Duration Field module.

Namespace

Drupal\Tests\duration_field\Functional

Code

public function testTimeFormatter() {
  $this
    ->createDefaultSetup([
    'h',
    'i',
    's',
  ]);
  $this
    ->fillTextValue('#edit-title-0-value', 'Dummy Title');
  $this
    ->fillTextValue('#edit-field-duration-0-duration-h', 1);
  $this
    ->fillTextValue('#edit-field-duration-0-duration-i', 2);
  $this
    ->fillTextValue('#edit-field-duration-0-duration-s', 3);
  $this
    ->click('input[name="op"]');
  $this
    ->assertStatusCodeEquals(200);
  $this
    ->assertTextExists('1 hour 2 minutes 3 seconds');
  $this
    ->assertTextNotExists('year');
}