public function OgMigrate7000TestCase::testGroup in Organic groups 7.2
Test a successful group upgrade.
See also
og_7000_group()
File
- ./
og.test, line 987
Class
- OgMigrate7000TestCase
- Upgrade 7000 test.
Code
public function testGroup() {
// Assert according to the scenario Drupal 6's test table dump was created.
foreach (array(
1,
2,
) as $nid) {
$this
->drupalGet('node/' . $nid);
$node = node_load($nid);
$this
->assertTrue($node->{OG_GROUP_FIELD}[LANGUAGE_NONE][0]['value'], t('Node ID @nid is an active group.', array(
'@nid' => $nid,
)));
}
// Test group content with NID 3 - 5 belong to the group with NID 2.
foreach (range(3, 5) as $nid) {
$this
->drupalGet('node/' . $nid);
$node = node_load($nid);
$this
->assertTrue(og_is_member('node', 2, 'node', $node), t('Node ID @nid is a group content of Node ID 2', array(
'@nid' => $nid,
)));
}
// Orphan group content (i.e. not attached to a group).
$node = node_load(6);
$this
->assertFalse(og_get_entity_groups('node', $node), t('Node ID 6 is not associated with any group.'));
// Group content that shares the same group.
$node = node_load(9);
foreach (array(
7,
8,
) as $nid) {
$this
->assertTrue(og_is_member('node', $nid, 'node', $node), t('Node ID @nid is as group content associated with multiple groups.', array(
'@nid' => $node->nid,
)));
}
}