You are here

public function RoleExportTestCase::testImport in Role Export 6

File

./role_export.test, line 65
Test Role Export.

Class

RoleExportTestCase
@file Test Role Export.

Code

public function testImport() {
  $this
    ->assertTrue(is_dir('sites/all/modules/test_role_feature'), "Can't find Feature exported in previous test.");

  // Activate the Feature
  $this
    ->assertFalse(module_exists('test_role_feature'), "The test Feature export module is already enabled.");
  drupal_install_modules(array(
    'test_role_feature',
  ));
  $this
    ->assertTrue(module_exists('test_role_feature'), "The test Feature export module didn't install.");

  // Our Feature requires a revert, since it's a "faux-exportable"
  features_revert(array(
    'test_role_feature' => array(
      'role_export',
    ),
  ));

  // Make sure the exported role was imported and has the correct rid and name
  $roles = user_roles();
  $this
    ->assertTrue(isset($roles[924007658]), "The test Feature export didn't create a Role, or didn't create a Role with the correct hashed machine_name.");
  $this
    ->assertEqual($roles[924007658], 'Test Role', "The test Feature export didn't create a Role with the correct display name.");
}