You are here

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

Tests full time for the Time Formatter.

File

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

Class

DurationFieldFunctionalTest
Functional tests for the Duration Field module.

Namespace

Drupal\Tests\duration_field\Functional

Code

public function testTimeFull() {
  $this
    ->createDefaultSetup();
  $this
    ->setFormatter('time');
  $this
    ->drupalGet('node/add/test_type');
  $this
    ->assertStatusCodeEquals(200);
  $this
    ->assertSession()
    ->addressMatches('/^\\/node\\/add\\/test_type$/');
  $this
    ->fillTextValue('#edit-title-0-value', 'Dummy Title');
  $this
    ->fillTextValue('#edit-field-duration-0-duration-y', 1);
  $this
    ->fillTextValue('#edit-field-duration-0-duration-m', 2);
  $this
    ->fillTextValue('#edit-field-duration-0-duration-d', 3);
  $this
    ->fillTextValue('#edit-field-duration-0-duration-h', 4);
  $this
    ->fillTextValue('#edit-field-duration-0-duration-i', 5);
  $this
    ->fillTextValue('#edit-field-duration-0-duration-s', 6);
  $this
    ->click('input[name="op"]');
  $this
    ->assertStatusCodeEquals(200);
  $this
    ->assertTextExists('1/2/3 04:05:06');
  $this
    ->drupalGet('node/add/test_type');
  $this
    ->assertStatusCodeEquals(200);
  $this
    ->assertSession()
    ->addressMatches('/^\\/node\\/add\\/test_type$/');
  $this
    ->fillTextValue('#edit-title-0-value', 'Dummy Title');
  $this
    ->fillTextValue('#edit-field-duration-0-duration-y', 1);
  $this
    ->fillTextValue('#edit-field-duration-0-duration-m', 2);
  $this
    ->fillTextValue('#edit-field-duration-0-duration-d', 3);
  $this
    ->fillTextValue('#edit-field-duration-0-duration-h', 12);
  $this
    ->fillTextValue('#edit-field-duration-0-duration-i', 13);
  $this
    ->fillTextValue('#edit-field-duration-0-duration-s', 14);
  $this
    ->click('input[name="op"]');
  $this
    ->assertStatusCodeEquals(200);
  $this
    ->assertTextExists('1/2/3 12:13:14');
}