You are here

function OgUnInstallTestCase::testOgInstall in Organic groups 7

Instaill, uninstall and re-install.

File

./og.test, line 1357

Class

OgUnInstallTestCase
Test re-installation of module.

Code

function testOgInstall() {

  // Assert default roles and permissions were created.
  $global_roles = og_get_global_roles();
  $this
    ->assertFalse(array_diff($global_roles, array(
    OG_ANONYMOUS_ROLE,
    OG_AUTHENTICATED_ROLE,
    OG_ADMINISTRATOR_ROLE,
  )), t('Global roles were created on module installation.'));

  // Uninstall module. Assert the deletion of fields on uninstall.
  module_disable(array(
    'og',
  ));
  drupal_uninstall_modules(array(
    'og',
  ), FALSE);
  $og_fields = field_read_fields(array(
    'module' => 'og',
  ), array(
    'include_inactive' => TRUE,
  ));
  $this
    ->assertTrue(empty($og_fields), 'Uninstalling organic groups module removes all fields owned by the module.');

  // Re-enable module.
  module_enable(array(
    'og',
  ));
  $modules = module_list(TRUE);
  $this
    ->assertFalse(empty($modules['og']), 'Enabling organic groups module after uninstall is sucessful.');
}