You are here

public function DurationFieldAccessTest::testHumanReadableTime in Duration Field 8

Test human readable times.

File

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

Class

DurationFieldAccessTest
Functional tests for the Duration Field module.

Namespace

Drupal\Tests\duration_field\Functional

Code

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