You are here

public function OgMigrateGroupMembershipTestCase::testOgUpgrade in Organic groups 7

Test a successful upgrade.

File

./og.test, line 1413

Class

OgMigrateGroupMembershipTestCase
Migrate group membership test.

Code

public function testOgUpgrade() {

  // Run the required migration.
  $edit = array(
    'migrate[group_membership]' => TRUE,
  );
  $this
    ->drupalPost('admin/config/group/group-migrate', $edit, t('Migrate'));

  // Assert according to the scenario the test table dump was created.
  $group_memberships = og_membership_load_multiple(FALSE);
  $info = array(
    2 => OG_STATE_ACTIVE,
    3 => OG_STATE_ACTIVE,
    4 => OG_STATE_PENDING,
    5 => OG_STATE_BLOCKED,
  );
  $this
    ->assertEqual(count($group_memberships), count($info), t('All group membership enteties exist.'));
  foreach ($group_memberships as $key => $group_membership) {
    $this
      ->assertEqual($group_membership->state, $info[$group_membership->etid], t('User ID @id has correct state', array(
      '@id' => $key + 1,
    )));
  }

  // Assert the created time was updated.
  $this
    ->assertEqual($group_memberships[2]->created, 1000000000, t('Create date was upgraded.'));
}