You are here

private function PublicationDateTest::getPubdateFieldValue in Publication Date 8.2

Returns the value of our published-at field

Return value

string

1 call to PublicationDateTest::getPubdateFieldValue()
PublicationDateTest::testActionSavingOnForms in tests/src/Functional/PublicationDateTest.php
Test automatic saving of variables via forms

File

tests/src/Functional/PublicationDateTest.php, line 210
Contains \Drupal\publication_date\Tests\PublicationDateTest.

Class

PublicationDateTest
Tests for publication_date.

Namespace

Drupal\publication_date\Tests

Code

private function getPubdateFieldValue() {
  $this
    ->assertSession()
    ->fieldExists('published_at[0][value][date]');
  $field = $this
    ->xpath('//input[@name="published_at[0][value][date]"]');
  $date = (string) $field[0]
    ->getValue();
  $this
    ->assertSession()
    ->fieldExists('published_at[0][value][time]');
  $field = $this
    ->xpath('//input[@name="published_at[0][value][time]"]');
  $time = (string) $field[0]
    ->getValue();
  return trim($date . ' ' . $time);
}