If we want to create a node within a test, must we use $this->drupalCreateNode or can we simply use $this->drupalPost ?
E.g. must we do this way:
// Create a node of a custom node type defined by module
$settings = array(
'type' => 'my_module_node_type',
'arv' => array(
'my_field' => "test",
'category_id' => '1',
),
);
$this->my_node = $this->drupalCreateNode($settings);
Or can we test the node creation process this way:
$edit = array(
'category_id' => 1,
);
$this->drupalPost('node/add/my-module-node-type', $edit, 'Save');
The documentation is not clear on this.
Currently, Using the method $this->drupalPost, a node creation fails: my custom table gets populated, but the node is not properly created ({node} remains empty).
Comments
Comment #1
dave reidYep you can do things manually via drupalPost whenever you want!
Comment #2
dave reid