I developed a custom module for an Open Atrium site. Some SimpleTests fail, even though the behavior works properly in my actual development site.

1) I've created a content type ("goal") related to (i.e. child of) an Organic Group, using the Open Atrium/Drupal 'Content Management' UI: the UI generates the SQL for creating the table, not me; SQL for creating table is at end of post.
2) I've created a View, using the View module UI that displays goals & the group the individual goal is related to (see 1st attachment).
3) The View displays data correctly when I test in my development sandbox
4) I added a display of the page to the SimpleTest output & saw the view was not being generated properly
5) The problem occurs even if I use a dummy module file, w NONE of my code - just an include of '.features.inc' (created by export of module as a Feature)
6) The view displays properly when using this dummy module (screenshot referenced in item 2)
7) In SimpleTest, instead of showing the goal-to-group relationship (i.e. goal title in 1 column, group title in a 2nd column), the view displays the title of the goal twice (see 2nd attachment)
8) I run the actual query used for the view (copying from SQL Preview window) and display the results in SimpleTest output; it HAS the correct data - but the view doesn't display correct data
9) The View also displays INCORRECTLY during actual use of the module, if I remove '.features.inc' from the dummy .module file. It's not obvious to me, a relative Drupal beginner, why. The listing of the .features.inc file is below. Just to be sure this wasn't the issue, I added an include of the file in my SimpleTest file, but that makes no difference.

To me, this seems like a "bug", rather than a "feature". I understand that I need to create ALL the data for SimpleTest, but this seems like SimpleTest isn't even creating an environment comparable to the real one.

SQL for table for new content type:
CREATE TABLE `content_type_goal` (
`vid` int(10) unsigned NOT NULL DEFAULT '0',
`nid` int(10) unsigned NOT NULL DEFAULT '0',
`field_group_nid` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`vid`),
KEY `nid` (`nid`),
KEY `field_group_nid` (`field_group_nid`)
)

.features.inc file:
<?php

/**
* Implementation of hook_content_default_fields().
*/
function strategic_plan_content_default_fields() {
$fields = array();

// Exported field: field_strategy
$fields['casetracker_basic_project-field_strategy'] = array(
'field_name' => 'field_strategy',
'type_name' => 'casetracker_basic_project',
'display_settings' => array(
'label' => array(
'format' => 'above',
'exclude' => 0,
),
'5' => array(
'format' => 'default',
'exclude' => 0,
),
'teaser' => array(
'format' => 'default',
'exclude' => 0,
),
'full' => array(
'format' => 'default',
'exclude' => 0,
),
'4' => array(
'format' => 'default',
'exclude' => 0,
),
'2' => array(
'format' => 'default',
'exclude' => 0,
),
'3' => array(
'format' => 'default',
'exclude' => 0,
),
'token' => array(
'format' => 'default',
'exclude' => 0,
),
),
'widget_active' => '1',
'type' => 'nodereference',
'required' => '0',
'multiple' => '0',
'module' => 'nodereference',
'active' => '1',
'referenceable_types' => array(
'strategy' => 'strategy',
'blog' => 0,
'book' => 0,
'casetracker_basic_case' => 0,
'event' => 0,
'goal' => 0,
'group' => 0,
'profile' => 0,
'casetracker_basic_project' => 0,
'shoutbox' => 0,
'feed_ical_item' => 0,
'feed_ical' => 0,
),
'advanced_view' => '--',
'advanced_view_args' => '',
'widget' => array(
'autocomplete_match' => 'contains',
'size' => 60,
'default_value' => array(
'0' => array(
'nid' => '',
),
),
'default_value_php' => NULL,
'label' => 'Strategy',
'weight' => '31',
'description' => '',
'type' => 'nodereference_buttons',
'module' => 'nodereference',
),
);

// Exported field: field_group
$fields['goal-field_group'] = array(
'field_name' => 'field_group',
'type_name' => 'goal',
'display_settings' => array(
'label' => array(
'format' => 'above',
'exclude' => 0,
),
'5' => array(
'format' => 'default',
'exclude' => 0,
),
'teaser' => array(
'format' => 'default',
'exclude' => 0,
),
'full' => array(
'format' => 'default',
'exclude' => 0,
),
'4' => array(
'format' => 'default',
'exclude' => 0,
),
'2' => array(
'format' => 'default',
'exclude' => 0,
),
'3' => array(
'format' => 'default',
'exclude' => 0,
),
'token' => array(
'format' => 'default',
'exclude' => 0,
),
),
'widget_active' => '1',
'type' => 'nodereference',
'required' => '0',
'multiple' => '0',
'module' => 'nodereference',
'active' => '1',
'referenceable_types' => array(
'group' => 'group',
'blog' => 0,
'book' => 0,
'casetracker_basic_case' => 0,
'event' => 0,
'goal' => 0,
'profile' => 0,
'casetracker_basic_project' => 0,
'shoutbox' => 0,
'strategy' => 0,
'feed_ical_item' => 0,
'feed_ical' => 0,
),
'advanced_view' => '--',
'advanced_view_args' => '',
'widget' => array(
'autocomplete_match' => 'contains',
'size' => 60,
'default_value' => array(
'0' => array(
'nid' => '',
),
),
'default_value_php' => NULL,
'label' => 'Group',
'weight' => '31',
'description' => 'Group that this goal has been assigned to',
'type' => 'nodereference_buttons',
'module' => 'nodereference',
),
);

// Exported field: field_goal
$fields['strategy-field_goal'] = array(
'field_name' => 'field_goal',
'type_name' => 'strategy',
'display_settings' => array(
'label' => array(
'format' => 'above',
'exclude' => 0,
),
'5' => array(
'format' => 'default',
'exclude' => 0,
),
'teaser' => array(
'format' => 'default',
'exclude' => 0,
),
'full' => array(
'format' => 'default',
'exclude' => 0,
),
'4' => array(
'format' => 'default',
'exclude' => 0,
),
'2' => array(
'format' => 'default',
'exclude' => 0,
),
'3' => array(
'format' => 'default',
'exclude' => 0,
),
'token' => array(
'format' => 'default',
'exclude' => 0,
),
),
'widget_active' => '1',
'type' => 'nodereference',
'required' => '1',
'multiple' => '0',
'module' => 'nodereference',
'active' => '1',
'referenceable_types' => array(
'goal' => 'goal',
'blog' => 0,
'book' => 0,
'casetracker_basic_case' => 0,
'event' => 0,
'group' => 0,
'profile' => 0,
'casetracker_basic_project' => 0,
'shoutbox' => 0,
'strategy' => 0,
'feed_ical_item' => 0,
'feed_ical' => 0,
),
'advanced_view' => '--',
'advanced_view_args' => '',
'widget' => array(
'autocomplete_match' => 'contains',
'size' => 60,
'default_value' => array(
'0' => array(
'nid' => '',
),
),
'default_value_php' => NULL,
'label' => 'Goal',
'weight' => '31',
'description' => 'Goal that this Strategy will help achieve',
'type' => 'nodereference_buttons',
'module' => 'nodereference',
),
);

// Translatables
// Included for use with string extractors like potx.
t('Goal');
t('Group');
t('Strategy');

return $fields;
}

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Lendude’s picture

Status: Active » Closed (outdated)

This version is not supported anymore.