I am creating a test class using the framework of the core Testing module for a module that is supposed to autoexpire nodes some time after they've been created.
Nodes have two timestamp fields:
created. I've tried to use the following code inside my test class (subclass of
DrupalWebTestCase) to post an article that is supposed to have been created some time ago:
// Post an article. $edit = array(); $edit["title"] = $this->randomName(8); $edit["body[und][value]"] = $this->randomName(16); $edit['changed'] = 1397700000; // This is accepted. $edit['created'] = 1397700000; // This fails. $this->drupalPost('node/add/article', $edit, t('Save'));
The above code snippet produces the following error message when the test is run:
Failed to set field created to 1397700000
Do anyone know how to explicitly set the
created field to some specified Unix timestamp date for a node created inside a test class?