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

dave reid’s picture

Yep you can do things manually via drupalPost whenever you want!

dave reid’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.