function EarlyDateTest::testTaxonomyEarlyDateNode
Same name in other branches
- 8.9.x core/modules/taxonomy/tests/src/Functional/EarlyDateTest.php \Drupal\Tests\taxonomy\Functional\EarlyDateTest::testTaxonomyEarlyDateNode()
- 10 core/modules/taxonomy/tests/src/Functional/EarlyDateTest.php \Drupal\Tests\taxonomy\Functional\EarlyDateTest::testTaxonomyEarlyDateNode()
- 11.x core/modules/taxonomy/tests/src/Functional/EarlyDateTest.php \Drupal\Tests\taxonomy\Functional\EarlyDateTest::testTaxonomyEarlyDateNode()
Tests taxonomy functionality with nodes prior to 1970.
File
-
core/
modules/ taxonomy/ tests/ src/ Functional/ EarlyDateTest.php, line 67
Class
- EarlyDateTest
- Posts an article with a taxonomy term and a date prior to 1970.
Namespace
Drupal\Tests\taxonomy\FunctionalCode
public function testTaxonomyEarlyDateNode() {
// Posts an article with a taxonomy term and a date prior to 1970.
$date = new DrupalDateTime('1969-01-01 00:00:00');
$edit = [];
$edit['title[0][value]'] = $this->randomMachineName();
$edit['created[0][value][date]'] = $date->format('Y-m-d');
$edit['created[0][value][time]'] = $date->format('H:i:s');
$edit['body[0][value]'] = $this->randomMachineName();
$edit['field_tags[target_id]'] = $this->randomMachineName();
$this->drupalGet('node/add/article');
$this->submitForm($edit, 'Save');
// Checks that the node has been saved.
$node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
$this->assertEquals($date->getTimestamp(), $node->getCreatedTime(), 'Legacy node was saved with the right date.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.