function LegacyTest::testTaxonomyLegacyNode

Test taxonomy functionality with nodes prior to 1970.

File

drupal/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/LegacyTest.php, line 38
Definition of Drupal\taxonomy\Tests\LegacyTest.

Class

LegacyTest
Test for legacy node bug.

Namespace

Drupal\taxonomy\Tests

Code

function testTaxonomyLegacyNode() {

  // Posts an article with a taxonomy term and a date prior to 1970.
  $langcode = Language::LANGCODE_NOT_SPECIFIED;
  $date = new DrupalDateTime('1969-01-01 00:00:00');
  $edit = array();
  $edit['title'] = $this
    ->randomName();
  $edit['date[date]'] = $date
    ->format('Y-m-d');
  $edit['date[time]'] = $date
    ->format('H:i:s');
  $edit["body[{$langcode}][0][value]"] = $this
    ->randomName();
  $edit["field_tags[{$langcode}]"] = $this
    ->randomName();
  $this
    ->drupalPost('node/add/article', $edit, t('Save and publish'));

  // Checks that the node has been saved.
  $node = $this
    ->drupalGetNodeByTitle($edit['title']);
  $this
    ->assertEqual($node->created, $date
    ->getTimestamp(), 'Legacy node was saved with the right date.');
}