Greetings all,

Is there a way to have SimpleTest automatically create the content_field_* tables needed to support shared fields on custom content types, created with CCK? I know that SimpleTest creates a module's tables when you invoke setUp('module'), but the content_field_* tables are not created, probably because they're not in the module.install script.

Drupal 6.4
SimpleTest 6.x-2.4
CCK 6.x-2.0-rc6

I'm just getting started with Drupal and SimpleTest, so be gentle. :)

--d'Armond

Comments

axolx’s picture

Is it possible to create a test node in a SimpleTest unit test for my module's custom content, which has some CCK fields t? Here's a simplified scenario for what I'm trying to do:

$node1 = new stdClass();
$node1->type = 'myTypeWithCCKfields';
#...other standard node fields
$node1->field_example = array(
    0 => array(
        'value' => 'the value',
    )
);
#...other custom CCK node fields
node_save($node1);

Other notes:

$loadIt = node_load($node1->nid, NULL, TRUE);

var_dump($loadIt);

Running the above on Drupal instance shows the CCK fields in the var_dump. Running the same from a SimpleTest test case only shows the basic node fields. The test is specifying the CCK modules when it calls parent::setUp.

  • I'm on D6 (.12)
  • The order in which I'm loading modules in parent::setUp is: array('content', 'filefield', 'text', 'number', 'mymodule', 'token', 'views')

Any help greatly appreciated!

Martin

axolx’s picture

After gaining more understanding of how Simpletest works, I realized that my module should be creating the CCK content type programatically on install in order for it to be available in the blank Drupal instance that Simpletest creates for every test. Doing that fixed the problem. I hope this helps someone some day :)