function LegacyTest::testTaxonomyLegacyNode in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/taxonomy/src/Tests/LegacyTest.php \Drupal\taxonomy\Tests\LegacyTest::testTaxonomyLegacyNode()
Test taxonomy functionality with nodes prior to 1970.
File
- core/
modules/ taxonomy/ src/ Tests/ LegacyTest.php, line 58 - Contains \Drupal\taxonomy\Tests\LegacyTest.
Class
- LegacyTest
- Posts an article with a taxonomy term and a date prior to 1970.
Namespace
Drupal\taxonomy\TestsCode
function testTaxonomyLegacyNode() {
// Posts an article with a taxonomy term and a date prior to 1970.
$date = new DrupalDateTime('1969-01-01 00:00:00');
$edit = array();
$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
->drupalPostForm('node/add/article', $edit, t('Save and publish'));
// Checks that the node has been saved.
$node = $this
->drupalGetNodeByTitle($edit['title[0][value]']);
$this
->assertEqual($node
->getCreatedTime(), $date
->getTimestamp(), 'Legacy node was saved with the right date.');
}